fix(linux/xdgportal): avoid duplicate frame insertion (#4839)

This commit is contained in:
Conn O'Griofa
2026-03-14 17:43:17 +00:00
committed by GitHub
parent 00fa2400dd
commit 99d4e053bf
3 changed files with 12 additions and 2 deletions
+4
View File
@@ -534,6 +534,10 @@ namespace platf {
return true;
}
virtual bool is_event_driven() {
return false;
}
virtual ~display_t() = default;
// Offsets for when streaming a specific monitor. By default, they are 0.
+5
View File
@@ -1365,6 +1365,11 @@ namespace portal {
return 0;
}
// This capture method is event driven; don't insert duplicate frames
bool is_event_driven() override {
return true;
}
private:
bool is_buffer_redundant(const egl::img_descriptor_t *img) {
// Check for corrupted frame
+3 -2
View File
@@ -1972,8 +1972,9 @@ namespace video {
}
});
// set max frame time based on client-requested target framerate.
double minimum_fps_target = (config::video.minimum_fps_target > 0.0) ? config::video.minimum_fps_target : config.framerate;
// set max frame time based on client-requested target framerate (or 0.5fps/2000ms for event-driven capture)
double def_fps_target = (disp->is_event_driven() ? 1 : config.framerate);
double minimum_fps_target = (config::video.minimum_fps_target > 0.0) ? config::video.minimum_fps_target : def_fps_target;
std::chrono::duration<double, std::milli> max_frametime {1000.0 / minimum_fps_target};
BOOST_LOG(info) << "Minimum FPS target set to ~"sv << (minimum_fps_target / 2) << "fps ("sv << max_frametime.count() * 2 << "ms)"sv;