Skip to content

fix(decode): the software host opens the VT decoder only on a proven hardware session (#461) - #542

Merged
superuser404notfound merged 1 commit into
mainfrom
fix/461-sw-host-decoder-verdict
Sep 17, 2026
Merged

superuser404notfound merged 1 commit into
mainfrom
fix/461-sw-host-decoder-verdict

Conversation

@superuser404notfound

Copy link
Copy Markdown
Owner

Refs #461 (cmcpherson274's DV P8.1 escape, sessionCreationFailed(status: -4)).

Defect

SoftwarePlaybackHost chose HardwareVideoDecoder for HEVC whenever VTCapabilityProbe.canHardwareDecode returned true. That probe fails open for the routing gate by design: no extradata, Annex-B extradata, in-band parameter sets and a format-description failure all answer "keep native". HardwareVideoDecoder builds its format description from the hvcC alone and requires hardware with no software fallback, so each of those classes is one it can never open. On a preferredDecodePath = .software correction the throw lands after the teardown and the session ends.

Fix

VTCapabilityProbe.hardwareDecodeVerdict(codecpar:) returns .supported / .unsupported / .unclassifiable(reason:).

  • Routing gate (canHardwareDecode, unchanged behaviour): keeps native unless .unsupported.
  • Software host: opens HardwareVideoDecoder only on .supported, libavcodec otherwise.
  • The four unclassifiable returns now log their reason (they were silent, which is why the reporter's P8.1 log carried no [VTProbe] line).

Measured (aetherctl, M1)

Fixtures from the Dolby P8.1 UHD asset: rewritten with MP4Box :xps_inband (hvcC numOfArrays 0), and remuxed to MPEG-TS (Annex-B extradata). Control: x265 hvc1 with parameter-set arrays.

arm before after
play --sw in-band LOAD FAILED: sessionCreationFailed(status: -4) libavcodec, VERDICT: OK
play --sw TS LOAD FAILED: sessionCreationFailed(status: -4) libavcodec, VERDICT: OK
native load + --reload-applying decode-path=software at 5 s, in-band session ended in error: Decoder session failed (-4) resumed at 5.80 s, playing at 14.05 s
same, TS same error resumed at 5.22 s, playing
play --sw control HardwareVideoDecoder opened unchanged

swift test: XCTest 610 (1 skipped) and swift-testing 2990 green.

🤖 Generated with Claude Code

https://claude.ai/code/session_018837p54rigmt9MMyzSmYXY

…hardware session (#461)

SoftwarePlaybackHost picked HardwareVideoDecoder whenever
VTCapabilityProbe.canHardwareDecode answered true. That probe fails open
for the routing gate on purpose (in-band parameter sets, Annex-B
extradata, no extradata, format description failure keep the native
path), but HardwareVideoDecoder builds from the hvcC alone and has no
software fallback, so every one of those classes threw
sessionCreationFailed(-4) after the teardown. A decode-path correction
onto software on such a source ended the session.

The probe now returns HardwareDecodeVerdict (supported / unsupported /
unclassifiable(reason)). The routing gate keeps native unless the verdict
is unsupported; the software host opens the hardware decoder only when it
is supported. The unclassifiable returns now log their reason.

Measured with aetherctl on the Dolby P8.1 UHD asset rewritten with
in-band xPS and remuxed to MPEG-TS: play --sw and a native load
corrected via --reload-applying decode-path=software both ended in
"Decoder session failed (-4)" before, and play through on libavcodec
after. An out-of-band hvc1 control still opens HardwareVideoDecoder.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_018837p54rigmt9MMyzSmYXY
@superuser404notfound
superuser404notfound merged commit 722e6ae into main Sep 17, 2026
7 checks passed
@superuser404notfound
superuser404notfound deleted the fix/461-sw-host-decoder-verdict branch September 17, 2026 03:21
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