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
This commit is contained in:
Max Kellermann 2008-04-12 04:21:18 +00:00 committed by Eric Wong
parent f0e78138d1
commit bc7e60cbcd

View File

@ -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);