aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-03-07 21:41:23 +0100
committerMax Kellermann <max@duempel.org>2009-03-07 21:41:23 +0100
commit85cc46ad6fc9c7e2edfc274011f5c7a94e5e0b3e (patch)
tree282c3e686e300d70e06c4880261c772713d58ede
parenteb2e3a554d25b2d829bb435c2f2114e935c236a6 (diff)
downloadmpd-85cc46ad6fc9c7e2edfc274011f5c7a94e5e0b3e.tar.gz
mpd-85cc46ad6fc9c7e2edfc274011f5c7a94e5e0b3e.tar.xz
mpd-85cc46ad6fc9c7e2edfc274011f5c7a94e5e0b3e.zip
decoder_internal: don't push empty chunk into pipe
When the decoder chunk is empty in decoder_flush_chunk(), don't push it into the music pipe - return it to the music buffer instead. An empty chunk in the pipe wastes resources for no advantage.
-rw-r--r--src/decoder_internal.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/decoder_internal.c b/src/decoder_internal.c
index 120115ed2..98a000dd7 100644
--- a/src/decoder_internal.c
+++ b/src/decoder_internal.c
@@ -22,6 +22,7 @@
#include "pipe.h"
#include "input_stream.h"
#include "buffer.h"
+#include "chunk.h"
#include <assert.h>
@@ -73,6 +74,10 @@ decoder_flush_chunk(struct decoder *decoder)
assert(decoder != NULL);
assert(decoder->chunk != NULL);
- music_pipe_push(dc.pipe, decoder->chunk);
+ if (music_chunk_is_empty(decoder->chunk))
+ music_buffer_return(dc.buffer, decoder->chunk);
+ else
+ music_pipe_push(dc.pipe, decoder->chunk);
+
decoder->chunk = NULL;
}