Skip to content

fix(video): cap the declared HEVC level at 5.1 and derive DV CODECS from the hvcC (#674) - #677

Merged
superuser404notfound merged 2 commits into
mainfrom
fix/674-hevc-level-cap
Sep 30, 2026
Merged

superuser404notfound merged 2 commits into
mainfrom
fix/674-hevc-level-cap

Conversation

@superuser404notfound

Copy link
Copy Markdown
Owner

Fixes the DV master refusal reported in #674.

A DV Profile 8.1 MKV whose hvcC states level 5.2 (156) on a 1080p24 picture had that level copied into the master's CODECS. An Apple TV 4K refuses a 5.2 declaration with -11848 / CoreMedia -15517, on the DV master and the reduced HDR master alike, so the session ended on the media playlist with Dolby Vision dropped.

  • Reporter's commit (cd579ab, @gonkowonko): caps the level declared from the hvcC at 5.1 (L153) and routes the DV branches (P8.1, P8.4, P7) through plainHEVCCodecs, so they carry the hvcC's constraint bytes like the plain HEVC route has since AE#187. Device-verified by the reporter: the DV master is accepted and the panel engages Dolby Vision.
  • Follow-up (c415e2d): the cap is one named constant, maxDeclaredHEVCLevel, and also applies to the hvc1.2.4.L<level> fallback taken without a parseable hvcC. Adds Issue674HEVCLevelCapTests.

The init segment's hvcC keeps its stated level; only the manifest attribute changes. A stream that genuinely needs more than 5.1 would end on the media playlist either way, where nothing is declared.

swift test: XCTest 654 passed (1 skipped), swift-testing 3937 passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WJcXkGQrMiBPixVEFTSBJS

gonkowonko and others added 2 commits September 30, 2026 20:52
A Dolby Vision Profile 8.1 source whose hvcC states level 5.2 (156) had its
master and reduced HDR master refused on Apple TV 4K with -11848 / CoreMedia
-15517, falling back to the media playlist with the DV upgrade dropped. The
stream was 1080p24; capping the declared level at L153 lets the DV master play.

The DV branches of resolveCodecRoute also hardcoded hvc1.2.4.L<level>, dropping
the constraint bytes the plain-HEVC branch has derived from the hvcC since
AE#187. They now go through plainHEVCCodecs like that branch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Follow-up to the reporter's commit. The level cap sat only in the hvcC
builder, so a source without a parseable hvcC still declared its
codecpar level verbatim through the hvc1.2.4.L<level> fallback. The cap
is now one named constant, maxDeclaredHEVCLevel, applied to both.

Tests pin the reporter's hvcC (level 156 -> hvc1.2.4.L153.90), levels up
to 5.1 declared as stated, and the DV Profile 8.1 route with and without
an hvcC.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WJcXkGQrMiBPixVEFTSBJS
@superuser404notfound
superuser404notfound merged commit 0f8fb1b into main Sep 30, 2026
4 checks passed
@superuser404notfound
superuser404notfound deleted the fix/674-hevc-level-cap branch September 30, 2026 19:05
@superuser404notfound

Copy link
Copy Markdown
Owner Author

Thanks @gonkowonko, the diagnosis and the device-tested fix made this a quick one. Your commit went in as is, with a follow-up that applies the same cap to the fallback taken without a parseable hvcC and pins the case in tests. Shipped in 7.23.2.

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.

2 participants