Skip to content

Commit 60bfcfe

Browse files
fix(nvenc): Enable opt-in client refresh by client (#3415)
1 parent 129abd8 commit 60bfcfe

3 files changed

Lines changed: 20 additions & 0 deletions

File tree

src/nvenc/nvenc_base.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,22 @@ namespace nvenc {
321321
set_ref_frames(format_config.maxNumRefFramesInDPB, format_config.numRefL0, 5);
322322
set_minqp_if_enabled(config.min_qp_hevc);
323323
fill_h264_hevc_vui(format_config.hevcVUIParameters);
324+
if (client_config.enableIntraRefresh == 1) {
325+
if (get_encoder_cap(NV_ENC_CAPS_SUPPORT_INTRA_REFRESH)) {
326+
format_config.enableIntraRefresh = 1;
327+
format_config.intraRefreshPeriod = 300;
328+
format_config.intraRefreshCnt = 299;
329+
if (get_encoder_cap(NV_ENC_CAPS_SINGLE_SLICE_INTRA_REFRESH)) {
330+
format_config.singleSliceIntraRefresh = 1;
331+
}
332+
else {
333+
BOOST_LOG(warning) << "NvEnc: Single Slice Intra Refresh not supported";
334+
}
335+
}
336+
else {
337+
BOOST_LOG(error) << "NvEnc: Client asked for intra-refresh but the encoder does not support intra-refresh";
338+
}
339+
}
324340
break;
325341
}
326342

src/rtsp.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,7 @@ namespace rtsp_stream {
976976
args.try_emplace("x-ml-video.configuredBitrateKbps"sv, "0"sv);
977977
args.try_emplace("x-ss-general.encryptionEnabled"sv, "0"sv);
978978
args.try_emplace("x-ss-video[0].chromaSamplingType"sv, "0"sv);
979+
args.try_emplace("x-ss-video[0].intraRefresh"sv, "0"sv);
979980

980981
stream::config_t config;
981982

@@ -1012,6 +1013,7 @@ namespace rtsp_stream {
10121013
config.monitor.videoFormat = util::from_view(args.at("x-nv-vqos[0].bitStreamFormat"sv));
10131014
config.monitor.dynamicRange = util::from_view(args.at("x-nv-video[0].dynamicRangeMode"sv));
10141015
config.monitor.chromaSamplingType = util::from_view(args.at("x-ss-video[0].chromaSamplingType"sv));
1016+
config.monitor.enableIntraRefresh = util::from_view(args.at("x-ss-video[0].intraRefresh"sv));
10151017

10161018
configuredBitrateKbps = util::from_view(args.at("x-ml-video.configuredBitrateKbps"sv));
10171019
}

src/video.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ namespace video {
3838
int dynamicRange;
3939

4040
int chromaSamplingType; // 0 - 4:2:0, 1 - 4:4:4
41+
42+
int enableIntraRefresh; // 0 - disabled, 1 - enabled
4143
};
4244

4345
platf::mem_type_e

0 commit comments

Comments
 (0)