mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-22 01:40:28 +00:00
CI Linux FFmpeg: remove NVENC IDR patch
Since the FFmpeg commit 7eeef72c6, the IDR period is set to gopLength unconditinally even for intra-refresh mode, which is what the removed patch did. + do not check if FFmpeg is patched (the macro is )
This commit is contained in:
@@ -1,52 +0,0 @@
|
|||||||
From 64f7b0960e3d2ee3855492d518813f4ad53459ef Mon Sep 17 00:00:00 2001
|
|
||||||
From: Martin Pulec <martin.pulec@cesnet.cz>
|
|
||||||
Date: Fri, 22 Apr 2022 09:50:14 +0200
|
|
||||||
Subject: [PATCH] NVENC: set idrPeriod to gop_size
|
|
||||||
|
|
||||||
NVENC_INFINITE_GOPLENGTH is useless for UltraGrid
|
|
||||||
---
|
|
||||||
libavcodec/avcodec.h | 3 +++
|
|
||||||
libavcodec/nvenc.c | 8 ++------
|
|
||||||
2 files changed, 5 insertions(+), 6 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
|
|
||||||
index 4dae23d06e..31f9898731 100644
|
|
||||||
--- a/libavcodec/avcodec.h
|
|
||||||
+++ b/libavcodec/avcodec.h
|
|
||||||
@@ -3167,4 +3167,7 @@ int avcodec_is_open(AVCodecContext *s);
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
+// UltraGrid patch
|
|
||||||
+#define PATCHED_FF_NVENC_NO_INFINITE_GOP 1
|
|
||||||
+
|
|
||||||
#endif /* AVCODEC_AVCODEC_H */
|
|
||||||
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
|
|
||||||
index b6bcec8246..8bdada1598 100644
|
|
||||||
--- a/libavcodec/nvenc.c
|
|
||||||
+++ b/libavcodec/nvenc.c
|
|
||||||
@@ -1130,9 +1130,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 (avctx->gop_size >= 0) {
|
|
||||||
+ if (avctx->gop_size >= 0) {
|
|
||||||
h264->idrPeriod = avctx->gop_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1244,9 +1242,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 (avctx->gop_size >= 0) {
|
|
||||||
+ if (avctx->gop_size >= 0) {
|
|
||||||
hevc->idrPeriod = avctx->gop_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.36.0
|
|
||||||
|
|
||||||
@@ -1539,16 +1539,19 @@ static void configure_nvenc(AVCodecContext *codec_ctx, struct setparam_param *pa
|
|||||||
}
|
}
|
||||||
|
|
||||||
set_forced_idr(codec_ctx, 1);
|
set_forced_idr(codec_ctx, 1);
|
||||||
#ifdef PATCHED_FF_NVENC_NO_INFINITE_GOP
|
#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(60, 22, 100)
|
||||||
const bool patched_ff = true;
|
const bool new_ff = true;
|
||||||
#else
|
#else
|
||||||
const bool patched_ff = false;
|
const bool new_ff = false;
|
||||||
if (param->periodic_intra != 0) {
|
if (param->periodic_intra != 0) {
|
||||||
LOG(LOG_LEVEL_WARNING) << MOD_NAME "FFmpeg not patched, " << (param->periodic_intra != 1 ? "not " : "") << "enabling Intra Refresh.\n";
|
LOG(LOG_LEVEL_WARNING) << MOD_NAME
|
||||||
|
"Old FFmpeg, " << (param->periodic_intra != 1 ? "not " : "")
|
||||||
|
<< "enabling Intra Refresh.\n";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((patched_ff && param->periodic_intra != 0) || param->periodic_intra == 1) {
|
if ((new_ff && param->periodic_intra != 0) ||
|
||||||
|
param->periodic_intra == 1) {
|
||||||
check_av_opt_set<int>(codec_ctx->priv_data, "intra-refresh", 1);
|
check_av_opt_set<int>(codec_ctx->priv_data, "intra-refresh", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user