feat: add min_fps_target setting (#1043)

This commit is contained in:
ReenigneArcher 2024-06-18 20:09:23 -04:00 committed by GitHub
commit 722e5600c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 44 additions and 3 deletions

View file

@ -1771,6 +1771,10 @@ namespace video {
return;
}
// set minimum frame time, avoiding violation of client-requested target framerate
auto minimum_frame_time = std::chrono::milliseconds(1000 / std::min(config.framerate, (config::video.min_fps_factor * 10)));
BOOST_LOG(debug) << "Minimum frame time set to "sv << minimum_frame_time.count() << "ms, based on min fps factor of "sv << config::video.min_fps_factor << "."sv;
auto shutdown_event = mail->event<bool>(mail::shutdown);
auto packets = mail::man->queue<packet_t>(mail::video_packets);
auto idr_events = mail->event<bool>(mail::idr);
@ -1811,9 +1815,9 @@ namespace video {
std::optional<std::chrono::steady_clock::time_point> frame_timestamp;
// Encode at a minimum of 10 FPS to avoid image quality issues with static content
// Encode at a minimum FPS to avoid image quality issues with static content
if (!requested_idr_frame || images->peek()) {
if (auto img = images->pop(100ms)) {
if (auto img = images->pop(minimum_frame_time)) {
frame_timestamp = img->frame_timestamp;
if (session->convert(*img)) {
BOOST_LOG(error) << "Could not convert image"sv;