[Git][pulseaudio/pulseaudio][master] alsa-ucm: Replace port device UCM context assertion with an error
PulseAudio Marge Bot (@pulseaudio-merge-bot)
gitlab at gitlab.freedesktop.org
Fri Jan 12 20:38:18 UTC 2024
PulseAudio Marge Bot pushed to branch master at PulseAudio / pulseaudio
Commits:
ed3d4f08 by Alper Nebi Yasak at 2024-01-12T20:34:54+00:00
alsa-ucm: Replace port device UCM context assertion with an error
The pa_alsa_ucm_set_port() function is passed both a mapping context and
a device port, and both of these refer to their respective UCM device.
While switching over to having one port per mapping per UCM device, I
expected both of these to be the same device struct, so added an assert
checking so.
This assertion gets triggered when we have multiple UCM verbs declaring
the same UCM device name. The root cause here is that the ports' UCM
device references are set once while creating the ports for the card, so
they happen to be those of a specific verb and may not match those from
a different UCM verb's profiles' mappings.
Solving the root cause necessitates a larger refactor. What we actually
assume here is that name of the UCM device is same for both the port and
the UCM context, which ends up always true in practice. For now, replace
the assert with a check and error.
Signed-off-by: Alper Nebi Yasak <alpernebiyasak at gmail.com>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/802>
- - - - -
1 changed file:
- src/modules/alsa/alsa-ucm.c
Changes:
=====================================
src/modules/alsa/alsa-ucm.c
=====================================
@@ -1581,6 +1581,7 @@ int pa_alsa_ucm_set_port(pa_alsa_ucm_mapping_context *context, pa_device_port *p
pa_alsa_ucm_config *ucm;
pa_alsa_ucm_device *dev;
pa_alsa_ucm_port_data *data;
+ const char *dev_name, *ucm_dev_name;
pa_assert(context && context->ucm);
@@ -1588,8 +1589,17 @@ int pa_alsa_ucm_set_port(pa_alsa_ucm_mapping_context *context, pa_device_port *p
pa_assert(ucm->ucm_mgr);
data = PA_DEVICE_PORT_DATA(port);
- dev = context->ucm_device;
- pa_assert(dev == data->device);
+ dev = data->device;
+ pa_assert(dev);
+
+ if (context->ucm_device) {
+ dev_name = pa_proplist_gets(dev->proplist, PA_ALSA_PROP_UCM_NAME);
+ ucm_dev_name = pa_proplist_gets(context->ucm_device->proplist, PA_ALSA_PROP_UCM_NAME);
+ if (!pa_streq(dev_name, ucm_dev_name)) {
+ pa_log_error("Failed to set port %s with wrong UCM context: %s", dev_name, ucm_dev_name);
+ return -1;
+ }
+ }
return ucm_device_enable(ucm, dev);
}
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/ed3d4f0837f670e5e5afb1afa5bcfc8ff05d3407
--
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/ed3d4f0837f670e5e5afb1afa5bcfc8ff05d3407
You're receiving this email because of your account on gitlab.freedesktop.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20240112/dfc07abe/attachment-0001.htm>
More information about the pulseaudio-commits
mailing list