avcodec/libx265: Fix integer overflow in computation of max and avg bitrate

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
This commit is contained in:
Limin Wang 2020-06-08 19:51:33 +08:00
parent 93016f5d1d
commit e3b5897fe3
1 changed files with 2 additions and 2 deletions

View File

@ -310,8 +310,8 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
if (!cpb_props)
return AVERROR(ENOMEM);
cpb_props->buffer_size = ctx->params->rc.vbvBufferSize * 1000;
cpb_props->max_bitrate = ctx->params->rc.vbvMaxBitrate * 1000;
cpb_props->avg_bitrate = ctx->params->rc.bitrate * 1000;
cpb_props->max_bitrate = ctx->params->rc.vbvMaxBitrate * 1000LL;
cpb_props->avg_bitrate = ctx->params->rc.bitrate * 1000LL;
if (!(avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER))
ctx->params->bRepeatHeaders = 1;