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
This commit is contained in:
parent
91b43b481d
commit
7dc1f3117c
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user