Skip to content

Fix HDR start crash: pick the capture pixel format after the output attaches#82

Merged
MyNamesEMurray merged 1 commit into
mainfrom
claude/init-lklchz
Jul 25, 2026
Merged

Fix HDR start crash: pick the capture pixel format after the output attaches#82
MyNamesEMurray merged 1 commit into
mainfrom
claude/init-lklchz

Conversation

@MyNamesEMurray

Copy link
Copy Markdown
Owner

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; x420 enters availableVideoPixelFormatTypes only once the output is connected to a device whose active format is 10-bit.

Three changes, all in the iOS app:

  • The output now joins the session before its pixel format is chosen.
  • x420 is gated on actually appearing in availableVideoPixelFormatTypes; 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, 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 (420v is always in the generic list, which is why this ordering never bit before).

How it was tested

  • Swift sources parse clean via syntax-check.sh; the full type check runs in CI's macOS job.
  • The crash itself needs a live device to reproduce: needs a re-test of the exact issue [TestFlight] Crash on iPhone16_1, iOS 27.0 (build 1047) #81 scenario — HDR toggle on, 4K60, Main rear camera, iPhone 15 Pro / iOS 27 — expecting a working HDR stream (or a visible SDR degrade, never an abort).

🤖 Generated with Claude Code

https://claude.ai/code/session_015dWUcqAkNNuNELnMPS4RdT


Generated by Claude Code

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
MyNamesEMurray enabled auto-merge July 25, 2026 09:19
@MyNamesEMurray
MyNamesEMurray merged commit 383846e into main Jul 25, 2026
6 checks passed
@MyNamesEMurray
MyNamesEMurray deleted the claude/init-lklchz branch July 25, 2026 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TestFlight] Crash on iPhone16_1, iOS 27.0 (build 1047)

2 participants