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.
This commit is contained in:
Mariano Abad committed 2026-11-05 21:54:10 -03:00
1 parent fd872773b4
commit de139dc972
1 file changed
+5 -7
+5 -7
View File
@@ -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