alsa: move pa_alsa_setting_select close to pa_alsa_path_select
[platform/upstream/pulseaudio.git] / src / modules / alsa / alsa-source.c
index ab7335d..2342f40 100644 (file)
@@ -24,6 +24,7 @@
 #include <config.h>
 #endif
 
+#include <signal.h>
 #include <stdio.h>
 
 #include <asoundlib.h>
@@ -1113,8 +1114,10 @@ static int ctl_mixer_callback(snd_mixer_elem_t *elem, unsigned int mask) {
     if (!PA_SOURCE_IS_LINKED(u->source->state))
         return 0;
 
-    if (u->source->suspend_cause & PA_SUSPEND_SESSION)
+    if (u->source->suspend_cause & PA_SUSPEND_SESSION) {
+        pa_source_set_mixer_dirty(u->source, TRUE);
         return 0;
+    }
 
     if (mask & SND_CTL_EVENT_MASK_VALUE) {
         pa_source_get_volume(u->source, TRUE);
@@ -1133,8 +1136,10 @@ static int io_mixer_callback(snd_mixer_elem_t *elem, unsigned int mask) {
     if (mask == SND_CTL_EVENT_MASK_REMOVE)
         return 0;
 
-    if (u->source->suspend_cause & PA_SUSPEND_SESSION)
+    if (u->source->suspend_cause & PA_SUSPEND_SESSION) {
+        pa_source_set_mixer_dirty(u->source, TRUE);
         return 0;
+    }
 
     if (mask & SND_CTL_EVENT_MASK_VALUE)
         pa_source_update_volume_and_mute(u->source);
@@ -1359,13 +1364,13 @@ static int source_set_port_cb(pa_source *s, pa_device_port *p) {
     data = PA_DEVICE_PORT_DATA(p);
 
     pa_assert_se(u->mixer_path = data->path);
-    pa_alsa_path_select(u->mixer_path, u->mixer_handle);
-
-    mixer_volume_init(u);
+    pa_alsa_path_select(u->mixer_path, u->mixer_handle, s->muted);
 
     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->flags & PA_SOURCE_DEFERRED_VOLUME) {
@@ -1637,7 +1642,7 @@ static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB) {
         data = PA_DEVICE_PORT_DATA(u->source->active_port);
         u->mixer_path = data->path;
 
-        pa_alsa_path_select(data->path, u->mixer_handle);
+        pa_alsa_path_select(data->path, u->mixer_handle, u->source->muted);
 
         if (data->setting)
             pa_alsa_setting_select(data->setting, u->mixer_handle);
@@ -1650,7 +1655,7 @@ static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB) {
         if (u->mixer_path) {
             /* Hmm, we have only a single path, then let's activate it */
 
-            pa_alsa_path_select(u->mixer_path, u->mixer_handle);
+            pa_alsa_path_select(u->mixer_path, u->mixer_handle, u->source->muted);
 
             if (u->mixer_path->settings)
                 pa_alsa_setting_select(u->mixer_path->settings, u->mixer_handle);
@@ -1947,7 +1952,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
     }
 
     if (u->mixer_path_set)
-        pa_alsa_add_ports(&data.ports, u->mixer_path_set, card);
+        pa_alsa_add_ports(&data, u->mixer_path_set, card);
 
     u->source = pa_source_new(m->core, &data, PA_SOURCE_HARDWARE|PA_SOURCE_LATENCY|(u->use_tsched ? PA_SOURCE_DYNAMIC_LATENCY : 0));
     pa_source_new_data_done(&data);