diff options
author | Paul B Mahol <onemda@gmail.com> | 2022-12-03 17:29:48 +0100 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2022-12-03 17:32:07 +0100 |
commit | 754fa305faac1afa472d59e1a5bf24aacbe8ed77 (patch) | |
tree | a9525f15d0143f1d3328ecbd1499669a2752628f | |
parent | 33e70dc0b8cba157c3da234a858bfa743e862b4a (diff) | |
download | ffmpeg-754fa305faac1afa472d59e1a5bf24aacbe8ed77.tar.gz |
avfilter/af_astats: accessing outlink in uninit is not valid
-rw-r--r-- | libavfilter/af_astats.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libavfilter/af_astats.c b/libavfilter/af_astats.c index 724506df44..8755ab8752 100644 --- a/libavfilter/af_astats.c +++ b/libavfilter/af_astats.c @@ -99,6 +99,7 @@ typedef struct AudioStatsContext { double time_constant; double mult; int metadata; + int used; int reset_count; int nb_frames; int maxbitdepth; @@ -637,6 +638,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf) s->nb_frames++; } + if (s->used == 0) + s->used = buf->nb_samples > 0; ff_filter_execute(ctx, filter_channel, buf, NULL, FFMIN(inlink->ch_layout.nb_channels, ff_filter_get_nb_threads(ctx))); @@ -668,7 +671,7 @@ static void print_stats(AVFilterContext *ctx) for (c = 0; c < s->nb_channels; c++) { ChannelStats *p = &s->chstats[c]; - if (p->nb_samples == 0 && ctx->outputs[0]->sample_count_in == 0) + if (p->nb_samples == 0 && !s->used) continue; if (p->nb_samples < s->tc_samples) @@ -757,7 +760,7 @@ static void print_stats(AVFilterContext *ctx) av_log(ctx, AV_LOG_INFO, "Number of denormals: %"PRId64"\n", p->nb_denormals); } - if (nb_samples == 0 && ctx->outputs[0]->sample_count_in == 0) + if (nb_samples == 0 && !s->used) return; if (s->measure_overall != MEASURE_NONE) |