aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/pcm_decoder_plugin.c
diff options
context:
space:
mode:
authorSimon Kagstrom <simon.kagstrom@gmail.com>2011-03-20 17:26:28 +0100
committerMax Kellermann <max@duempel.org>2011-03-23 22:13:08 +0100
commit0b12fae84da92498db612d3fabf57edfad65fa9d (patch)
treec4b02c7cf8d1861417cb597aa05716cd27cd6bcf /src/decoder/pcm_decoder_plugin.c
parentd9353c4fd32a9645e9f9a5463f42a0fd44f0a70c (diff)
downloadmpd-0b12fae84da92498db612d3fabf57edfad65fa9d.tar.gz
mpd-0b12fae84da92498db612d3fabf57edfad65fa9d.tar.xz
mpd-0b12fae84da92498db612d3fabf57edfad65fa9d.zip
decoder: PCM decoder: Break loop if EOF is encountered
Otherwise the song playing might go on forever.
Diffstat (limited to 'src/decoder/pcm_decoder_plugin.c')
-rw-r--r--src/decoder/pcm_decoder_plugin.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/decoder/pcm_decoder_plugin.c b/src/decoder/pcm_decoder_plugin.c
index 882d59a36..1da21c209 100644
--- a/src/decoder/pcm_decoder_plugin.c
+++ b/src/decoder/pcm_decoder_plugin.c
@@ -51,6 +51,10 @@ pcm_stream_decode(struct decoder *decoder, struct input_stream *is)
size_t nbytes = decoder_read(decoder, is,
buffer, sizeof(buffer));
+
+ if (nbytes == 0 && input_stream_eof(is))
+ break;
+
cmd = nbytes > 0
? decoder_data(decoder, is,
buffer, nbytes, 0)