aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2021-09-08 09:42:27 +0200
committerPaul B Mahol <onemda@gmail.com>2021-09-08 10:45:53 +0200
commitc3e11e3092201e7cb98fb5e342705fa5d0c811df (patch)
tree3ccbe821cc45bf71483eeb6b829ec5817b5bc046
parent4e1ee16cbb30356f21ef2cb61679025d81e4fddd (diff)
downloadffmpeg-c3e11e3092201e7cb98fb5e342705fa5d0c811df.tar.gz
avfilter/af_silenceremove: add asserts to check for NaNs
-rw-r--r--libavfilter/af_silenceremove.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavfilter/af_silenceremove.c b/libavfilter/af_silenceremove.c
index 77a0b2e2fb..f2f563c5cd 100644
--- a/libavfilter/af_silenceremove.c
+++ b/libavfilter/af_silenceremove.c
@@ -23,6 +23,7 @@
#include <float.h> /* DBL_MAX */
+#include "libavutil/avassert.h"
#include "libavutil/opt.h"
#include "libavutil/timestamp.h"
#include "audio.h"
@@ -233,6 +234,7 @@ static double compute_rms_double(SilenceRemoveContext *s, AVFrame *frame, int ch
new_sum -= wsample;
new_sum += sample * sample;
+ av_assert2(new_sum >= 0.);
return sqrt(new_sum / s->window_duration);
}
@@ -260,6 +262,7 @@ static double compute_rms_float(SilenceRemoveContext *s, AVFrame *frame, int ch,
new_sum -= wsample;
new_sum += sample * sample;
+ av_assert2(new_sum >= 0.f);
return sqrtf(new_sum / s->window_duration);
}
@@ -341,6 +344,7 @@ static double compute_rms_doublep(SilenceRemoveContext *s, AVFrame *frame, int c
new_sum -= wsample;
new_sum += sample * sample;
+ av_assert2(new_sum >= 0.);
return sqrt(new_sum / s->window_duration);
}
@@ -368,6 +372,7 @@ static double compute_rms_floatp(SilenceRemoveContext *s, AVFrame *frame, int ch
new_sum -= wsample;
new_sum += sample * sample;
+ av_assert2(new_sum >= 0.f);
return sqrtf(new_sum / s->window_duration);
}