diff options
author | Max Kellermann <max@duempel.org> | 2008-11-18 22:45:51 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-11-18 22:45:51 +0100 |
commit | 362ca300d6daec137d0a5a2b639f0f74f2929221 (patch) | |
tree | 8853a0d843b40aba885dbb29dae2f4dc14297323 | |
parent | 33b5015469e13f5dbd8c4005eda5c93f67ade093 (diff) | |
download | mpd-362ca300d6daec137d0a5a2b639f0f74f2929221.tar.gz mpd-362ca300d6daec137d0a5a2b639f0f74f2929221.tar.xz mpd-362ca300d6daec137d0a5a2b639f0f74f2929221.zip |
decoder: pass the correct buffer length to pcm_convert()
When a global audio format is configured (setting
"audio_output_format"), decoder_data() overwrote the "length"
parameter with the size of the output buffer (result of
pcm_convert_size()). Declare a separate variable for the output
buffer length.
-rw-r--r-- | src/decoder_api.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/decoder_api.c b/src/decoder_api.c index 0aca4da95..7df94e02f 100644 --- a/src/decoder_api.c +++ b/src/decoder_api.c @@ -232,13 +232,14 @@ decoder_data(struct decoder *decoder, if (audio_format_equals(&dc.in_audio_format, &dc.out_audio_format)) { data = _data; } else { - length = pcm_convert_size(&dc.in_audio_format, length, - &dc.out_audio_format); - if (length > conv_buffer_size) { + size_t out_length = + pcm_convert_size(&dc.in_audio_format, length, + &dc.out_audio_format); + if (out_length > conv_buffer_size) { if (conv_buffer != NULL) free(conv_buffer); - conv_buffer = xmalloc(length); - conv_buffer_size = length; + conv_buffer = xmalloc(out_length); + conv_buffer_size = out_length; } data = conv_buffer; |