Commit 7dc1f311 authored by Max Kellermann's avatar Max Kellermann Committed by Eric Wong

wake up player on demand

The decoder should not wake up the player when it did not produce a flushed chunk. Move the decoder_wakeup_player() call to flushOutputBuffer() and invoke it only if the buffer was previously empty. git-svn-id: https://svn.musicpd.org/mpd/trunk@7336 09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent 91b43b48
......@@ -55,8 +55,17 @@ static inline unsigned successor(const OutputBuffer * cb, unsigned i)
void flushOutputBuffer(OutputBuffer * cb)
{
if (cb->currentChunk == (int)cb->end) {
int was_empty = outputBufferEmpty(cb);
cb->end = successor(cb, cb->end);
cb->currentChunk = -1;
if (was_empty)
/* if the buffer was empty, the player thread
might be waiting for us; wake it up now
that another decoded buffer has become
available. */
decoder_wakeup_player();
}
}
......@@ -214,7 +223,6 @@ int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream,
flushOutputBuffer(cb);
}
}
decoder_wakeup_player();
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment