diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c index 5ba880f10b..6cbc7a00a1 100644 --- a/libavfilter/af_afir.c +++ b/libavfilter/af_afir.c @@ -742,14 +742,14 @@ static int query_formats(AVFilterContext *ctx) } else { AVFilterChannelLayouts *mono = NULL; - ret = ff_add_channel_layout(&mono, AV_CH_LAYOUT_MONO); - if (ret) - return ret; - if ((ret = ff_channel_layouts_ref(layouts, &ctx->inputs[0]->out_channel_layouts)) < 0) return ret; if ((ret = ff_channel_layouts_ref(layouts, &ctx->outputs[0]->in_channel_layouts)) < 0) return ret; + + ret = ff_add_channel_layout(&mono, AV_CH_LAYOUT_MONO); + if (ret) + return ret; for (int i = 1; i < ctx->nb_inputs; i++) { if ((ret = ff_channel_layouts_ref(mono, &ctx->inputs[i]->out_channel_layouts)) < 0) return ret;