fix: Resolve minimum_fps_target related issues on all platforms (#4967)

This commit is contained in:
Conn O'Griofa
2026-04-19 18:49:37 +01:00
committed by GitHub
parent 7228c2553c
commit 44bf39be75
4 changed files with 9 additions and 22 deletions

View File

@@ -535,10 +535,6 @@ 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.

View File

@@ -858,11 +858,6 @@ namespace pipewire {
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

View File

@@ -60,22 +60,19 @@ namespace safe {
}
// pop and view should not be used interchangeably
template<class Rep, class Period>
template<typename Rep, typename Period>
status_t pop(std::chrono::duration<Rep, Period> delay) {
std::unique_lock ul {_lock};
if (!_continue) {
if (bool success = _cv.wait_for(ul, delay, [this] {
return (bool) _status || !_continue;
});
!success || !_continue) {
return util::false_v<status_t>;
}
while (!_status) {
if (!_continue || _cv.wait_for(ul, delay) == std::cv_status::timeout) {
return util::false_v<status_t>;
}
}
auto val = std::move(_status);
_status = util::false_v<status_t>;
_status.reset();
return val;
}

View File

@@ -2048,11 +2048,10 @@ namespace video {
}
});
// 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;
// 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 / 2);
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;
BOOST_LOG(info) << "Minimum FPS target set to ~"sv << minimum_fps_target << "fps ("sv << max_frametime.count() << "ms)"sv;
auto shutdown_event = mail->event<bool>(mail::shutdown);
auto packets = mail::man->queue<packet_t>(mail::video_packets);