From de139dc97248724eaeec0015f876e2b5988a3b10 Mon Sep 17 00:00:00 2001 From: Mariano Abad Date: Thu, 5 Nov 2026 21:54:10 -0300 Subject: [PATCH] drm: switch for any new subscriber on a still screen In the WouldBlock arm nothing is sent after the check, so also switch when the last active subscriber has left and a new one is pending: the snapshot would promote it with no frame ever following. Log the expected event at trace level. --- src/server/video_service.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/server/video_service.rs b/src/server/video_service.rs index abdc2187a..198d964cc 100644 --- a/src/server/video_service.rs +++ b/src/server/video_service.rs @@ -901,13 +901,11 @@ fn run(vs: VideoService) -> ResultType<()> { match res { Err(ref e) if e.kind() == WouldBlock => { // A still screen may never reach handle_one_frame, which is where a subscriber - // added without a refresh (mobile display switch) is otherwise noticed. - sp.snapshot(|sps| { - if sps.has_subscribes() { - log::info!("switch due to new subscriber"); - bail!("SWITCH"); - } - Ok(()) + // added without a refresh (mobile display switch) is otherwise noticed. Nothing + // is sent here, so switch even when the old subscribers are gone. + sp.snapshot(|_| { + log::trace!("switch due to new subscriber"); + bail!("SWITCH"); })?; #[cfg(windows)] if dxgi_recovery_started