summaryrefslogtreecommitdiff
path: root/libavcodec/libx264.c
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2014-06-21 12:46:19 +0200
committerLuca Barbato <lu_zero@gentoo.org>2014-06-22 21:01:07 +0200
commit0ef256d51518f0e483c38b9ee3b993cf0709d00e (patch)
tree69b486951de435f6283123bc54ef081e78a76ae2 /libavcodec/libx264.c
parent73953df71a28e94d8959facba7906cf5975ca4ef (diff)
libx264: Correctly manage constant rate factor params
By default they are set to -1.
Diffstat (limited to 'libavcodec/libx264.c')
-rw-r--r--libavcodec/libx264.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 06e917e4f3..4f44a06548 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -179,7 +179,8 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
x264_encoder_reconfig(x4->enc, &x4->params);
}
- if (x4->params.rc.i_rc_method == X264_RC_CRF &&
+ if (x4->crf >= 0 &&
+ x4->params.rc.i_rc_method == X264_RC_CRF &&
x4->params.rc.f_rf_constant != x4->crf) {
x4->params.rc.f_rf_constant = x4->crf;
x264_encoder_reconfig(x4->enc, &x4->params);
@@ -191,7 +192,7 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
x264_encoder_reconfig(x4->enc, &x4->params);
}
- if (x4->crf_max &&
+ if (x4->crf_max >= 0 &&
x4->params.rc.f_rf_constant_max != x4->crf_max) {
x4->params.rc.f_rf_constant_max = x4->crf_max;
x264_encoder_reconfig(x4->enc, &x4->params);