Skip to content

fix(hdr10+): carry HDR10+ on the software path - #814

Open
williamliu0516 wants to merge 3 commits into
superuser404notfound:mainfrom
williamliu0516:pr/hdr10plus-software-path
Open

williamliu0516 wants to merge 3 commits into
superuser404notfound:mainfrom
williamliu0516:pr/hdr10plus-software-path

Conversation

@williamliu0516

Copy link
Copy Markdown
Contributor

What

HDR10+ now reaches the display when a title plays on the software path.

  • VideoToolbox decoder: HardwareVideoDecoder never read the ST 2094-40 SEI (its onFirstHDR10PlusDetected was declared but never fired), so a PQ HEVC title with HDR10+ showed as HDR10 and no frame had per-frame metadata. It now reads each packet's T.35 message (PQ streams only), holds it until VideoToolbox outputs that frame, and passes it on as kCMSampleAttachmentKey_HDR10PlusPerFrameData. It also reports .hdr10Plus.
  • libavcodec decoder: it did attach a payload, but made with av_dynamic_hdr_plus_to_t35, which leaves out the six T.35 header bytes (B5 00 3C 00 01 04). Apple documents that the attachment starts at the country code, so the header now goes back in front.

The loopback path is unchanged and needed nothing.

Why

HDR10+ files are common (most streaming-service WEB-DLs carry it), and on the software path they lost their per-frame metadata.

Tested

  • A 1080p HDR10+ test clip with two scenes, each with its own metadata. On the loopback path, all 144 messages are in the served fragments from MKV, MP4 and MPEG-TS, and AVPlayerItemVideoOutput gets HDR10+ on every frame (macOS 27). That path was already fine.
  • aetherctl play --sw on the same clip: it now logs the .hdr10Plus upgrade and the renderer's per-frame attachments (64 bytes each, the same as AVPlayer's own decoder gives).
  • New HDR10PlusMetadataScanTests case: the payload comes out the same from SEI (Annex B and length-prefixed, H.264 and HEVC) and from Matroska side data. The HDR10+ and decoder suites pass.

… and both decoders attach it in Core Media's shape

A PQ HEVC title with ST 2094-40 SEI played on the software path as plain HDR10: HardwareVideoDecoder
never read the SEI (its onFirstHDR10PlusDetected was declared and never fired), so videoFormat stayed
.hdr10 and no frame carried kCMSampleAttachmentKey_HDR10PlusPerFrameData. It now takes each packet's
validated T.35 message (HDR10PlusMetadataScan.coreMediaPayload, PQ streams only), keeps it under the
packet's presentation time until VideoToolbox outputs that frame, and passes it to the renderer, which
already attaches it. SoftwareVideoDecoder attached a payload per frame, but serialised with
av_dynamic_hdr_plus_to_t35, which omits the six T.35 header bytes the attachment is documented to start
with; the header is put back.

The loopback path is unchanged and needs nothing: with a two-scene 1080p HDR10+ fixture, every one of
144 messages is in the served fragments from MKV, MP4 and MPEG-TS (hdr10plus_tool extract identical to
the source), and AVPlayerItemVideoOutput's buffers carry HDR10+ per frame, scene 2's values on scene 2.
`aetherctl play --sw` on the same file now logs the .hdr10Plus upgrade and the renderer's attachments.
Resolves the CHANGELOG conflict: the HDR10+ software-path entry goes first under Unreleased › Fixed, beside main's newer entries. No code conflicted; main has no other change to the HDR10+ paths since the branch point.
Picks up superuser404notfound#809, which bounds "a stream refused for longer than the budget"
from below and needs 2 refused attempts instead of 3: this branch's CI
failed only there, with 2. CHANGELOG.md merged cleanly but left the entry
under 7.43.0; it moves to [Unreleased] > Fixed, after the 7.45.0 prep. No
code conflicted.
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