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/outputBuffer.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/outputBuffer.c') diff --git a/src/outputBuffer.c b/src/outputBuffer.c index 6732d0e7a..b0cfc00df 100644 --- a/src/outputBuffer.c +++ b/src/outputBuffer.c @@ -31,6 +31,7 @@ void ob_init(unsigned int size) ob.size = size; ob.begin = 0; ob.end = 0; + ob.lazy = 0; ob.chunks[0].chunkSize = 0; } @@ -61,7 +62,7 @@ static inline unsigned successor(unsigned i) */ static void output_buffer_expand(unsigned i) { - int was_empty = ob_is_empty(); + int was_empty = !ob.lazy || ob_is_empty(); assert(i == (ob.end + 1) % ob.size); assert(i != ob.end); @@ -91,6 +92,11 @@ void ob_flush(void) } } +void ob_set_lazy(int lazy) +{ + ob.lazy = lazy; +} + int ob_is_empty(void) { return ob.begin == ob.end; -- cgit v1.2.3