diff options
author | Eric Wong <normalperson@yhbt.net> | 2005-03-13 22:58:04 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2005-03-13 22:58:04 +0000 |
commit | 5bddf6eefcc9c1d0245d8e86cd77ed6dddb5d406 (patch) | |
tree | cec3d30e9c2f6994c3d460e6e904e280bc4f3e01 | |
parent | 92f1bb82f7d9b7df73f4f3e09abc97d5fe8e229c (diff) | |
download | mpd-5bddf6eefcc9c1d0245d8e86cd77ed6dddb5d406.tar.gz mpd-5bddf6eefcc9c1d0245d8e86cd77ed6dddb5d406.tar.xz mpd-5bddf6eefcc9c1d0245d8e86cd77ed6dddb5d406.zip |
fix FLAC playback over non-ideal HTTP streams
git-svn-id: https://svn.musicpd.org/mpd/trunk@3076 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r-- | src/inputPlugins/flac_plugin.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/inputPlugins/flac_plugin.c b/src/inputPlugins/flac_plugin.c index 9c20a996d..801b72797 100644 --- a/src/inputPlugins/flac_plugin.c +++ b/src/inputPlugins/flac_plugin.c @@ -196,10 +196,20 @@ FLAC__SeekableStreamDecoderReadStatus flacRead( const FLAC__SeekableStreamDecoder * flacDec, FLAC__byte buf[], unsigned * bytes, void * fdata) { FlacData * data = (FlacData *) fdata; - - *bytes = readFromInputStream(data->inStream,(void *)buf,1,*bytes); - - if(*bytes==0) return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR; + size_t r; + + while (1) { + r = readFromInputStream(data->inStream,(void *)buf,1,*bytes); + if (r == 0 && !inputStreamAtEOF(data->inStream) && + !data->dc->stop) + my_usleep(10000); + else + break; + } + *bytes = r; + + if (*bytes==0 && !inputStreamAtEOF(data->inStream) && !data->dc->stop) + return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR; return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK; } |