Initialise write_volume

The callback should also be reset in reset_calbacks().
The extra check in _volume_change_apply() is needed because when the sink is unlinked the callbacks are reset,
but there still may be pending volume changes.
This commit is contained in:
Maarten Bosmans 2011-08-15 20:19:40 +02:00 committed by Colin Guthrie
parent 0ef7e5cb4c
commit 9256d9b7be
2 changed files with 16 additions and 0 deletions

View file

@ -174,6 +174,7 @@ static void reset_callbacks(pa_sink *s) {
s->set_state = NULL;
s->get_volume = NULL;
s->set_volume = NULL;
s->write_volume = NULL;
s->get_mute = NULL;
s->set_mute = NULL;
s->request_rewind = NULL;
@ -3350,6 +3351,13 @@ pa_bool_t pa_sink_volume_change_apply(pa_sink *s, pa_usec_t *usec_to_next) {
pa_bool_t ret = FALSE;
pa_assert(s);
if (!PA_SINK_IS_LINKED(s->state)) {
if (usec_to_next)
*usec_to_next = 0;
return ret;
}
pa_assert(s->write_volume);
while (s->thread_info.volume_changes && now >= s->thread_info.volume_changes->at) {