diff options
author | Paul B Mahol <onemda@gmail.com> | 2016-01-18 19:55:40 +0100 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2016-01-19 20:14:14 +0100 |
commit | 307b8482181685e9a87a8d2f4ab9c7d180eaf3ad (patch) | |
tree | a315e4c4583315de3249c188c545a99bbe4f9a18 | |
parent | b0c57206d583517a5ea35dd7f365f8260d9106f2 (diff) | |
download | ffmpeg-307b8482181685e9a87a8d2f4ab9c7d180eaf3ad.tar.gz |
avfilter/af_dynaudnorm: call uninit() from config_input()
Should help dynamic filtergraph reconfiguration.
Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r-- | libavfilter/af_dynaudnorm.c | 60 |
1 files changed, 31 insertions, 29 deletions
diff --git a/libavfilter/af_dynaudnorm.c b/libavfilter/af_dynaudnorm.c index d0bb51d789..1dd221ce57 100644 --- a/libavfilter/af_dynaudnorm.c +++ b/libavfilter/af_dynaudnorm.c @@ -255,12 +255,43 @@ static void init_gaussian_filter(DynamicAudioNormalizerContext *s) } } +static av_cold void uninit(AVFilterContext *ctx) +{ + DynamicAudioNormalizerContext *s = ctx->priv; + int c; + + av_freep(&s->prev_amplification_factor); + av_freep(&s->dc_correction_value); + av_freep(&s->compress_threshold); + av_freep(&s->fade_factors[0]); + av_freep(&s->fade_factors[1]); + + for (c = 0; c < s->channels; c++) { + if (s->gain_history_original) + cqueue_free(s->gain_history_original[c]); + if (s->gain_history_minimum) + cqueue_free(s->gain_history_minimum[c]); + if (s->gain_history_smoothed) + cqueue_free(s->gain_history_smoothed[c]); + } + + av_freep(&s->gain_history_original); + av_freep(&s->gain_history_minimum); + av_freep(&s->gain_history_smoothed); + + av_freep(&s->weights); + + ff_bufqueue_discard_all(&s->queue); +} + static int config_input(AVFilterLink *inlink) { AVFilterContext *ctx = inlink->dst; DynamicAudioNormalizerContext *s = ctx->priv; int c; + uninit(ctx); + s->frame_len = inlink->min_samples = inlink->max_samples = @@ -673,35 +704,6 @@ static int request_frame(AVFilterLink *outlink) return ret; } -static av_cold void uninit(AVFilterContext *ctx) -{ - DynamicAudioNormalizerContext *s = ctx->priv; - int c; - - av_freep(&s->prev_amplification_factor); - av_freep(&s->dc_correction_value); - av_freep(&s->compress_threshold); - av_freep(&s->fade_factors[0]); - av_freep(&s->fade_factors[1]); - - for (c = 0; c < s->channels; c++) { - if (s->gain_history_original) - cqueue_free(s->gain_history_original[c]); - if (s->gain_history_minimum) - cqueue_free(s->gain_history_minimum[c]); - if (s->gain_history_smoothed) - cqueue_free(s->gain_history_smoothed[c]); - } - - av_freep(&s->gain_history_original); - av_freep(&s->gain_history_minimum); - av_freep(&s->gain_history_smoothed); - - av_freep(&s->weights); - - ff_bufqueue_discard_all(&s->queue); -} - static const AVFilterPad avfilter_af_dynaudnorm_inputs[] = { { .name = "default", |