[pulseaudio-discuss] [PATCH] sink & source: Join two ifs with the same condition.

Tanu Kaskinen tanuk at iki.fi
Thu Oct 6 13:10:25 PDT 2011


---
 src/pulsecore/sink.c   |    9 +++------
 src/pulsecore/source.c |    7 ++-----
 2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 53cab32..ee89396 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -1855,13 +1855,7 @@ void pa_sink_set_volume(
         }
 
         pa_cvolume_remap(&new_reference_volume, &s->channel_map, &root_sink->channel_map);
-    }
-
-    /* If volume is NULL we synchronize the sink's real and reference
-     * volumes with the stream volumes. If it is not NULL we update
-     * the reference_volume with it. */
 
-    if (volume) {
         if (update_reference_volume(root_sink, &new_reference_volume, &root_sink->channel_map, save)) {
             if (pa_sink_flat_volume_enabled(root_sink)) {
                 /* OK, propagate this volume change back to the inputs */
@@ -1874,6 +1868,9 @@ void pa_sink_set_volume(
         }
 
     } else {
+        /* If volume is NULL we synchronize the sink's real and
+         * reference volumes with the stream volumes. */
+
         pa_assert(pa_sink_flat_volume_enabled(root_sink));
 
         /* Ok, let's determine the new real volume */
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index d47280c..d853f8b 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -1431,13 +1431,10 @@ void pa_source_set_volume(
         }
 
         pa_cvolume_remap(&new_reference_volume, &s->channel_map, &root_source->channel_map);
-    }
 
-    /* If volume is NULL we synchronize the source's real and reference
-     * volumes with the stream volumes. If it is not NULL we update
-     * the reference_volume with it. */
+        /* If volume is NULL we synchronize the source's real and
+         * reference volumes with the stream volumes. */
 
-    if (volume) {
         if (update_reference_volume(root_source, &new_reference_volume, &root_source->channel_map, save)) {
             if (pa_source_flat_volume_enabled(root_source)) {
                 /* OK, propagate this volume change back to the outputs */
-- 
1.7.6.3



More information about the pulseaudio-discuss mailing list