From 574fdb80e336e6cd9a1c06d2068649e72a7a4b20 Mon Sep 17 00:00:00 2001 From: Elia Zammuto Date: Mon, 23 Dec 2024 14:18:29 +0100 Subject: [PATCH] fix(nvenc): Enable refresh only on supported Cards --- src/nvenc/nvenc_base.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/nvenc/nvenc_base.cpp b/src/nvenc/nvenc_base.cpp index f112a630de3..6dd72755fca 100644 --- a/src/nvenc/nvenc_base.cpp +++ b/src/nvenc/nvenc_base.cpp @@ -322,10 +322,20 @@ namespace nvenc { set_minqp_if_enabled(config.min_qp_hevc); fill_h264_hevc_vui(format_config.hevcVUIParameters); if (client_config.enableIntraRefresh == 1) { - format_config.enableIntraRefresh = 1; - format_config.singleSliceIntraRefresh = 1; - format_config.intraRefreshPeriod = 300; - format_config.intraRefreshCnt = 299; + if (get_encoder_cap(NV_ENC_CAPS_SUPPORT_INTRA_REFRESH)) { + format_config.enableIntraRefresh = 1; + format_config.intraRefreshPeriod = 300; + format_config.intraRefreshCnt = 299; + if (get_encoder_cap(NV_ENC_CAPS_SINGLE_SLICE_INTRA_REFRESH)) { + format_config.singleSliceIntraRefresh = 1; + } + else { + BOOST_LOG(warning) << "NvEnc: Single Slice Intra Refresh not supported"; + } + } + else { + BOOST_LOG(error) << "NvEnc: Client asked for intra-refresh but the encoder does not support intra-refresh"; + } } break; }