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.
This commit is contained in:
Mariano Abad committed 2026-11-05 16:48:46 -03:00
1 parent 8ee7668a38
commit fd872773b4
1 file changed
+9
+9
View File
@@ -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)