Repository navigation
Conversation
…start When an iPad connected in Second screen mode, the host restarted the pipeline and sent no video until the virtual display attached or a 10 s wait ran out, on top of the Enable task. The iPad gives up 10 s after the handshake, so on PCs where the display was slow or never attached it never saw a picture, and over USB every redial turned the display off and on again. The running pipeline now keeps mirroring to the iPad while a separate thread turns the display on, and the stream restarts onto it once it attaches. A viewer leaving does not cancel the start. After a failed start later connections mirror without touching the driver, and the PC shows its notice, until the user clicks Try again, restarts the stream or changes the mode. The display stays on 10 s after its viewer leaves, and the host changes it at most once per 10 s on its own. Each decision logs one line; fallbacks carry second_screen_fallback=<reason> for the diagnostics upload.
… for the driver After the switch, the capture of the virtual display must deliver a real image within 5 s. A display that fails to duplicate, or whose acquisition only times out, goes back to the mirror, counts as a failed start and shows the PC's notice. No black placeholder is sent from it meanwhile, so the iPad keeps the last mirror frame. Capture generations no longer take the driver lock or run driver tasks: a thread turns the display off as well as on, so the mirror never waits behind a slow Enable, also when Try again races a new generation. Every exit of the start thread clears its claim, and a mode change after Enable turns the display back off, so Second screen can no longer stay stuck in Attaching. Try again also recovers a claim with no thread behind it.
…cond screen failed across restarts
…C holding frames back
… and log when the virtual display starts turning off
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In Second screen mode the iPad often showed "Your PC answered, but no picture arrived", and over USB the PC's screen blinked and Windows played device connect and disconnect sounds every 11 seconds until the cable was pulled.
When the iPad connected, the host restarted the stream and sent no video until the virtual display had attached: about 3 s for the Enable task (6 s when a Disable from the previous attempt was still running), then up to 10 s waiting for the display. The iPad gives up 10 s after the handshake when no frame has arrived. On PCs where the display attached slowly or not at all, the iPad left first:
Fix
The fix is host-only and works with the iPad apps already released (0.3.1 and 0.3.2).
second_screen_fallback=attach_timeout|no_frames|duplication_failed|enable_failed|no_driver, and the diagnostics upload already sends every log line, so the backend can count them. The existing "Virtual display attached" and "did not attach in time" lines keep their text.The attach steps moved from
reconcile_virtual_displayintohost/src/capture/second_screen.rs, behind a small driver trait so they can be tested.Tests
capture::second_screenunit tests on a paused clock with a fake driver:e2e_synthetic::usb_framed_stream_end_to_endover one USB tunnel, decoding whole frames:encoder::tests::a_viewer_back_mid_gop_starts_from_the_keyframe_it_asked_forfeeds a real encoder a viewer that leaves mid-GOP and one that comes back at the static second screen's 750 ms cadence, and passes each packet through the transport's first-frame gate. The session must open on the requested frame, which NVENC must return at once. It runs every encoder that opens on the machine: NVENC on an NVIDIA PC, libx264 everywhere. Without the NVENC options it fails on an RTX 5080 (no frame opens the session in 15 s; with only the IDR option, the frame comes out two frames late).