diff mbox series

[FFmpeg-devel,5/5] avfilter/af_drmeter: Check that there is data

Message ID 20210606134757.18919-5-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/5] avfilter/vf_ciescope: Handle black as very dark neutral gray
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer June 6, 2021, 1:47 p.m. UTC
Fixes: floating point division by 0
Fixes: -nan is outside the range of representable values of type 'int'
Fixes: Ticket8307

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavfilter/af_drmeter.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/libavfilter/af_drmeter.c b/libavfilter/af_drmeter.c
index 3774259da3..58932fe6c5 100644
--- a/libavfilter/af_drmeter.c
+++ b/libavfilter/af_drmeter.c
@@ -167,6 +167,11 @@  static void print_stats(AVFilterContext *ctx)
         float chdr, secondpeak, rmssum = 0;
         int i, j, first = 0;
 
+        if (!p->nb_samples) {
+            av_log(ctx, AV_LOG_INFO, "No data, dynamic range not meassurable\n");
+            return;
+        }
+
         finish_block(p);
 
         for (i = 0; i <= 10000; i++) {