From fd872773b46073bdcc6825ef55d59481e19508eb Mon Sep 17 00:00:00 2001 From: Mariano Abad Date: Thu, 5 Nov 2026 15:09:44 -0300 Subject: [PATCH] drm: notice a new subscriber while the screen is still Once a still screen has used up its repeats and the static refresh budget, the WouldBlock arm no longer reaches handle_one_frame or a static refresh encode, where a subscriber added without a refresh (the mobile display switch) is noticed. That client got no picture until the screen changed. Run the same new-subscriber check at the top of the WouldBlock arm. --- src/server/video_service.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/server/video_service.rs b/src/server/video_service.rs index a13aebb52..abdc2187a 100644 --- a/src/server/video_service.rs +++ b/src/server/video_service.rs @@ -900,6 +900,15 @@ 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(()) + })?; #[cfg(windows)] if dxgi_recovery_started .map(|started| started.elapsed() >= DXGI_RECOVERY_FRAME_GRACE)