summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-02-02 00:27:47 +0100
committerLennart Poettering <lennart@poettering.net>2009-02-02 00:27:47 +0100
commit8fbce6eb895ebb0c793d79a617ef54df645a11db (patch)
tree1eb08bbf27e4f5720d863fbb8933c367d25e8be4 /src
parent55e6331bed63a304fe465e737c0ea1a57da91e8c (diff)
when determining the minimum volume of all sink inputs make sure to handle the case when there are no sink inputs correctly
Diffstat (limited to 'src')
-rw-r--r--src/pulsecore/sink.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 61be86a1..84f37485 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -926,12 +926,24 @@ void pa_sink_update_flat_volume(pa_sink *s, pa_cvolume *new_volume) {
pa_sink_input *i;
uint32_t idx;
+ pa_sink_assert_ref(s);
+ pa_assert(new_volume);
+ pa_assert(PA_SINK_IS_LINKED(s->state));
+ pa_assert(s->flags & PA_SINK_FLAT_VOLUME);
+
/* This is called whenever a sink input volume changes and we
* might need to fix up the sink volume accordingly. Please note
* that we don't actually update the sinks volume here, we only
* return how it needs to be updated. The caller should then call
* pa_sink_set_flat_volume().*/
+ if (pa_idxset_isempty(s->inputs)) {
+ /* In the special case that we have no sink input we leave the
+ * volume unmodified. */
+ *new_volume = s->virtual_volume;
+ return;
+ }
+
pa_cvolume_mute(new_volume, s->channel_map.channels);
/* First let's determine the new maximum volume of all inputs
@@ -1133,6 +1145,7 @@ pa_bool_t pa_sink_get_mute(pa_sink *s, pa_bool_t force_refresh) {
pa_bool_t pa_sink_update_proplist(pa_sink *s, pa_update_mode_t mode, pa_proplist *p) {
pa_sink_assert_ref(s);
+ pa_assert(p);
pa_proplist_update(s->proplist, mode, p);