From 14e6ca17e1a8dd267ec276d9354bd2b6a7b2e04e Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Wed, 30 Nov 2022 21:18:20 +0100 Subject: [PATCH] avfilter/af_astats: do not give output for 0 samples --- libavfilter/af_astats.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavfilter/af_astats.c b/libavfilter/af_astats.c index d59640a3fd..306a6603a2 100644 --- a/libavfilter/af_astats.c +++ b/libavfilter/af_astats.c @@ -668,6 +668,9 @@ static void print_stats(AVFilterContext *ctx) for (c = 0; c < s->nb_channels; c++) { ChannelStats *p = &s->chstats[c]; + if (p->nb_samples == 0) + continue; + if (p->nb_samples < s->tc_samples) p->min_sigma_x2 = p->max_sigma_x2 = p->sigma_x2 / p->nb_samples; @@ -754,6 +757,9 @@ static void print_stats(AVFilterContext *ctx) av_log(ctx, AV_LOG_INFO, "Number of denormals: %"PRId64"\n", p->nb_denormals); } + if (nb_samples == 0) + return; + if (s->measure_overall != MEASURE_NONE) av_log(ctx, AV_LOG_INFO, "Overall\n"); if (s->measure_overall & MEASURE_DC_OFFSET)