diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-11-18 16:35:11 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-11-18 16:35:15 +0400 |
commit | 0c79a3d9cb0c7a7acef30b7c01e9337ba91a4a81 (patch) | |
tree | 44cedc0449c8fd89f6915a2c26df52d59787c335 /libavresample/utils.c | |
parent | d0a503c97cc59b17e77585a726448dfa46245f4d (diff) | |
parent | 7a9e65aceee678ee2677480579cb3b2208474140 (diff) |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
x86: lavr: fix stack allocation for 7 and 8 channel downmixing on x86-32
lavr: fix the decision for writing directly to the output buffer
parisc: work around bug in gcc 4.3 and later
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavresample/utils.c')
-rw-r--r-- | libavresample/utils.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libavresample/utils.c b/libavresample/utils.c index 2a0aacd4c0..ad49e880af 100644 --- a/libavresample/utils.c +++ b/libavresample/utils.c @@ -254,7 +254,7 @@ int attribute_align_arg avresample_convert(AVAudioResampleContext *avr, AudioData input_buffer; AudioData output_buffer; AudioData *current_buffer; - int ret; + int ret, direct_output; /* reset internal buffers */ if (avr->in_buffer) { @@ -276,6 +276,7 @@ int attribute_align_arg avresample_convert(AVAudioResampleContext *avr, av_dlog(avr, "[start conversion]\n"); /* initialize output_buffer with output data */ + direct_output = output && av_audio_fifo_size(avr->out_fifo) == 0; if (output) { ret = ff_audio_data_init(&output_buffer, output, out_plane_size, avr->out_channels, out_samples, @@ -295,7 +296,7 @@ int attribute_align_arg avresample_convert(AVAudioResampleContext *avr, current_buffer = &input_buffer; if (avr->upmix_needed && !avr->in_convert_needed && !avr->resample_needed && - !avr->out_convert_needed && output && out_samples >= in_samples) { + !avr->out_convert_needed && direct_output && out_samples >= in_samples) { /* in some rare cases we can copy input to output and upmix directly in the output buffer */ av_dlog(avr, "[copy] %s to output\n", current_buffer->name); @@ -343,7 +344,7 @@ int attribute_align_arg avresample_convert(AVAudioResampleContext *avr, AudioData *resample_out; int consumed = 0; - if (!avr->out_convert_needed && output && out_samples > 0) + if (!avr->out_convert_needed && direct_output && out_samples > 0) resample_out = &output_buffer; else resample_out = avr->resample_out_buffer; @@ -377,7 +378,7 @@ int attribute_align_arg avresample_convert(AVAudioResampleContext *avr, } if (avr->out_convert_needed) { - if (output && out_samples >= current_buffer->nb_samples) { + if (direct_output && out_samples >= current_buffer->nb_samples) { /* convert directly to output */ av_dlog(avr, "[convert] %s to output\n", current_buffer->name); ret = ff_audio_convert(avr->ac_out, &output_buffer, current_buffer, |