[pulseaudio-discuss] [PATCH 2/3] alsa: move pa_alsa_setting_select close to pa_alsa_path_select

Tanu Kaskinen tanu.kaskinen at digia.com
Thu Mar 22 02:29:11 PDT 2012


From: Jarkko Nikula <jarkko.nikula at bitmer.com>

Move pa_alsa_setting_select call just after the pa_alsa_path_select in
[sink | source]_set_port_cb functions as there is no dependency to volume
calculations that are done between these two calls. Idea here is to make
possible to merge these two functions since they are called together from
other places too.
---
 src/modules/alsa/alsa-sink.c   |    4 ++--
 src/modules/alsa/alsa-source.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 76ea205..fb045d6 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -1460,11 +1460,11 @@ static int sink_set_port_cb(pa_sink *s, pa_device_port *p) {
     pa_assert_se(u->mixer_path = data->path);
     pa_alsa_path_select(u->mixer_path, u->mixer_handle, s->muted);
 
-    mixer_volume_init(u);
-
     if (data->setting)
         pa_alsa_setting_select(data->setting, u->mixer_handle);
 
+    mixer_volume_init(u);
+
     if (s->set_mute)
         s->set_mute(s);
     if (s->set_volume)
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index c5f54c3..20db467 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -1363,11 +1363,11 @@ static int source_set_port_cb(pa_source *s, pa_device_port *p) {
     pa_assert_se(u->mixer_path = data->path);
     pa_alsa_path_select(u->mixer_path, u->mixer_handle, s->muted);
 
-    mixer_volume_init(u);
-
     if (data->setting)
         pa_alsa_setting_select(data->setting, u->mixer_handle);
 
+    mixer_volume_init(u);
+
     if (s->set_mute)
         s->set_mute(s);
     if (s->set_volume)
-- 
1.7.8



More information about the pulseaudio-discuss mailing list