Fix HDR start crash: pick the capture pixel format after the output attaches#82
Merged
Conversation
Every HDR stream start aborted (issue #81): x420 was assigned to the video output's videoSettings before the output joined the session, and a detached output only advertises the generic 8-bit formats — setting a format outside availableVideoPixelFormatTypes raises an NSException Swift cannot catch. The output now attaches first, x420 is gated on actually appearing in the available list, and when it doesn't the whole graph reconfigures as SDR instead of crashing or wrapping 8-bit frames in an HLG-tagged Main10 encode. configure() returns the colour it delivered, and Streamer builds the encoder, VIDEO_CONFIG, and STATE from that instead of the requested colour, so a degrade is honest on the wire. SDR-only behaviour is unchanged. Fixes #81 Release-Bump: minor Release-Beta: true Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015dWUcqAkNNuNELnMPS4RdT
MyNamesEMurray
enabled auto-merge
July 25, 2026 09:19
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 & why
Fixes #81 — every HDR stream start in v1.9.0-beta.1 aborted with an uncatchable NSException from
-[AVCaptureVideoDataOutput setVideoSettings:]. The 10-bit pixel format (x420) was assigned while the output was still detached from the capture session, and a detached output only advertises the generic 8-bit formats;x420entersavailableVideoPixelFormatTypesonly once the output is connected to a device whose active format is 10-bit.Three changes, all in the iOS app:
x420is gated on actually appearing inavailableVideoPixelFormatTypes; if it doesn't, the whole capture graph reconfigures as SDR (nested begin/commit, full re-run) instead of crashing — or worse, silently wrapping 8-bit frames in an HLG-tagged Main10 encode that would reach OBS with wrong colours.configure()now returns the colour it actually delivered, andStreamerbuilds the encoder, VIDEO_CONFIG, and STATE from that instead of the requested colour, so a degrade is honest on the wire.SDR-only behaviour is unchanged (
420vis always in the generic list, which is why this ordering never bit before).How it was tested
syntax-check.sh; the full type check runs in CI's macOS job.🤖 Generated with Claude Code
https://claude.ai/code/session_015dWUcqAkNNuNELnMPS4RdT
Generated by Claude Code