diff options
author | Zhao Zhili <zhilizhao@tencent.com> | 2023-07-07 03:57:38 +0800 |
---|---|---|
committer | Timo Rothenpieler <timo@rothenpieler.org> | 2023-07-07 13:39:26 +0200 |
commit | 7eeef72c67d1292472c7923f7e0c59dd9780ff5c (patch) | |
tree | 5036099ff47269ce53d48f269468f4a1918c6142 /libavcodec/nvenc.c | |
parent | 0d0c39832fe0ceb58797548d544621eb7bd0755c (diff) | |
download | ffmpeg-7eeef72c67d1292472c7923f7e0c59dd9780ff5c.tar.gz |
avcodec/nvenc: set idrPeriod to gopLength unconditionally
When intra_refresh is enabled, gopLength is equal to
NVENC_INFINITE_GOPLENGTH. gopLength should be 1 at least.
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Diffstat (limited to 'libavcodec/nvenc.c')
-rw-r--r-- | libavcodec/nvenc.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 13fafcd246..0b6417674e 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -1191,11 +1191,7 @@ static av_cold int nvenc_setup_h264_config(AVCodecContext *avctx) h264->maxNumRefFrames = ctx->dpb_size; } - if (ctx->intra_refresh) { - h264->idrPeriod = NVENC_INFINITE_GOPLENGTH; - } else if (cc->gopLength > 0) { - h264->idrPeriod = cc->gopLength; - } + h264->idrPeriod = cc->gopLength; if (IS_CBR(cc->rcParams.rateControlMode)) { h264->outputBufferingPeriodSEI = 1; @@ -1318,11 +1314,7 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx) hevc->maxNumRefFramesInDPB = ctx->dpb_size; } - if (ctx->intra_refresh) { - hevc->idrPeriod = NVENC_INFINITE_GOPLENGTH; - } else if (cc->gopLength > 0) { - hevc->idrPeriod = cc->gopLength; - } + hevc->idrPeriod = cc->gopLength; if (IS_CBR(cc->rcParams.rateControlMode)) { hevc->outputBufferingPeriodSEI = 1; @@ -1418,12 +1410,10 @@ static av_cold int nvenc_setup_av1_config(AVCodecContext *avctx) av1->intraRefreshPeriod = cc->gopLength; av1->intraRefreshCnt = cc->gopLength - 1; cc->gopLength = NVENC_INFINITE_GOPLENGTH; - - av1->idrPeriod = NVENC_INFINITE_GOPLENGTH; - } else if (cc->gopLength > 0) { - av1->idrPeriod = cc->gopLength; } + av1->idrPeriod = cc->gopLength; + if (IS_CBR(cc->rcParams.rateControlMode)) { av1->enableBitstreamPadding = 1; } |