diff options
author | slhck <werner.robitza@gmail.com> | 2013-02-25 22:23:55 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-02-25 23:13:10 +0400 |
commit | bfcc38ef4815229e0aa9d8417611e0f666bb4fc7 (patch) | |
tree | 5e71cbf2731bcecd510f3defa763c77b98e7b4e2 /libavcodec/libvpxenc.c | |
parent | 188947c32ad66653fa3a73a33a307e35cecd8fb8 (diff) |
libvpx: check if CQ level is in correct bounds
Check whether CQ level is within qmin..qmax and abort on error. If this isn't properly
set, encoding will fail at the first frame.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/libvpxenc.c')
-rw-r--r-- | libavcodec/libvpxenc.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index ed038abc9e..04ea031e55 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -289,6 +289,16 @@ static av_cold int vpx_init(AVCodecContext *avctx, enccfg.rc_min_quantizer = avctx->qmin; if (avctx->qmax > 0) enccfg.rc_max_quantizer = avctx->qmax; + + if (enccfg.rc_end_usage == VPX_CQ) { + if (ctx->crf < enccfg.rc_min_quantizer || ctx->crf > enccfg.rc_max_quantizer) { + av_log(avctx, AV_LOG_ERROR, + "CQ level must be between minimum and maximum quantizer value (%d-%d)\n", + enccfg.rc_min_quantizer, enccfg.rc_max_quantizer); + return AVERROR(EINVAL); + } + } + enccfg.rc_dropframe_thresh = avctx->frame_skip_threshold; //0-100 (0 => CBR, 100 => VBR) |