From 5799adeb57c8ccefaa21d483b9a027095c893b6d Mon Sep 17 00:00:00 2001 From: columbarius Date: Sun, 24 Apr 2022 11:59:44 +0200 Subject: [PATCH] screencast: enqueue pipewire when screencopy failed Keeping a buffer when the copy failed has the risk of having this buffer removed while we wait for the next buffer_done event. To prevent this we just enqueue the buffer marking it as corrupt. A new buffer will be dequeued at the buffer_done event. --- src/screencast/wlr_screencast.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/screencast/wlr_screencast.c b/src/screencast/wlr_screencast.c index 3a44923..70d391e 100644 --- a/src/screencast/wlr_screencast.c +++ b/src/screencast/wlr_screencast.c @@ -50,6 +50,10 @@ void xdpw_wlr_frame_finish(struct xdpw_screencast_instance *cast) { pwr_update_stream_param(cast); } + if (cast->frame_state == XDPW_FRAME_STATE_FAILED) { + xdpw_pwr_enqueue_buffer(cast); + } + if (cast->frame_state == XDPW_FRAME_STATE_SUCCESS) { xdpw_pwr_enqueue_buffer(cast); uint64_t delay_ns = fps_limit_measure_end(&cast->fps_limit, cast->framerate);