mirror of
https://github.com/hyprwm/xdg-desktop-portal-hyprland.git
synced 2024-11-26 07:55:58 +01:00
screencast: use dequeue/enqueue functions instead of on_process event to interact with pipewire
This commit is contained in:
parent
4b03a5acfd
commit
11de00735f
1 changed files with 11 additions and 4 deletions
|
@ -127,6 +127,14 @@ static void wlr_frame_buffer_done(void *data,
|
||||||
|
|
||||||
logprint(TRACE, "wlroots: buffer_done event handler");
|
logprint(TRACE, "wlroots: buffer_done event handler");
|
||||||
|
|
||||||
|
if (!cast->quit && !cast->err && cast->pwr_stream_state) {
|
||||||
|
xdpw_pwr_dequeue_buffer(cast);
|
||||||
|
if (!cast->current_pw_buffer) {
|
||||||
|
xdpw_wlr_frame_free(cast);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
zwlr_screencopy_frame_v1_copy_with_damage(frame, cast->simple_frame.buffer);
|
zwlr_screencopy_frame_v1_copy_with_damage(frame, cast->simple_frame.buffer);
|
||||||
logprint(TRACE, "wlroots: frame copied");
|
logprint(TRACE, "wlroots: frame copied");
|
||||||
|
|
||||||
|
@ -182,10 +190,7 @@ static void wlr_frame_ready(void *data, struct zwlr_screencopy_frame_v1 *frame,
|
||||||
cast->simple_frame.tv_sec = ((((uint64_t)tv_sec_hi) << 32) | tv_sec_lo);
|
cast->simple_frame.tv_sec = ((((uint64_t)tv_sec_hi) << 32) | tv_sec_lo);
|
||||||
cast->simple_frame.tv_nsec = tv_nsec;
|
cast->simple_frame.tv_nsec = tv_nsec;
|
||||||
|
|
||||||
if (!cast->quit && !cast->err && cast->pwr_stream_state) {
|
xdpw_pwr_enqueue_buffer(cast);
|
||||||
pw_loop_signal_event(cast->ctx->state->pw_loop, cast->event);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
xdpw_wlr_frame_free(cast);
|
xdpw_wlr_frame_free(cast);
|
||||||
}
|
}
|
||||||
|
@ -197,6 +202,8 @@ static void wlr_frame_failed(void *data,
|
||||||
logprint(TRACE, "wlroots: failed event handler");
|
logprint(TRACE, "wlroots: failed event handler");
|
||||||
cast->err = true;
|
cast->err = true;
|
||||||
|
|
||||||
|
xdpw_pwr_enqueue_buffer(cast);
|
||||||
|
|
||||||
xdpw_wlr_frame_free(cast);
|
xdpw_wlr_frame_free(cast);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue