Commit 98ae6b0a authored by Paul B Mahol's avatar Paul B Mahol

vafilter/af_replaygain: fix undefined behaviour

Fixes #8291
parent 71bceb06
...@@ -551,7 +551,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) ...@@ -551,7 +551,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
AVFilterContext *ctx = inlink->dst; AVFilterContext *ctx = inlink->dst;
AVFilterLink *outlink = ctx->outputs[0]; AVFilterLink *outlink = ctx->outputs[0];
ReplayGainContext *s = ctx->priv; ReplayGainContext *s = ctx->priv;
uint32_t level; int64_t level;
AVFrame *out; AVFrame *out;
out = ff_get_audio_buffer(outlink, in->nb_samples); out = ff_get_audio_buffer(outlink, in->nb_samples);
...@@ -567,9 +567,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) ...@@ -567,9 +567,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
out->nb_samples); out->nb_samples);
butter_filter_stereo_samples(s, (float *)out->data[0], butter_filter_stereo_samples(s, (float *)out->data[0],
out->nb_samples); out->nb_samples);
level = (uint32_t)floor(100 * calc_stereo_rms((float *)out->data[0], level = lrint(floor(100 * calc_stereo_rms((float *)out->data[0],
out->nb_samples)); out->nb_samples)));
level = av_clip(level, 0, HISTOGRAM_SLOTS - 1); level = av_clip64(level, 0, HISTOGRAM_SLOTS - 1);
s->histogram[level]++; s->histogram[level]++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment