Skip to content

fix(ios): correct progress, duration, frame drops and HDR colours in compressWithBitrate - #17

Merged
thangdevalone merged 1 commit into
mainfrom
fix/ios-compress-followups
Nov 19, 2026
Merged

thangdevalone merged 1 commit into
mainfrom
fix/ios-compress-followups

Conversation

@thangdevalone

Copy link
Copy Markdown
Owner

What

Follow-ups to #15 in compressWithBitrate; the per-frame autorelease pool is unchanged.

  • Progress is measured from the reader's timeRange start. A range that didn't start at 0 jumped straight to 95% on the first frame.
  • Result duration is the compressed range instead of the whole asset.
  • Resize path: a failed pixel buffer allocation now fails the export (with the CVReturn in the error) instead of silently dropping the frame.
  • HDR colours: the reader asks the decoder for BT.709 and the writer tags BT.709. HDR (HLG/PQ) sources used to come out as 8-bit H.264 tagged BT.2020/HLG (no resize) or with no colour tags (resize).
  • Audio loop drains an autorelease pool per sample, like the video loop.

Testing

compressWithBitrate copied unchanged into a macOS harness, run on generated 4 s 1080p30 clips (H.264 SDR and HEVC Main10 HLG), range 1–3 s, 2 Mbps, maxWidth 1280 and 0, audio muted:

Before (main) After
First progress 0.5 0.0
Result duration 4000 ms 2000 ms
HLG source → output tags none (resize) / BT.2020 HLG (no resize) BT.709

Output duration is 2.0 s in every case. The iOS sources typecheck against the iOS simulator SDK. Not run on a device; the harness doesn't measure memory.

🤖 Generated with Claude Code

…compressWithBitrate

- Progress is measured from the reader's timeRange start, so a range that
  doesn't start at 0 no longer jumps straight to 95%.
- The result's duration is the compressed range, not the whole asset.
- A failed pixel buffer allocation on the resize path now fails the export
  instead of silently dropping the frame.
- HDR sources are decoded to BT.709 and the output is tagged BT.709, so
  8-bit H.264 no longer carries BT.2020/HLG tags or no tags at all.
- The audio loop drains an autorelease pool per sample, like the video loop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thangdevalone
thangdevalone merged commit 37a3cf3 into main Nov 19, 2026
3 checks passed
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.

1 participant