From 7c952c4f4bb4272cd4082f85960eb65976286aa4 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 15 Apr 2008 05:57:22 +0000 Subject: added ob_set_lazy() In lazy mode (previously the default), outputBuffer.c only wakes up the player when it was previously empty. That caused a deadlock when the player was waiting for buffered_before_play, since the decoder wouldn't wake up the player when buffered_before_play was reached. In non-lazy mode, always wake up the player when a new chunk was decoded. git-svn-id: https://svn.musicpd.org/mpd/trunk@7364 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/decode.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/decode.c') diff --git a/src/decode.c b/src/decode.c index c188cd286..297f6110d 100644 --- a/src/decode.c +++ b/src/decode.c @@ -400,6 +400,8 @@ static void decodeParent(void) /** the position of the first chunk in the next song */ int next = -1; + ob_set_lazy(0); + if (waitOnDecode(&decodeWaitedOn) < 0) return; @@ -421,9 +423,11 @@ static void decodeParent(void) /* not enough decoded buffer space yet */ player_sleep(); continue; - } else + } else { /* buffering is complete */ buffering = 0; + ob_set_lazy(1); + } } if (decodeWaitedOn) { @@ -513,6 +517,7 @@ static void decodeParent(void) } nextChunk = ob_absolute(crossFadeChunks); if (nextChunk >= 0) { + ob_set_lazy(1); crossFade(beginChunk, ob_get_chunk(nextChunk), &(ob.audioFormat), @@ -529,6 +534,7 @@ static void decodeParent(void) } else { /* wait for the decoder */ + ob_set_lazy(0); player_sleep(); continue; } -- cgit v1.2.3