when determining the minimum volume of all sink inputs make sure to handle the case when there are no sink inputs correctly

This commit is contained in:
Lennart Poettering 2009-02-02 00:27:47 +01:00
parent 55e6331bed
commit 8fbce6eb89

View file

@ -926,12 +926,24 @@ void pa_sink_update_flat_volume(pa_sink *s, pa_cvolume *new_volume) {
pa_sink_input *i; pa_sink_input *i;
uint32_t idx; 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 /* This is called whenever a sink input volume changes and we
* might need to fix up the sink volume accordingly. Please note * might need to fix up the sink volume accordingly. Please note
* that we don't actually update the sinks volume here, we only * that we don't actually update the sinks volume here, we only
* return how it needs to be updated. The caller should then call * return how it needs to be updated. The caller should then call
* pa_sink_set_flat_volume().*/ * 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); pa_cvolume_mute(new_volume, s->channel_map.channels);
/* First let's determine the new maximum volume of all inputs /* 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_bool_t pa_sink_update_proplist(pa_sink *s, pa_update_mode_t mode, pa_proplist *p) {
pa_sink_assert_ref(s); pa_sink_assert_ref(s);
pa_assert(p);
pa_proplist_update(s->proplist, mode, p); pa_proplist_update(s->proplist, mode, p);