diff options
author | Paul B Mahol <onemda@gmail.com> | 2019-10-16 18:24:31 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2019-10-16 18:28:32 +0200 |
commit | 98ae6b0a4d6d6909277b664937721e135c0a70ff (patch) | |
tree | d757c0afe91f6bfefb135167fda2176bc6414ae0 /libavfilter/af_replaygain.c | |
parent | 71bceb06e69c6d54f6c203137c3d7ae54832afe3 (diff) | |
download | ffmpeg-98ae6b0a4d6d6909277b664937721e135c0a70ff.tar.gz |
vafilter/af_replaygain: fix undefined behaviour
Fixes #8291
Diffstat (limited to 'libavfilter/af_replaygain.c')
-rw-r--r-- | libavfilter/af_replaygain.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libavfilter/af_replaygain.c b/libavfilter/af_replaygain.c index 97617346ed..53fe49d769 100644 --- a/libavfilter/af_replaygain.c +++ b/libavfilter/af_replaygain.c @@ -551,7 +551,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) AVFilterContext *ctx = inlink->dst; AVFilterLink *outlink = ctx->outputs[0]; ReplayGainContext *s = ctx->priv; - uint32_t level; + int64_t level; AVFrame *out; out = ff_get_audio_buffer(outlink, in->nb_samples); @@ -567,9 +567,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) out->nb_samples); butter_filter_stereo_samples(s, (float *)out->data[0], out->nb_samples); - level = (uint32_t)floor(100 * calc_stereo_rms((float *)out->data[0], - out->nb_samples)); - level = av_clip(level, 0, HISTOGRAM_SLOTS - 1); + level = lrint(floor(100 * calc_stereo_rms((float *)out->data[0], + out->nb_samples))); + level = av_clip64(level, 0, HISTOGRAM_SLOTS - 1); s->histogram[level]++; |