Repository navigation
fix(sender): keep captureActive when the first frame beats startCapture - #222
Merged
swellweb merged 1 commit intoNov 12, 2026
Merged
Conversation
startCapture() is async, and the first encoded frame can arrive while it is suspended. handleFirstEncodedFrame then sets captureActive and sessionAckSent. When startCapture returned, the status was set to captureStartedWaitingFirstFrame unconditionally, overwriting captureActive. handleFirstEncodedFrame runs only once per capture, so the status then read "waiting for the first frame" for the whole stream, although the picture was on the receiver. The watchdog already guards this case (startFirstFrameWatchdog returns when sessionAckSent is true); the status now gets the same guard. Seen on an iMac18,3 receiver: after a picture-preset change or a replug the stream was up, but the status kept saying it was waiting for the picture (3 of 4 preset changes). The first frame was logged 175-375 ms after "pipeline started". Co-Authored-By: Claude Opus 5.5 <[email protected]>
kenshinice-ai
added a commit
to kenshinice-ai/pwe-imac-display
that referenced
this pull request
Oct 27, 2026
…swellweb#222 Co-Authored-By: Claude Opus 5.5 <[email protected]>
kenshinice-ai
added a commit
to kenshinice-ai/pwe-imac-display
that referenced
this pull request
Oct 27, 2026
…b#222 Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 9, 2026
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.
What
When the first encoded frame arrives while
startCapture()is still suspended, the session status ends up ascaptureStartedWaitingFirstFramefor the whole stream. The picture is on the receiver, but the sender keeps saying it is waiting for it.Why
handleFirstEncodedFrame()setssessionAckSentandcaptureActive. AfterstartCapture()returns, the status was set tocaptureStartedWaitingFirstFrameunconditionally, which overwrotecaptureActive.handleFirstEncodedFrame()runs only once per capture, so nothing set it back.startFirstFrameWatchdog()already guards this case withguard !sessionAckSent. This change gives the status line the same guard. It is one condition and a comment; there is no other change in behaviour.Seen
On an iMac18,3 (macOS 13.7.8) receiver with a MacBook Pro sender: after a picture-preset change (5K 48 → 60 → standard → 60), the status stayed at "waiting for the first frame" in 3 of 4 changes, and once after a plain replug. Each time the stream was running and the receiver was decoding. The log showed the first encoded frame 175–375 ms after
pipeline started, inside thestartCapture()suspension.Checked
TBDisplaySenderscheme frommaint-3.6plus this commit (Debug, Xcode on macOS 27): build succeeds, no new warnings.startCapture()returns). With the old line the status ends atcaptureStartedWaitingFirstFrame; with the guard it ends atcaptureActive. That test uses our test hooks, so it is not part of this PR.🤖 Generated with Claude Code