mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
alsa-mixer: extend pa_alsa_mixer_find with the subdevice check
The full identifier check must be executed for the new melem creation, otherwise the duplicate control element code check is reached. Example (using the snd-aloop driver): numid=56,iface=PCM,name='PCM Notify',device=1,subdevice=1 numid=62,iface=PCM,name='PCM Notify',device=1,subdevice=2 Signed-off-by: Jaroslav Kysela <perex@perex.cz> Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/730>
This commit is contained in:
parent
d1675df0cd
commit
81a051089f
1 changed files with 8 additions and 4 deletions
|
|
@ -1614,7 +1614,8 @@ static snd_mixer_elem_t *pa_alsa_mixer_find(snd_mixer_t *mixer,
|
|||
snd_ctl_elem_iface_t iface,
|
||||
const char *name,
|
||||
unsigned int index,
|
||||
unsigned int device) {
|
||||
unsigned int device,
|
||||
unsigned int subdevice) {
|
||||
snd_mixer_elem_t *elem;
|
||||
|
||||
for (elem = snd_mixer_first_elem(mixer); elem; elem = snd_mixer_elem_next(elem)) {
|
||||
|
|
@ -1631,17 +1632,19 @@ static snd_mixer_elem_t *pa_alsa_mixer_find(snd_mixer_t *mixer,
|
|||
continue;
|
||||
if (snd_hctl_elem_get_device(helem) != device)
|
||||
continue;
|
||||
if (snd_hctl_elem_get_subdevice(helem) != subdevice)
|
||||
continue;
|
||||
return elem;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
snd_mixer_elem_t *pa_alsa_mixer_find_card(snd_mixer_t *mixer, struct pa_alsa_mixer_id *alsa_id, unsigned int device) {
|
||||
return pa_alsa_mixer_find(mixer, SND_CTL_ELEM_IFACE_CARD, alsa_id->name, alsa_id->index, device);
|
||||
return pa_alsa_mixer_find(mixer, SND_CTL_ELEM_IFACE_CARD, alsa_id->name, alsa_id->index, device, 0);
|
||||
}
|
||||
|
||||
snd_mixer_elem_t *pa_alsa_mixer_find_pcm(snd_mixer_t *mixer, const char *name, unsigned int device) {
|
||||
return pa_alsa_mixer_find(mixer, SND_CTL_ELEM_IFACE_PCM, name, 0, device);
|
||||
return pa_alsa_mixer_find(mixer, SND_CTL_ELEM_IFACE_PCM, name, 0, device, 0);
|
||||
}
|
||||
|
||||
static int mixer_class_compare(const snd_mixer_elem_t *c1, const snd_mixer_elem_t *c2)
|
||||
|
|
@ -1679,10 +1682,11 @@ static int mixer_class_event(snd_mixer_class_t *class, unsigned int mask,
|
|||
const char *name = snd_hctl_elem_get_name(helem);
|
||||
const int index = snd_hctl_elem_get_index(helem);
|
||||
const int device = snd_hctl_elem_get_device(helem);
|
||||
const int subdevice = snd_hctl_elem_get_subdevice(helem);
|
||||
snd_mixer_elem_t *new_melem;
|
||||
bool found = true;
|
||||
|
||||
new_melem = pa_alsa_mixer_find(mixer, iface, name, index, device);
|
||||
new_melem = pa_alsa_mixer_find(mixer, iface, name, index, device, subdevice);
|
||||
if (!new_melem) {
|
||||
_helem = pa_xmalloc(sizeof(snd_hctl_elem_t *));
|
||||
*_helem = helem;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue