mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
alsa-ucm: Fix device conformance check
Right now this check is rejecting devices whose UCM config specifies neither a conflicting device nor a supported device list, and accepting devices which specify both. However, a device without neither list is actually unrestricted, and a device with both lists is a configuration error. Fix the check to accept the former. Furthermore, this is missing another case where an already selected device might have a supported devices list that doesn't have the candidate device. Make this function also check against that, and also make it accept devices already in the set. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
This commit is contained in:
parent
3a68905c7c
commit
80fc80c343
1 changed files with 12 additions and 3 deletions
|
|
@ -1214,6 +1214,9 @@ static int ucm_port_contains(const char *port_name, const char *dev_name, bool i
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool devset_supports_device(pa_idxset *devices, pa_alsa_ucm_device *dev) {
|
static bool devset_supports_device(pa_idxset *devices, pa_alsa_ucm_device *dev) {
|
||||||
|
pa_alsa_ucm_device *d;
|
||||||
|
uint32_t idx;
|
||||||
|
|
||||||
pa_assert(devices);
|
pa_assert(devices);
|
||||||
pa_assert(dev);
|
pa_assert(dev);
|
||||||
|
|
||||||
|
|
@ -1221,6 +1224,10 @@ static bool devset_supports_device(pa_idxset *devices, pa_alsa_ucm_device *dev)
|
||||||
if (pa_idxset_isempty(devices))
|
if (pa_idxset_isempty(devices))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
/* Device already selected */
|
||||||
|
if (pa_idxset_contains(devices, dev))
|
||||||
|
return true;
|
||||||
|
|
||||||
/* No conflicting device must already be selected */
|
/* No conflicting device must already be selected */
|
||||||
if (!pa_idxset_isdisjoint(devices, dev->conflicting_devices))
|
if (!pa_idxset_isdisjoint(devices, dev->conflicting_devices))
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1230,9 +1237,11 @@ static bool devset_supports_device(pa_idxset *devices, pa_alsa_ucm_device *dev)
|
||||||
if (!pa_idxset_issubset(devices, dev->supported_devices))
|
if (!pa_idxset_issubset(devices, dev->supported_devices))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (pa_idxset_isempty(dev->conflicting_devices) && pa_idxset_isempty(dev->supported_devices)) {
|
/* Must not be unsupported by any selected device */
|
||||||
return false;
|
PA_IDXSET_FOREACH(d, devices, idx)
|
||||||
}
|
if (!pa_idxset_isempty(d->supported_devices))
|
||||||
|
if (!pa_idxset_contains(d->supported_devices, dev))
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue