diff options
author | Max Kellermann <max@duempel.org> | 2008-12-24 03:08:39 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-12-24 03:08:39 +0100 |
commit | 0d9d82a932d7fc022bfc410e206fb8edb6f3db03 (patch) | |
tree | 6499d12b4c1e4a59858859a45214f7f74ef2ea84 /src/decoder_api.c | |
parent | d2d11d70a80bde0b348ccfd59bf1ec82bb997cb7 (diff) | |
download | mpd-0d9d82a932d7fc022bfc410e206fb8edb6f3db03.tar.gz mpd-0d9d82a932d7fc022bfc410e206fb8edb6f3db03.tar.xz mpd-0d9d82a932d7fc022bfc410e206fb8edb6f3db03.zip |
pcm_utils: check pcm_convert()==0
It is illegal to pass an empty audio buffer around. pcm_resample()
sometimes seems to result in 0 samples, maybe related to
libsamplerate. To work around that problem, add special checks after
both pcm_convert() invocations. Removed the pcm_resample()==0 checks
from pcm_convert().
Diffstat (limited to '')
-rw-r--r-- | src/decoder_api.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/decoder_api.c b/src/decoder_api.c index bf389222b..dd7096017 100644 --- a/src/decoder_api.c +++ b/src/decoder_api.c @@ -249,6 +249,13 @@ decoder_data(struct decoder *decoder, length = pcm_convert(&dc.in_audio_format, _data, length, &dc.out_audio_format, data, &decoder->conv_state); + + /* under certain circumstances, pcm_convert() may + return an empty buffer - this condition should be + investigated further, but for now, do this check as + a workaround: */ + if (length == 0) + return DECODE_COMMAND_NONE; } if (replay_gain_info != NULL && (replay_gain_mode != REPLAY_GAIN_OFF)) |