Fix warp modes w/ reduce stutters
This commit is contained in:
@@ -440,6 +440,7 @@ namespace config {
|
||||
false, // headless_mode
|
||||
true, // limit_framerate
|
||||
false, // double_refreshrate
|
||||
|
||||
28, // qp
|
||||
|
||||
0, // hevc_mode
|
||||
|
||||
@@ -1923,10 +1923,9 @@ namespace video {
|
||||
});
|
||||
|
||||
// set minimum frame time based on client-requested target framerate
|
||||
auto minimum_frame_time = std::chrono::milliseconds(1000 / config.framerate);
|
||||
auto capture_frame_threshold = std::chrono::microseconds(1000 * 1000 / config.framerate);
|
||||
auto encode_frame_threshold = std::chrono::microseconds(1000 * 1000 / config.encodingFramerate);
|
||||
BOOST_LOG(info) << "Capture Frame threshold: "sv << capture_frame_threshold;
|
||||
auto minimum_frame_time = std::chrono::nanoseconds(1000ms) * 1000 / config.encodingFramerate;
|
||||
auto encode_frame_threshold = std::chrono::nanoseconds(1000ms) * 1000 / config.encodingFramerate;
|
||||
auto frame_variation_threshold = encode_frame_threshold / 4;
|
||||
BOOST_LOG(info) << "Encoding Frame threshold: "sv << encode_frame_threshold;
|
||||
|
||||
auto shutdown_event = mail->event<bool>(mail::shutdown);
|
||||
@@ -2001,28 +2000,17 @@ namespace video {
|
||||
if (auto img = images->pop(minimum_frame_time)) {
|
||||
frame_timestamp = img->frame_timestamp;
|
||||
// If new frame comes in way too fast, just drop
|
||||
if (*frame_timestamp < (next_frame_start - capture_frame_threshold / 2)) {
|
||||
if (*frame_timestamp < (next_frame_start - frame_variation_threshold)) {
|
||||
continue;
|
||||
}
|
||||
if (session->convert(*img)) {
|
||||
BOOST_LOG(error) << "Could not convert image"sv;
|
||||
break;
|
||||
}
|
||||
} else if (!images->running()) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (frame_timestamp) {
|
||||
auto frame_diff = *frame_timestamp - next_frame_start;
|
||||
|
||||
next_frame_start = *frame_timestamp + encode_frame_threshold;
|
||||
|
||||
if (frame_diff > encode_frame_threshold / 2) {
|
||||
next_frame_start = *frame_timestamp + encode_frame_threshold;
|
||||
} else {
|
||||
frame_timestamp = next_frame_start;
|
||||
next_frame_start += encode_frame_threshold;
|
||||
}
|
||||
} else if (!images->running()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user