OutputControl: reduce the number of OutputThread wakeups

Wake up the OutputThread only if it hasn't already been woken up and
if it isn't already in the playback loop.
This commit is contained in:
Max Kellermann
2013-11-06 23:47:30 +01:00
parent 77c63511d8
commit f8f95e2dbd
4 changed files with 30 additions and 2 deletions

View File

@@ -248,8 +248,11 @@ audio_output_play(struct audio_output *ao)
assert(ao->allow_play);
if (audio_output_is_open(ao))
if (audio_output_is_open(ao) && !ao->in_playback_loop &&
!ao->woken_for_play) {
ao->woken_for_play = true;
ao->cond.signal();
}
}
void audio_output_pause(struct audio_output *ao)