diff mbox

[FFmpeg-devel] swresample/swresample: Fix input channel count in resample_first computation

Message ID 20180725011520.17371-1-michael@niedermayer.cc
State Accepted
Commit bce4da85e8110b66040a5fb07ffc724ab4e09a86
Headers show

Commit Message

Michael Niedermayer July 25, 2018, 1:15 a.m. UTC
Found-by: Marcin Gorzel <gorzel@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libswresample/swresample.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marcin Gorzel July 25, 2018, 2:32 a.m. UTC | #1
Looks good, thanks Michael!

On Tue, Jul 24, 2018 at 6:15 PM Michael Niedermayer <michael@niedermayer.cc>
wrote:

> Found-by: Marcin Gorzel <gorzel@google.com>
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libswresample/swresample.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libswresample/swresample.c b/libswresample/swresample.c
> index 5bd39caac4..6d28e6a798 100644
> --- a/libswresample/swresample.c
> +++ b/libswresample/swresample.c
> @@ -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;
> --
> 2.18.0
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
Michael Niedermayer July 25, 2018, 10:04 p.m. UTC | #2
On Tue, Jul 24, 2018 at 07:32:52PM -0700, Marcin Gorzel wrote:
> Looks good, thanks Michael!

will apply
thx

[...]
diff mbox

Patch

diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index 5bd39caac4..6d28e6a798 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -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;