[pulseaudio-discuss] [PATCH 08/11] devices: Send a SYNC volumes message on port change to ensure volumes are propigated to the underlying device.

Colin Guthrie colin at mageia.org
Mon Jul 18 03:36:51 PDT 2011


Also add some additional debug for volume changes.
---
 src/pulsecore/sink.c   |    9 ++++++++-
 src/pulsecore/source.c |    9 ++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 2d27e4a..7ef1975 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -3073,6 +3073,7 @@ int pa_sink_set_port(pa_sink *s, const char *name, pa_bool_t save) {
     s->active_port = port;
     s->save_port = save;
 
+    pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SINK_MESSAGE_SET_VOLUME_SYNCED, NULL, 0, NULL) == 0);
     pa_hook_fire(&s->core->hooks[PA_CORE_HOOK_SINK_PORT_CHANGED], s);
 
     return 0;
@@ -3277,7 +3278,13 @@ void pa_sink_volume_change_push(pa_sink *s) {
     pa_sw_cvolume_divide(&nc->hw_volume, &s->real_volume, &s->soft_volume);
 
     if (!s->thread_info.volume_changes && pa_cvolume_equal(&nc->hw_volume, &s->thread_info.current_hw_volume)) {
-        pa_log_debug("Volume not changing");
+        char pcnt[PA_CVOLUME_SNPRINT_MAX];
+        char db[PA_SW_CVOLUME_SNPRINT_DB_MAX];
+
+        pa_log_debug("Volume not changing: %s (%s dB)",
+            pa_cvolume_snprint(pcnt, sizeof(pcnt), &nc->hw_volume),
+            pa_sw_cvolume_snprint_dB(db, sizeof(db), &nc->hw_volume));
+
         pa_sink_volume_change_free(nc);
         return;
     }
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index c4e1e5d..aa43df3 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -2418,6 +2418,7 @@ int pa_source_set_port(pa_source *s, const char *name, pa_bool_t save) {
     s->active_port = port;
     s->save_port = save;
 
+    pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SOURCE_MESSAGE_SET_VOLUME_SYNCED, NULL, 0, NULL) == 0);
     pa_hook_fire(&s->core->hooks[PA_CORE_HOOK_SOURCE_PORT_CHANGED], s);
 
     return 0;
@@ -2461,7 +2462,13 @@ void pa_source_volume_change_push(pa_source *s) {
     pa_sw_cvolume_divide(&nc->hw_volume, &s->real_volume, &s->soft_volume);
 
     if (!s->thread_info.volume_changes && pa_cvolume_equal(&nc->hw_volume, &s->thread_info.current_hw_volume)) {
-        pa_log_debug("Volume not changing");
+        char pcnt[PA_CVOLUME_SNPRINT_MAX];
+        char db[PA_SW_CVOLUME_SNPRINT_DB_MAX];
+
+        pa_log_debug("Volume not changing: %s (%s dB)",
+            pa_cvolume_snprint(pcnt, sizeof(pcnt), &nc->hw_volume),
+            pa_sw_cvolume_snprint_dB(db, sizeof(db), &nc->hw_volume));
+
         pa_source_volume_change_free(nc);
         return;
     }
-- 
1.7.6



More information about the pulseaudio-discuss mailing list