Repository navigation
Give VCP frames the bits for their content interval, not the wait before them (851-4499) - #1508
Merged
Merged
Conversation
Member
Author
|
Proof.
The switch fired in 5 of the 6 video runs on both sides. Scroll and typing never reached it, and test cards did once on this branch. Every cell is valid and nothing is unreadable on either side. Not covered: Tier 2 text fidelity (T8) and the two-Mac tier, which this pair doesn't run. |
…efore them (851-4499) VCP sized each frame by the wall-clock time since the previous one, and the transport admits a frame only while about one interval is unacknowledged, so after the rate switch to VCP one large frame on a link with a real round trip held admission shut and every later frame grew with the wait. The host now stamps each changing tile of a capture with the time since that tile last changed, and VCP's presentation clock (the one VideoToolbox already had) limits each gap to it, between one and two frame intervals. The rate switch copies the request instead of rebuilding it, and re-encodes of an encoded capture carry no interval. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…issions (851-4499) Co-Authored-By: Claude Opus 5.5 <[email protected]>
pondorasti
force-pushed
the
alexandru/851-4499-switch-stall
branch
from
November 27, 2026 09:12
02ff245 to
3b436ea
Compare
This was referenced Nov 27, 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.
Fixes 851-4499 (host drops most new frames after the rate switch to VCP). Found while measuring 851-4477.
Cause
VCP gave each frame the bits for the wall-clock time since the previous one. The transport only admits a frame while about one interval of the estimate is unacknowledged. On a link with a real round trip the two fed each other:
Host counters every half second in the stall: the encoder still writes its set bitrate (1.7–2.2 MB per half second), but only 2–10 frames go out and about 28 captures are replaced before encode. Lifting VCP's QP cap changed nothing. VideoToolbox never had the problem because its sessions already stamp frames at most two intervals apart (851-4063).
Change
contentIntervalsNs). A capture that changed nothing keeps the intervals of the one it replaces. A capture that's already been encoded carries none, so its refinement passes, refreshes and retries carry none.ScreenSharingEncoderPresentationClock). Each gap is limited to the tile's content interval, kept between one and two frame intervals and never more than the real gap. With no interval, and for every keyframe or reference refresh, the limit is VideoToolbox's two intervals.repeatedTiles) carries no interval, and the rate switch's copy keepsrepeatedTilestoo.A flat one-interval limit fixed the stall too, but it would have halved the bits of 30 fps video (captures that change every other frame) on every link. A flat two-interval limit only half fixed it.
Tests (each fails without the change)
ScreenSharingV2HostContentIntervalTests(new): replaced captures carry the content's interval, not the wait. Unchanged captures don't restart it. Each tile has its own interval. Only reported touches restamp a waiting tile. A replaced interval survives a capture that changed nothing. Refinements and refreshes carry none.ScreenSharingEncoderPresentationClockTests: the content-interval limit and the 1/240 s floor.ScreenSharingVCPEncoderStateTests: a frame that waited is stamped one content interval later. A refresh gets two intervals, on a refinement plan too. A refinement pass keeps its whole wall-clock wait. An abandoned submission leaves the clock where it was.ScreenSharingRateSwitchedTileEncoderTests: the switch's forced keyframe keeps every other request field.ScreenSharingVCPEngineTests(hardware, real VCP session): submissions 250 ms apart on an injected clock, with content changing every frame, come out at about 34 KB, two intervals' worth, against 80 KB on wall-clock stamping. The limit is three intervals. The test takes no real time.Swift tests run locally (M1 Pro, with timeouts):
ScreenSharingV2Tests(203 tests after the rebase onto #1504, including the serialized hardware encoder suites on VCP and VideoToolbox) andCodevisorBenchTests(58), all passing.Measured
Review findings left
🤖 Generated with Claude Code