From 21d26fe23eca690cfbdabb114ad97eb14147f800 Mon Sep 17 00:00:00 2001 From: columbarius Date: Thu, 3 Mar 2022 01:02:12 +0100 Subject: [PATCH] session: destroy screencast_instance directly when paused A PipeWire client might pause the stream which enables us to stop requesting buffers from the compositor. In this case the the quit bool won't be enacted on and thus we should destroy it directly from here. --- src/core/session.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/session.c b/src/core/session.c index 0a3884d..54655e5 100644 --- a/src/core/session.c +++ b/src/core/session.c @@ -68,7 +68,13 @@ void xdpw_session_destroy(struct xdpw_session *sess) { logprint(DEBUG, "xdpw: screencast instance %p now has %d references", cast, cast->refcount); if (cast->refcount < 1) { - cast->quit = true; + if (cast->frame_state == XDPW_FRAME_STATE_NONE) { + logprint(TRACE, "xdpw: screencast instance not streaming, destroy it"); + xdpw_screencast_instance_destroy(cast); + } else { + logprint(TRACE, "xdpw: screencast instance still streaming, set quit flag"); + cast->quit = true; + } } }