Commit bc7e60cb authored by Max Kellermann's avatar Max Kellermann Committed by Eric Wong

check cb->stop in the while loop

Checking dc->stop in the while condition and again after the while loop costs some CPU cycles we should save. git-svn-id: https://svn.musicpd.org/mpd/trunk@7340 09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent f0e78138
......@@ -161,10 +161,13 @@ static int tailChunk(OutputBuffer * cb, InputStream * inStream,
if (chunk->chunkSize == sizeof(chunk->data)) {
/* this chunk is full; allocate a new chunk */
next = successor(cb, cb->end);
while (cb->begin == next && !dc->stop) {
while (cb->begin == next) {
/* all chunks are full of decoded data; wait
for the player to free one */
if (dc->stop)
return OUTPUT_BUFFER_DC_STOP;
if (dc->seek) {
if (seekable) {
return OUTPUT_BUFFER_DC_SEEK;
......@@ -180,9 +183,6 @@ static int tailChunk(OutputBuffer * cb, InputStream * inStream,
}
}
if (dc->stop)
return OUTPUT_BUFFER_DC_STOP;
output_buffer_expand(cb, next);
chunk = outputBufferGetChunk(cb, next);
assert(chunk->chunkSize == 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