alsa-mixer: allow to re-attach the mixer control element
It may be possible that the ALSA control element appears
again. Allow this combination by checking, if the pulseaudio
mixer element already exists. Do not create the duplicate
mixer element in this case.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/729>
Signed-off-by: buque <wuxu.wu@huawei.com>
This commit is contained in:
parent
347860192e
commit
1767c7368c
@ -0,0 +1,49 @@
|
||||
From def8eb074eb4a80836c39fa320c33fe89bce38d9 Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Mon, 27 Jun 2022 10:32:07 +0200
|
||||
Subject: [PATCH] alsa-mixer: allow to re-attach the mixer control element
|
||||
|
||||
It may be possible that the ALSA control element appears
|
||||
again. Allow this combination by checking, if the pulseaudio
|
||||
mixer element already exists. Do not create the duplicate
|
||||
mixer element in this case.
|
||||
|
||||
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
||||
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/729>
|
||||
---
|
||||
src/modules/alsa/alsa-util.c | 18 +++++++++++++-----
|
||||
1 file changed, 13 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c
|
||||
index f4e838d37..81dc77cc3 100644
|
||||
--- a/src/modules/alsa/alsa-util.c
|
||||
+++ b/src/modules/alsa/alsa-util.c
|
||||
@@ -1663,12 +1663,20 @@ static int mixer_class_event(snd_mixer_class_t *class, unsigned int mask,
|
||||
} else if (mask & SND_CTL_EVENT_MASK_ADD) {
|
||||
snd_ctl_elem_iface_t iface = snd_hctl_elem_get_interface(helem);
|
||||
if (iface == SND_CTL_ELEM_IFACE_CARD || iface == SND_CTL_ELEM_IFACE_PCM) {
|
||||
+ snd_mixer_t *mixer = snd_mixer_class_get_mixer(class);
|
||||
+ snd_ctl_elem_iface_t iface = snd_hctl_elem_get_interface(helem);
|
||||
+ 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);
|
||||
snd_mixer_elem_t *new_melem;
|
||||
-
|
||||
- /* Put the hctl pointer as our private data - it will be useful for callbacks */
|
||||
- if ((err = snd_mixer_elem_new(&new_melem, SND_MIXER_ELEM_PULSEAUDIO, 0, helem, NULL)) < 0) {
|
||||
- pa_log_warn("snd_mixer_elem_new failed: %s", pa_alsa_strerror(err));
|
||||
- return 0;
|
||||
+
|
||||
+ new_melem = pa_alsa_mixer_find(mixer, iface, name, index, device);
|
||||
+ if (!new_melem) {
|
||||
+ /* Put the hctl pointer as our private data - it will be useful for callbacks */
|
||||
+ if ((err = snd_mixer_elem_new(&new_melem, SND_MIXER_ELEM_PULSEAUDIO, 0, helem, NULL)) < 0) {
|
||||
+ pa_log_warn("snd_mixer_elem_new failed: %s", pa_alsa_strerror(err));
|
||||
+ return 0;
|
||||
+ }
|
||||
}
|
||||
|
||||
if ((err = snd_mixer_elem_attach(new_melem, helem)) < 0) {
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
Name: pulseaudio
|
||||
Summary: Improved Linux Sound Server
|
||||
Version: 16.1
|
||||
Release: 4
|
||||
Release: 6
|
||||
License: LGPLv2+
|
||||
URL: https://www.freedesktop.org/wiki/Software/PulseAudio
|
||||
Source0: https://freedesktop.org/software/pulseaudio/releases/pulseaudio-%{version}.tar.xz
|
||||
@ -16,6 +16,7 @@ Source5: default.pa-for-gdm
|
||||
Patch201: pulseaudio-autostart.patch
|
||||
Patch1001: 0001-Fix-the-problem-that-the-description-field-of-pa_als.patch
|
||||
Patch1002: 0001-alsa-mixer-avoid-assertion-at-alsa-lib-mixer-API-whe.patch
|
||||
Patch1003: 0001-alsa-mixer-allow-to-re-attach-the-mixer-control-elem.patch
|
||||
|
||||
BuildRequires: meson
|
||||
BuildRequires: automake libtool gcc-c++ bash-completion
|
||||
@ -243,7 +244,10 @@ exit 0
|
||||
%{_mandir}/man*/*
|
||||
|
||||
%changelog
|
||||
* Mon Dec 12 2022 wuxu <wuxu.wu@huawei.com> - 16.1-4
|
||||
* Mon Dec 12 2022 wuxu <wuxu.wu@huawei.com> - 16.1-6
|
||||
- alsa-mixer: allow to re-attach the mixer control element
|
||||
|
||||
* Mon Dec 12 2022 wuxu <wuxu.wu@huawei.com> - 16.1-5
|
||||
- alsa-mixer: avoid assertion at alsa-lib mixer API when element removal
|
||||
|
||||
* Tue Oct 18 2022 Liu Zixian <liuzixian4@huawei.com> - 16.1-4
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user