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.
This commit is contained in:
columbarius 2022-03-03 01:02:12 +01:00
parent 10a07f7e90
commit 21d26fe23e
1 changed files with 7 additions and 1 deletions

View File

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