mirror of
https://github.com/hyprwm/xdg-desktop-portal-hyprland.git
synced 2024-11-22 14:35:57 +01:00
screencast: only restart wlroots loop if stream is active
This prevents the wlroots loop from running after the first roundtrip to query the buffer informations from the screencopy protocol.
This commit is contained in:
parent
f77b751649
commit
fc85f6738b
2 changed files with 11 additions and 6 deletions
|
@ -72,6 +72,9 @@ static void pwr_handle_stream_state_changed(void *data,
|
|||
switch (state) {
|
||||
case PW_STREAM_STATE_STREAMING:
|
||||
cast->pwr_stream_state = true;
|
||||
if (!cast->wlr_frame) {
|
||||
xdpw_wlr_register_cb(cast);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
cast->pwr_stream_state = false;
|
||||
|
|
|
@ -52,12 +52,14 @@ void xdpw_wlr_frame_free(struct xdpw_screencast_instance *cast) {
|
|||
return ;
|
||||
}
|
||||
|
||||
uint64_t delay_ns = fps_limit_measure_end(&cast->fps_limit, cast->framerate);
|
||||
if (delay_ns > 0) {
|
||||
xdpw_add_timer(cast->ctx->state, delay_ns,
|
||||
(xdpw_event_loop_timer_func_t) xdpw_wlr_register_cb, cast);
|
||||
} else {
|
||||
xdpw_wlr_register_cb(cast);
|
||||
if (cast->pwr_stream_state) {
|
||||
uint64_t delay_ns = fps_limit_measure_end(&cast->fps_limit, cast->framerate);
|
||||
if (delay_ns > 0) {
|
||||
xdpw_add_timer(cast->ctx->state, delay_ns,
|
||||
(xdpw_event_loop_timer_func_t) xdpw_wlr_register_cb, cast);
|
||||
} else {
|
||||
xdpw_wlr_register_cb(cast);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue