From cd30bd0f8e14f2fe9246d4893e0869b0d8687dfb Mon Sep 17 00:00:00 2001 From: columbarius Date: Thu, 4 Nov 2021 01:58:44 +0100 Subject: [PATCH] screencast: don't fail when copy_buffer was unsuccessfull When a buffer is destroyed while used in the copy_buffer request the screencopy protocoll will answer with the failed event. This can happen anytime when PipeWire calls the remove_buffer callback, eg. on renegotiation. This is not fatal, so we don't need to close the screencast. cast->err should only be used for fatal errors. --- src/screencast/wlr_screencast.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/screencast/wlr_screencast.c b/src/screencast/wlr_screencast.c index af57d33..4b24f15 100644 --- a/src/screencast/wlr_screencast.c +++ b/src/screencast/wlr_screencast.c @@ -69,6 +69,12 @@ void xdpw_wlr_frame_finish(struct xdpw_screencast_instance *cast) { void xdpw_wlr_frame_start(struct xdpw_screencast_instance *cast) { logprint(TRACE, "wlroots: start screencopy"); + if (cast->err) { + logprint(ERROR, "wlroots: nonrecoverable error has happened. shutting down instance"); + xdpw_screencast_instance_destroy(cast); + return ; + } + if (cast->pwr_stream_state) { xdpw_pwr_dequeue_buffer(cast); @@ -195,7 +201,6 @@ static void wlr_frame_failed(void *data, struct xdpw_screencast_instance *cast = data; logprint(TRACE, "wlroots: failed event handler"); - cast->err = true; cast->frame_state = XDPW_FRAME_STATE_FAILED;