[pulseaudio-discuss] [PATCH] sink-input: Don't assert while trying to get non-readable volume

Arun Raghavan arun.raghavan at collabora.co.uk
Sun Apr 10 04:22:32 PDT 2011


Since no clients currently handle non-readable volumes, we handle this
condition more gracefully (return PA_VOLUME_NORM). In the future, this
could probably changed into an error return instead of an assert so that
a non-conformant client doesn't bring the daemon down.
---
 src/pulsecore/sink-input.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index ff562eb..323d4e7 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -1219,9 +1219,10 @@ pa_cvolume *pa_sink_input_get_volume(pa_sink_input *i, pa_cvolume *volume, pa_bo
     pa_sink_input_assert_ref(i);
     pa_assert_ctl_context();
     pa_assert(PA_SINK_INPUT_IS_LINKED(i->state));
-    pa_assert(pa_sink_input_is_volume_readable(i));
 
-    if (absolute || !pa_sink_flat_volume_enabled(i->sink))
+    if (!pa_sink_input_is_volume_readable(i))
+        pa_cvolume_reset (volume, i->sample_spec.channels);
+    else if (absolute || !pa_sink_flat_volume_enabled(i->sink))
         *volume = i->volume;
     else
         *volume = i->reference_ratio;
-- 
1.7.4.1




More information about the pulseaudio-discuss mailing list