Repository navigation
perf(sender): space keyframes and cap peak rate for 5K 60 - #231
Merged
swellweb merged 1 commit intoNov 12, 2026
Merged
Conversation
The 5K 60 profile emitted a keyframe every second. Each one is a large burst that pushes receiver decode past its frame budget, so the stream stalled exactly at keyframes. For native5k60Experimental only: - keyframe every 4 s (maxKeyFrameIntervalDuration 1 -> 4, maxKeyFrameInterval 60 -> 240) - peak bit rate of 1.5x average (225 Mb/s) via kVTCompressionPropertyKey_DataRateLimits over a 1 s window; if the encoder rejects it we log and continue with average-only (old behaviour) Stable profiles keep their previous tuning (covered by testStableProfilesKeepPreviousEncoderTuning). 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.
Problem
The experimental 5K 60 profile (
native5k60Experimental) emitted a keyframe every second. Each one is a large burst that pushes receiver decode past its frame budget, so the stream stalled exactly at keyframes.Change (5K 60 only)
maxKeyFrameIntervalDuration1 → 4,maxKeyFrameInterval60 → 240.peakBitRateof 1.5 × average (225 Mb/s), applied throughkVTCompressionPropertyKey_DataRateLimitsover a 1 s window. If the encoder rejects it, the sender logs and carries on with average-only (the old behaviour).All other profiles keep their previous tuning. This is covered by the new
testStableProfilesKeepPreviousEncoderTuning, alongsidetest5K60SpacesKeyframesAndCapsPeakRate.Deliberately not included: an earlier version of this change also switched the direct
CGDisplayStreamcapture path from BGRA to NV12/BT.709. That affects every profile on the headless mirror path, and I couldn't test it on hardware, so I've left it out.Testing
Hardware: MacBook Air M5 (macOS 27.0.1) → iMac18,3 27" 5K 2017, macOS Ventura 13.7.8, Thunderbolt Bridge.
DataRateLimits; no fallback log line appeared.CI-equivalent checks on
maint-3.6+ this commit:build_targetbridge_sender_app.sh: BUILD SUCCEEDED.xcodebuild test: 183 tests, 0 failures, including both new tests.test_video_queue_budget.rb: pass.test_permission_status.rb sender: pass.check_localizations.sh: pass.Credits
Patch prepared by Ziyad Asghar. Split from the original change, rebased onto
maint-3.6, built, tested on hardware and measured with Claude Opus 5.5 (Anthropic), credited via theCo-Authored-Bytrailer.