[PATCH 2/2] alsa-{sink, source}: Guard for uninitialised volume_sleep

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Due to the previous commit, pa_{sink,source}_volume_change_apply()
does not guarantee setting its usec_to_next argument,
which is why this patch is needed.
---
 src/modules/alsa/alsa-sink.c   |    3 +--
 src/modules/alsa/alsa-source.c |    5 ++---
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 44331a3..aac3351 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -1682,8 +1682,7 @@ static void thread_func(void *userdata) {
 
         if (u->sink->flags & PA_SINK_SYNC_VOLUME) {
             pa_usec_t volume_sleep;
-            pa_sink_volume_change_apply(u->sink, &volume_sleep);
-            if (volume_sleep > 0)
+            if (pa_sink_volume_change_apply(u->sink, &volume_sleep) && volume_sleep > 0)
                 rtpoll_sleep = PA_MIN(volume_sleep, rtpoll_sleep);
         }
 
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index 1dd63f0..50d625c 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -37,7 +37,7 @@
 #include <pulsecore/i18n.h>
 #include <pulsecore/module.h>
 #include <pulsecore/memchunk.h>
-#include <pulsecore/sink.h>
+#include <pulsecore/source.h>
 #include <pulsecore/modargs.h>
 #include <pulsecore/core-rtclock.h>
 #include <pulsecore/core-util.h>
@@ -1407,8 +1407,7 @@ static void thread_func(void *userdata) {
 
         if (u->source->flags & PA_SOURCE_SYNC_VOLUME) {
             pa_usec_t volume_sleep;
-            pa_source_volume_change_apply(u->source, &volume_sleep);
-            if (volume_sleep > 0)
+            if (pa_source_volume_change_apply(u->source, &volume_sleep) && volume_sleep > 0)
                 rtpoll_sleep = PA_MIN(volume_sleep, rtpoll_sleep);
         }
 
-- 
1.7.4.1



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux