Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(nvenc): Enable opt-in client refresh by client #3415

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/nvenc/nvenc_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,22 @@
set_ref_frames(format_config.maxNumRefFramesInDPB, format_config.numRefL0, 5);
set_minqp_if_enabled(config.min_qp_hevc);
fill_h264_hevc_vui(format_config.hevcVUIParameters);
if (client_config.enableIntraRefresh == 1) {
if (get_encoder_cap(NV_ENC_CAPS_SUPPORT_INTRA_REFRESH)) {
format_config.enableIntraRefresh = 1;
format_config.intraRefreshPeriod = 300;
format_config.intraRefreshCnt = 299;

Check warning on line 328 in src/nvenc/nvenc_base.cpp

View check run for this annotation

Codecov / codecov/patch

src/nvenc/nvenc_base.cpp#L326-L328

Added lines #L326 - L328 were not covered by tests
if (get_encoder_cap(NV_ENC_CAPS_SINGLE_SLICE_INTRA_REFRESH)) {
format_config.singleSliceIntraRefresh = 1;

Check warning on line 330 in src/nvenc/nvenc_base.cpp

View check run for this annotation

Codecov / codecov/patch

src/nvenc/nvenc_base.cpp#L330

Added line #L330 was not covered by tests
}
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;
}

Expand Down
2 changes: 2 additions & 0 deletions src/rtsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,7 @@ namespace rtsp_stream {
args.try_emplace("x-ml-video.configuredBitrateKbps"sv, "0"sv);
args.try_emplace("x-ss-general.encryptionEnabled"sv, "0"sv);
args.try_emplace("x-ss-video[0].chromaSamplingType"sv, "0"sv);
args.try_emplace("x-ss-video[0].intraRefresh"sv, "0"sv);

stream::config_t config;

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

configuredBitrateKbps = util::from_view(args.at("x-ml-video.configuredBitrateKbps"sv));
}
Expand Down
2 changes: 2 additions & 0 deletions src/video.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ namespace video {
int dynamicRange;

int chromaSamplingType; // 0 - 4:2:0, 1 - 4:4:4

int enableIntraRefresh; // 0 - disabled, 1 - enabled
};

platf::mem_type_e
Expand Down
Loading