aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2012-01-13 23:41:16 +0200
committerMartin Storsjö <martin@martin.st>2012-01-14 02:08:42 +0200
commit57facb73ab940b1117c22ef9b70a6e5ec237112d (patch)
treebeb0d0d4c60f2ca15bb4ec1c2967e9ca34492709 /libavcodec
parent4c82c6d9932bfdb1a9eb288d566ded9d40ca5e24 (diff)
downloadffmpeg-57facb73ab940b1117c22ef9b70a6e5ec237112d.tar.gz
libx264: Don't leave max_b_frames as -1 if the user didn't set it
max_b_frames is initialized to -1 for libx264, to allow distinguishing between an explicit user set 0 and a default not touched 0 (see bb73cda2). If max_b_frames is left as -1, this affects dts generation (where expressions like max_b_frames != 0 are used), so make sure it is left at the default 0 after the libx264 init function returns. This avoids unnecessarily producing dts != pts when using profile=baseline. Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavcodec')
-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;