swresample/swresample: Fix input channel count in resample_first computation
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 24 Jul 2018 20:44:12 +0000 (22:44 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 26 Jul 2018 00:42:42 +0000 (02:42 +0200)
Found-by: Marcin Gorzel <gorzel@google.com>
Reviewed-by: Marcin Gorzel <gorzel@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libswresample/swresample.c

index 5bd39ca..6d28e6a 100644 (file)
@@ -318,7 +318,7 @@ av_cold int swr_init(struct SwrContext *s){
 
 av_assert0(s->used_ch_count);
 av_assert0(s->out.ch_count);
-    s->resample_first= RSC*s->out.ch_count/s->in.ch_count - RSC < s->out_sample_rate/(float)s-> in_sample_rate - 1.0;
+    s->resample_first= RSC*s->out.ch_count/s->used_ch_count - RSC < s->out_sample_rate/(float)s-> in_sample_rate - 1.0;
 
     s->in_buffer= s->in;
     s->silence  = s->in;