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.
This commit is contained in:
columbarius 2021-11-04 01:58:44 +01:00
parent 35cba50409
commit cd30bd0f8e

View file

@ -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;