Commit 97599f8c authored by Michael Niedermayer's avatar 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: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 5dc73634
...@@ -179,6 +179,7 @@ int swri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, int len ...@@ -179,6 +179,7 @@ int swri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, int len
off = len&~15; off = len&~15;
av_assert1(off>=0); av_assert1(off>=0);
av_assert1(off<=len); av_assert1(off<=len);
av_assert2(ctx->channels == SWR_CH_MAX || !in->ch[ctx->channels]);
if(off>0){ if(off>0){
if(out->planar == in->planar){ if(out->planar == in->planar){
int planes = out->planar ? out->ch_count : 1; int planes = out->planar ? out->ch_count : 1;
......
...@@ -214,6 +214,8 @@ av_cold int swr_init(struct SwrContext *s){ ...@@ -214,6 +214,8 @@ av_cold int swr_init(struct SwrContext *s){
free_temp(&s->preout); free_temp(&s->preout);
free_temp(&s->in_buffer); free_temp(&s->in_buffer);
free_temp(&s->dither); 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-> in_convert);
swri_audio_convert_free(&s->out_convert); swri_audio_convert_free(&s->out_convert);
swri_audio_convert_free(&s->full_convert); swri_audio_convert_free(&s->full_convert);
......
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