swr: fix assertion failure if dither is used without the preout buffer differing from in

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-01-08 16:55:46 +01:00
parent 252316c885
commit 9aec63af9b
1 changed files with 5 additions and 0 deletions

View File

@ -602,6 +602,11 @@ static int swr_convert_internal(struct SwrContext *s, AudioData *out, int out_co
if(s->resample_first ? !s->rematrix : !s->resample) if(s->resample_first ? !s->rematrix : !s->resample)
preout= midbuf; preout= midbuf;
if (preout == in && s->dither_method) {
av_assert1(postin == midbuf && midbuf == preout);
postin = midbuf = preout = &preout_tmp;
}
if(s->int_sample_fmt == s->out_sample_fmt && s->out.planar){ if(s->int_sample_fmt == s->out_sample_fmt && s->out.planar){
if(preout==in){ if(preout==in){
out_count= FFMIN(out_count, in_count); //TODO check at the end if this is needed or redundant out_count= FFMIN(out_count, in_count); //TODO check at the end if this is needed or redundant