Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/mpegvideo_enc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 3d4ffdf021..f804b8215d 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -463,9 +463,13 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
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 (avctx->rc_max_rate &&