[pulseaudio-commits] [Git][pulseaudio/pulseaudio][master] 3 commits: alsa: ucm - remove duplicate assignment
PulseAudio Marge Bot (@pulseaudio-merge-bot)
gitlab at gitlab.freedesktop.org
Thu Dec 16 12:26:22 UTC 2021
PulseAudio Marge Bot pushed to branch master at PulseAudio / pulseaudio
Commits:
4d98c8bb by Jaroslav Kysela at 2021-12-16T12:41:11+01:00
alsa: ucm - remove duplicate assignment
The data pointer is already set few lines before.
Signed-off-by: Jaroslav Kysela <perex at perex.cz>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/670>
- - - - -
663e41f9 by Jaroslav Kysela at 2021-12-16T12:41:11+01:00
alsa: ucm - fix h/w mute mixer control probe
BugLink: https://github.com/alsa-project/alsa-ucm-conf/issues/100
BugLink: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1849
Signed-off-by: Jaroslav Kysela <perex at perex.cz>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/670>
- - - - -
a9cc1373 by Jaroslav Kysela at 2021-12-16T14:21:00+02:00
alsa: ucm - update the mixer path also after volume probe
The mixer path is cached in the port structure. The function
probe_volumes (alsa-ucm.c) may wipe the mixer path when
the control probe fails, so it is required to update
the mixer path for the port again.
BugLink: https://github.com/alsa-project/alsa-ucm-conf/issues/100
BugLink: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1849
Signed-off-by: Jaroslav Kysela <perex at perex.cz>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/670>
- - - - -
1 changed file:
- src/modules/alsa/alsa-ucm.c
Changes:
=====================================
src/modules/alsa/alsa-ucm.c
=====================================
@@ -931,6 +931,19 @@ static void set_eld_devices(pa_hashmap *hash)
}
}
+static void update_mixer_paths(pa_hashmap *ports, const char *profile) {
+ pa_device_port *port;
+ pa_alsa_ucm_port_data *data;
+ void *state;
+
+ /* select volume controls on ports */
+ PA_HASHMAP_FOREACH(port, ports, state) {
+ pa_log_info("Updating mixer path for %s: %s", profile, port->name);
+ data = PA_DEVICE_PORT_DATA(port);
+ data->path = pa_hashmap_get(data->paths, profile);
+ }
+}
+
static void probe_volumes(pa_hashmap *hash, bool is_sink, snd_pcm_t *pcm_handle, pa_hashmap *mixers, bool ignore_dB) {
pa_device_port *port;
pa_alsa_path *path;
@@ -964,11 +977,12 @@ static void probe_volumes(pa_hashmap *hash, bool is_sink, snd_pcm_t *pcm_handle,
if (pa_alsa_path_probe(path, NULL, mixer_handle, ignore_dB) < 0) {
pa_log_warn("Could not probe path: %s, using s/w volume", path->name);
pa_hashmap_remove(data->paths, profile);
- } else if (!path->has_volume) {
- pa_log_warn("Path %s is not a volume control", path->name);
+ } else if (!path->has_volume && !path->has_mute) {
+ pa_log_warn("Path %s is not a volume or mute control", path->name);
pa_hashmap_remove(data->paths, profile);
} else
- pa_log_debug("Set up h/w volume using '%s' for %s:%s", path->name, profile, port->name);
+ pa_log_debug("Set up h/w %s using '%s' for %s:%s", path->has_volume ? "volume" : "mute",
+ path->name, profile, port->name);
}
}
@@ -1092,8 +1106,6 @@ static void ucm_add_port_combination(
if (num == 1) {
/* To keep things simple and not worry about stacking controls, we only support hardware volumes on non-combination
* ports. */
- data = PA_DEVICE_PORT_DATA(port);
-
PA_HASHMAP_FOREACH_KV(profile, vol, is_sink ? dev->playback_volumes : dev->capture_volumes, state) {
pa_alsa_path *path = pa_alsa_path_synthesize(vol->mixer_elem,
is_sink ? PA_ALSA_DIRECTION_OUTPUT : PA_ALSA_DIRECTION_INPUT);
@@ -1322,6 +1334,14 @@ void pa_alsa_ucm_add_ports(
/* now set up volume paths if any */
probe_volumes(*p, is_sink, pcm_handle, context->ucm->mixers, ignore_dB);
+ /* probe_volumes() removes per-profile paths from ports if probing them
+ * fails. The path for the current profile is cached in
+ * pa_alsa_ucm_port_data.path, which is not cleared by probe_volumes() if
+ * the path gets removed, so we have to call update_mixer_paths() here to
+ * unset the cached path if needed. */
+ if (card->active_profile)
+ update_mixer_paths(*p, card->active_profile->name);
+
/* then set property PA_PROP_DEVICE_INTENDED_ROLES */
merged_roles = pa_xstrdup(pa_proplist_gets(proplist, PA_PROP_DEVICE_INTENDED_ROLES));
PA_IDXSET_FOREACH(dev, context->ucm_devices, idx) {
@@ -1350,9 +1370,6 @@ int pa_alsa_ucm_set_profile(pa_alsa_ucm_config *ucm, pa_card *card, const char *
int ret = 0;
const char *profile;
pa_alsa_ucm_verb *verb;
- pa_device_port *port;
- pa_alsa_ucm_port_data *data;
- void *state;
if (new_profile == old_profile)
return ret;
@@ -1381,12 +1398,7 @@ int pa_alsa_ucm_set_profile(pa_alsa_ucm_config *ucm, pa_card *card, const char *
}
}
- /* select volume controls on ports */
- PA_HASHMAP_FOREACH(port, card->ports, state) {
- data = PA_DEVICE_PORT_DATA(port);
- data->path = pa_hashmap_get(data->paths, profile);
- }
-
+ update_mixer_paths(card->ports, profile);
return ret;
}
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/compare/2101078c22d0331143295a31b5938dc03a967eba...a9cc1373e2a79396569b2fe6164797b0ed0cb3d1
--
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/compare/2101078c22d0331143295a31b5938dc03a967eba...a9cc1373e2a79396569b2fe6164797b0ed0cb3d1
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/20211216/0675a4ee/attachment-0001.htm>
More information about the pulseaudio-commits
mailing list