summaryrefslogtreecommitdiff
path: root/libavcodec/libx264.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/libx264.c')
-rw-r--r--libavcodec/libx264.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 9b347951fd..b3581f168f 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -448,6 +448,9 @@ static av_cold int X264_init(AVCodecContext *avctx)
// update AVCodecContext with x264 parameters
avctx->has_b_frames = x4->params.i_bframe ?
x4->params.i_bframe_pyramid ? 2 : 1 : 0;
+ if (avctx->max_b_frames < 0)
+ avctx->max_b_frames = 0;
+
avctx->bit_rate = x4->params.rc.i_bitrate*1000;
#if FF_API_X264_GLOBAL_OPTS
avctx->crf = x4->params.rc.f_rf_constant;