[FFmpeg-cvslog] fix swr_convert buffering of packed audio
Andrew Wason
git at videolan.org
Sat Apr 21 02:22:05 CEST 2012
ffmpeg | branch: master | Andrew Wason <rectalogic at rectalogic.com> | Fri Apr 20 17:06:25 2012 -0400| [e9b1d5ae5e41b854a9d8d212e9e197a193ff1fa9] | committer: Michael Niedermayer
fix swr_convert buffering of packed audio
swr_convert is not properly buffering packed input audio when the
output is not large enough, and when resampling is not actually needed
(same samplerate and no SWR_FLAG_RESAMPLE).
buf_set() is only handling the first channel and leaving the others as-is.
Sample program to reproduce the problem is here https://gist.github.com/2431768
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e9b1d5ae5e41b854a9d8d212e9e197a193ff1fa9
---
libswresample/swresample.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index 823dbda..ad2c107 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -360,12 +360,14 @@ static void fill_audiodata(AudioData *out, uint8_t *in_arg [SWR_CH_MAX]){
* out may be equal in.
*/
static void buf_set(AudioData *out, AudioData *in, int count){
+ int ch;
if(in->planar){
- int ch;
for(ch=0; ch<out->ch_count; ch++)
out->ch[ch]= in->ch[ch] + count*out->bps;
- }else
- out->ch[0]= in->ch[0] + count*out->ch_count*out->bps;
+ }else{
+ for(ch=0; ch<out->ch_count; ch++)
+ out->ch[ch]= in->ch[0] + (ch + count*out->ch_count) * out->bps;
+ }
}
/**
More information about the ffmpeg-cvslog
mailing list