diff mbox series

[FFmpeg-devel] swresample/swresample: fix assert failure

Message ID tencent_6C9C6A1E01B16B167EC6AC1E3859C11DB70A@qq.com
State New
Headers show
Series [FFmpeg-devel] swresample/swresample: fix assert failure | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Zhao Zhili Sept. 9, 2022, 6:20 p.m. UTC
From: Zhao Zhili <zhilizhao@tencent.com>

Fix #9908. Regression since 8a5896ec1f6.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
---
 libswresample/swresample.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

James Almer Sept. 9, 2022, 11:58 a.m. UTC | #1
I sent an alternative approach last night.

On 9/9/2022 3:20 PM, Zhao Zhili wrote:
> From: Zhao Zhili <zhilizhao@tencent.com>
> 
> Fix #9908. Regression since 8a5896ec1f6.
> 
> Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
> ---
>   libswresample/swresample.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/libswresample/swresample.c b/libswresample/swresample.c
> index 6f04d130d3..624309c2a0 100644
> --- a/libswresample/swresample.c
> +++ b/libswresample/swresample.c
> @@ -265,12 +265,14 @@ av_cold int swr_init(struct SwrContext *s){
>           av_channel_layout_describe(&s->in_ch_layout, l1, sizeof(l1));
>           av_log(s, AV_LOG_WARNING, "Input channel layout \"%s\" is invalid or unsupported.\n", l1);
>           av_channel_layout_uninit(&s->in_ch_layout);
> +        s->in.ch_count = 0;
>       }
>   
>       if (!av_channel_layout_check(&s->out_ch_layout) || s->out_ch_layout.nb_channels > SWR_CH_MAX) {
>           av_channel_layout_describe(&s->out_ch_layout, l2, sizeof(l2));
>           av_log(s, AV_LOG_WARNING, "Output channel layout \"%s\" is invalid or unsupported.\n", l2);
>           av_channel_layout_uninit(&s->out_ch_layout);
> +        s->out.ch_count = 0;
>       }
>   
>       switch(s->engine){
diff mbox series

Patch

diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index 6f04d130d3..624309c2a0 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -265,12 +265,14 @@  av_cold int swr_init(struct SwrContext *s){
         av_channel_layout_describe(&s->in_ch_layout, l1, sizeof(l1));
         av_log(s, AV_LOG_WARNING, "Input channel layout \"%s\" is invalid or unsupported.\n", l1);
         av_channel_layout_uninit(&s->in_ch_layout);
+        s->in.ch_count = 0;
     }
 
     if (!av_channel_layout_check(&s->out_ch_layout) || s->out_ch_layout.nb_channels > SWR_CH_MAX) {
         av_channel_layout_describe(&s->out_ch_layout, l2, sizeof(l2));
         av_log(s, AV_LOG_WARNING, "Output channel layout \"%s\" is invalid or unsupported.\n", l2);
         av_channel_layout_uninit(&s->out_ch_layout);
+        s->out.ch_count = 0;
     }
 
     switch(s->engine){