Skip to content

Verify Windows virtual display capture before launch or resume - #819

Open
Roboatlas21 wants to merge 1 commit into
Nonary:canaryfrom
Roboatlas21:fix/windows-virtual-display-capture-readiness
Open

Roboatlas21 wants to merge 1 commit into
Nonary:canaryfrom
Roboatlas21:fix/windows-virtual-display-capture-readiness

Conversation

@Roboatlas21

Copy link
Copy Markdown

Problem

On Windows, the capture check for launch and resume could succeed on the physical desktop while the session’s virtual display was still missing. Vibepollo would accept the connection, leaving the client waiting for video from a display Windows had yet to make available for capture.

In one failed launch, the client connected at 09:47:27.274. The requested display was missing from the capture list, and capture only became available at 09:47:39.845. That was 12.6 seconds after connection, past the 10-second startup limit used by Moonlight’s shared video code. The client recorded zero decoded frames during the test.

Change

Resolve the session’s virtual display to its active Windows output and probe that exact output before accepting launch or resume. If the display is missing or disappears while capture opens, use the existing bounded recovery attempt and check the session’s display again. If it remains unavailable, return a retryable GameStream 503 with a clear error message.

Validation

  • Regression tests. The original Canary code failed the exact-output assertion when the session’s virtual display was missing. The patched tests passed for a missing target, a target disappearing during capture open, and a target still unavailable after recovery.
  • Live Windows test. A fresh launch and a resume both delivered 4K60 HDR10. The display helper completed setup before the host accepted each connection. Server-side request handling took 2.64 seconds for launch and 1.42 seconds for resume. Normal exit restored the Windows physical monitor at 2560×1440.

Attached logs

virtual-display-before.txt
virtual-display-live-validation.txt
virtual-display-regression.txt

The capture check can pass on the physical desktop while the session's
virtual display is still missing. Moonlight then connects and times out
waiting for video.

Probe the session's active virtual display directly. If it is missing or
disappears during capture setup, retry the check after the existing
recovery attempt. Return a retryable error if capture is still unavailable.

Nonary commented Dec 3, 2026

Copy link
Copy Markdown
Owner

Please keep the exact-output check and the bounded attempt to recover the virtual display. Before merging, I’d like launch and resume to fall back to a working physical monitor and reserve a capture-related 503 for the case where there’s nothing to capture. That preserves the existing physical fallback when creation reports success but Windows never makes the virtual screen usable.

I found two gaps in probe_session_capture by exercising the production recovery code with simulated Windows outcomes:

  • When neither virtual device lookup returned a name, recovery rejected the session with zero capture opens, even though the physical monitor was available. A failed identity lookup alone can’t establish that capture is unavailable.
  • When the virtual target disappeared during an open that returned success, the session was admitted. The identity recheck currently runs only on capture_failed. Windows Graphics Capture also initializes its helper on the first snapshot, so a successful open can still leave the client waiting for video. Probe logic · WGC first snapshot

When physical capture works, please give virtual setup and recovery one shared five-second budget. Switch sooner if recovery fails early. Select the physical monitor as the session’s actual capture target, send the existing fallback warning, and cancel that session’s pending virtual recovery so a late virtual display can’t take over the stream. On a headless host, preserve bounded virtual recovery. In a controlled-clock test, a virtual display ready at 4.5 seconds succeeded under either policy. One ready at 6 seconds succeeded with the current recovery path, while a hard five-second cutoff rejected it before the capture check.

The Windows case I’d like covered is a fresh launch and a resume with the virtual screen missing and a physical monitor available. Verify the client receives a frame from that monitor, record the time to the first decoded frame, and bring the virtual screen back to confirm the stream stays on physical. Please also cover a headless host whose virtual screen appears after five seconds and the case where neither output can be captured.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants