|
| 1 | +From 2bd65325dc20ad1ea3111e8a8b8328224fd9ee0a Mon Sep 17 00:00:00 2001 |
| 2 | +From: Martin Pulec <martin.pulec@cesnet.cz> |
| 3 | +Date: Mon, 24 Jul 2023 16:15:29 +0200 |
| 4 | +Subject: [PATCH] NVENC_INFINITE_GOPLENGTH is useless for UltraGrid (updated) |
| 5 | + |
| 6 | +--- |
| 7 | + libavcodec/avcodec.h | 3 +++ |
| 8 | + libavcodec/nvenc.c | 3 --- |
| 9 | + 2 files changed, 3 insertions(+), 3 deletions(-) |
| 10 | + |
| 11 | +diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h |
| 12 | +index fe41ecc3c9..15bc1f5cec 100644 |
| 13 | +--- a/libavcodec/avcodec.h |
| 14 | ++++ b/libavcodec/avcodec.h |
| 15 | +@@ -3270,4 +3270,7 @@ int avcodec_is_open(AVCodecContext *s); |
| 16 | + * @} |
| 17 | + */ |
| 18 | + |
| 19 | ++// UltraGrid patch |
| 20 | ++#define PATCHED_FF_NVENC_NO_INFINITE_GOP 1 |
| 21 | ++ |
| 22 | + #endif /* AVCODEC_AVCODEC_H */ |
| 23 | +diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c |
| 24 | +index 0b6417674e..70adc26f08 100644 |
| 25 | +--- a/libavcodec/nvenc.c |
| 26 | ++++ b/libavcodec/nvenc.c |
| 27 | +@@ -1173,7 +1173,6 @@ static av_cold int nvenc_setup_h264_config(AVCodecContext *avctx) |
| 28 | + h264->enableIntraRefresh = 1; |
| 29 | + h264->intraRefreshPeriod = cc->gopLength; |
| 30 | + h264->intraRefreshCnt = cc->gopLength - 1; |
| 31 | +- cc->gopLength = NVENC_INFINITE_GOPLENGTH; |
| 32 | + #ifdef NVENC_HAVE_SINGLE_SLICE_INTRA_REFRESH |
| 33 | + h264->singleSliceIntraRefresh = ctx->single_slice_intra_refresh; |
| 34 | + #endif |
| 35 | +@@ -1294,7 +1293,6 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx) |
| 36 | + hevc->enableIntraRefresh = 1; |
| 37 | + hevc->intraRefreshPeriod = cc->gopLength; |
| 38 | + hevc->intraRefreshCnt = cc->gopLength - 1; |
| 39 | +- cc->gopLength = NVENC_INFINITE_GOPLENGTH; |
| 40 | + #ifdef NVENC_HAVE_SINGLE_SLICE_INTRA_REFRESH |
| 41 | + hevc->singleSliceIntraRefresh = ctx->single_slice_intra_refresh; |
| 42 | + #endif |
| 43 | +@@ -1409,7 +1407,6 @@ static av_cold int nvenc_setup_av1_config(AVCodecContext *avctx) |
| 44 | + av1->enableIntraRefresh = 1; |
| 45 | + av1->intraRefreshPeriod = cc->gopLength; |
| 46 | + av1->intraRefreshCnt = cc->gopLength - 1; |
| 47 | +- cc->gopLength = NVENC_INFINITE_GOPLENGTH; |
| 48 | + } |
| 49 | + |
| 50 | + av1->idrPeriod = cc->gopLength; |
| 51 | +-- |
| 52 | +2.41.0 |
| 53 | + |
0 commit comments