[FFmpeg-cvslog] swr: make sure the last data element is NULL so we can use it to detect the number of channels

Michael Niedermayer git at videolan.org
Mon Sep 24 23:25:07 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Sep 24 22:52:36 2012 +0200| [97599f8c6d078868be30c18516899325d3c053c2] | committer: Michael Niedermayer

swr: make sure the last data element is NULL so we can use it to detect the number of channels

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=97599f8c6d078868be30c18516899325d3c053c2
---

 libswresample/audioconvert.c |    1 +
 libswresample/swresample.c   |    2 ++
 2 files changed, 3 insertions(+)

diff --git a/libswresample/audioconvert.c b/libswresample/audioconvert.c
index 2e5bd72..d2e3722 100644
--- a/libswresample/audioconvert.c
+++ b/libswresample/audioconvert.c
@@ -179,6 +179,7 @@ int swri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, int len
         off = len&~15;
         av_assert1(off>=0);
         av_assert1(off<=len);
+        av_assert2(ctx->channels == SWR_CH_MAX || !in->ch[ctx->channels]);
         if(off>0){
             if(out->planar == in->planar){
                 int planes = out->planar ? out->ch_count : 1;
diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index fdd5aae..5d02aaf 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -214,6 +214,8 @@ av_cold int swr_init(struct SwrContext *s){
     free_temp(&s->preout);
     free_temp(&s->in_buffer);
     free_temp(&s->dither);
+    memset(s->in.ch, 0, sizeof(s->in.ch));
+    memset(s->out.ch, 0, sizeof(s->out.ch));
     swri_audio_convert_free(&s-> in_convert);
     swri_audio_convert_free(&s->out_convert);
     swri_audio_convert_free(&s->full_convert);



More information about the ffmpeg-cvslog mailing list