From a5b334e18e362f76c82a5df206bc9198be53f8b5 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Sun, 13 Aug 2023 14:36:10 +0200 Subject: [PATCH] avfilter/af_astats: fix reporting of noise_floor for small number of samples --- libavfilter/af_astats.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/af_astats.c b/libavfilter/af_astats.c index 16d427cca6..c47bd768cc 100644 --- a/libavfilter/af_astats.c +++ b/libavfilter/af_astats.c @@ -409,9 +409,9 @@ static inline void update_stat(AudioStatsContext *s, ChannelStats *p, double d, } p->nb_samples++; + noise_floor = calc_noise_floor(p->sorted_samples, nd, drop, + s->tc_samples, &p->sorted_front, &p->sorted_back); if (p->nb_samples >= s->tc_samples) { - noise_floor = calc_noise_floor(p->sorted_samples, nd, drop, - s->tc_samples, &p->sorted_front, &p->sorted_back); if (isnan(p->noise_floor)) { p->noise_floor = noise_floor; p->noise_floor_count = 1;