aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-04-12 04:21:18 +0000
committerEric Wong <normalperson@yhbt.net>2008-04-12 04:21:18 +0000
commitbc7e60cbcd1c7eb9f0dc315b3122498d7aa1ab75 (patch)
treed43979a5ffd6af3323d9fe284f15499ba4a039de
parentf0e78138d1f60581cc09ec50a73e8c9dc6cd4241 (diff)
downloadmpd-bc7e60cbcd1c7eb9f0dc315b3122498d7aa1ab75.tar.gz
mpd-bc7e60cbcd1c7eb9f0dc315b3122498d7aa1ab75.tar.xz
mpd-bc7e60cbcd1c7eb9f0dc315b3122498d7aa1ab75.zip
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
Diffstat (limited to '')
-rw-r--r--src/outputBuffer.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/outputBuffer.c b/src/outputBuffer.c
index d8c4e816a..9d77caf3a 100644
--- a/src/outputBuffer.c
+++ b/src/outputBuffer.c
@@ -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);