Commit 55243099 authored by Michael Niedermayer's avatar Michael Niedermayer
Browse files

avcodec/mpegvideo_enc: Limit bitrate tolerance to the representable


Fixes: error: 1.66789e+11 is outside the range of representable values of type 'int'
Fixes: Ticket8201
Signed-off-by: default avatarMichael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 245017ec

)
Signed-off-by: default avatarMichael Niedermayer <michael@niedermayer.cc>
No related merge requests found
Showing with 5 additions and 1 deletion
+5 -1
......@@ -492,9 +492,13 @@ FF_ENABLE_DEPRECATION_WARNINGS
if (!s->fixed_qscale &&
avctx->bit_rate * av_q2d(avctx->time_base) >
avctx->bit_rate_tolerance) {
double nbt = avctx->bit_rate * av_q2d(avctx->time_base) * 5;
av_log(avctx, AV_LOG_WARNING,
"bitrate tolerance %d too small for bitrate %"PRId64", overriding\n", avctx->bit_rate_tolerance, avctx->bit_rate);
avctx->bit_rate_tolerance = 5 * avctx->bit_rate * av_q2d(avctx->time_base);
if (nbt <= INT_MAX) {
avctx->bit_rate_tolerance = nbt;
} else
avctx->bit_rate_tolerance = INT_MAX;
}
if (s->avctx->rc_max_rate &&
......
Supports Markdown
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