Commit 362ca300 authored by Max Kellermann's avatar Max Kellermann

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.
parent 33b50154
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment