]> code.delx.au - pulseaudio/commitdiff
alsa-sink/source: Really set volumes on port change
authorDavid Henningsson <david.henningsson@canonical.com>
Tue, 3 Apr 2012 19:35:07 +0000 (21:35 +0200)
committerDavid Henningsson <david.henningsson@canonical.com>
Wed, 4 Apr 2012 12:36:43 +0000 (14:36 +0200)
If deferred volumes were activated, set_volume does not really set
the volume, and is probably only meant to be called from the main
thread.
As we're currently really setting the port and the mute here (i e
modifying ALSA), we should really modify the volume as well.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
src/modules/alsa/alsa-sink.c
src/modules/alsa/alsa-source.c

index ea5188c9e3c1f9f851e65b7d13b3b767f3a387dc..65f12c21b968f90263d39743a8900a04987260fa 100644 (file)
@@ -1465,8 +1465,13 @@ static int sink_set_port_cb(pa_sink *s, pa_device_port *p) {
 
     if (s->set_mute)
         s->set_mute(s);
-    if (s->set_volume)
-        s->set_volume(s);
+    if (s->flags & PA_SINK_DEFERRED_VOLUME) {
+        if (s->write_volume)
+            s->write_volume(s);
+    } else {
+        if (s->set_volume)
+            s->set_volume(s);
+    }
 
     return 0;
 }
index 2680302c498109f3526a821174242534d86cd5a0..ab7335d8d137d6dd5c47e7f6f2d82aa44951a525 100644 (file)
@@ -1368,8 +1368,13 @@ static int source_set_port_cb(pa_source *s, pa_device_port *p) {
 
     if (s->set_mute)
         s->set_mute(s);
-    if (s->set_volume)
-        s->set_volume(s);
+    if (s->flags & PA_SOURCE_DEFERRED_VOLUME) {
+        if (s->write_volume)
+            s->write_volume(s);
+    } else {
+        if (s->set_volume)
+            s->set_volume(s);
+    }
 
     return 0;
 }