From 9f81d12f87ef024b8ff7ce9c5eed4a6c211d62db Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Tue, 15 Mar 2022 15:40:00 +0100 Subject: [PATCH] avfilter/af_dynaudnorm: fix regression with channels option processing --- libavfilter/af_dynaudnorm.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libavfilter/af_dynaudnorm.c b/libavfilter/af_dynaudnorm.c index b46420d291..4fe1a9ce1b 100644 --- a/libavfilter/af_dynaudnorm.c +++ b/libavfilter/af_dynaudnorm.c @@ -129,17 +129,13 @@ AVFILTER_DEFINE_CLASS(dynaudnorm); static av_cold int init(AVFilterContext *ctx) { DynamicAudioNormalizerContext *s = ctx->priv; - int ret = 0; if (!(s->filter_size & 1)) { av_log(ctx, AV_LOG_WARNING, "filter size %d is invalid. Changing to an odd value.\n", s->filter_size); s->filter_size |= 1; } - if (strcmp(s->channels_to_filter, "all")) - ret = av_channel_layout_from_string(&s->ch_layout, s->channels_to_filter); - - return ret; + return 0; } static inline int frame_size(int sample_rate, int frame_len_msec) @@ -852,6 +848,12 @@ static int activate(AVFilterContext *ctx) int ret = 0, status; int64_t pts; + ret = av_channel_layout_copy(&s->ch_layout, &inlink->ch_layout); + if (ret < 0) + return ret; + if (strcmp(s->channels_to_filter, "all")) + av_channel_layout_from_string(&s->ch_layout, s->channels_to_filter); + FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink); if (!s->eof) {