Skip to content

A per-session native→software decode escape for the formats VTCapabilityProbe deliberately cannot classify #461

Closed

Description

@cmcpherson274

Same context as the reload-with-options ask filed alongside this one: closed-source tvOS Jellyfin client, pinned 6.60.0 (771d8592). AetherEngine is the shipped engine for VOD, live TV and the guide's picture-in-guide. TVVLCKit — the last engine we could hand a struggling session to mid-flight — is being removed this cycle. What remains beside AetherEngine is an AVPlayer rung (our HLS/fallback leg, multiview tiles) and Jellyfin's server-side transcode; both are demote destinations reached by tearing the session down and starting the item over, and for two of the three cases below AVPlayer rides the same VideoToolbox decoder and the same audio-compat set, so it is not an alternative decoder either. Every one of those answers costs the viewer a visible restart. These are three places where an IN-PLACE answer would have to come from your API.

What the code says. VTCapabilityProbe.canHardwareDecode fails open by design and says so
(Video/VTCapabilityProbe.swift:32-34; the four return true sites are :48 no extradata, :52
Annex-B, :61 no in-band parameter sets in the config record, :77 format-description build
failure). Right default; not asking for it to change. On a VOD load those four classes reach
VideoRoutingPolicy.forcesSoftwareForUndecodableFormat (Decoder/VideoRoutingPolicy.swift:113)
as "hardware-decodable" and the gate keeps the native path — consulted at most once per load,
at AetherEngine.swift:3698, behind the !useSoftwarePath, !options.isLive, probeOpened guard at
:3694 (a live load never reaches the gate at all; the native path is kept without a
classification step). Either way, if VideoToolbox then cannot build a decoder for what arrives,
the item reaches readyToPlay and renders nothing. The in-band-parameter-sets class (:61) is the
one where the deciding evidence genuinely is not present at load time.

Detection is not the gap. AVPlayerItemVideoOutput.hasNewPixelBuffer on the native path and
softwareHostFramesEnqueued on the software one (AetherEngine+Diagnostics.swift:446/:454) —
we already attach a video output for another feature and can see "ready, playing, no picture".

The escape is the gap — with one route that exists, priced. No LoadOptions field selects
the decode path (PlayerState.swift:208-572 is the whole struct; the nearest thing,
deinterlaceMode at :482, is the software path's filter, not the route). Two levers exist
today:

  • setForceSoftwarePathForTesting(_:) (AetherEngine.swift:1120, backing :1117, consumed :3744),
    documented test-only — correctly: it is process-global, so on our stack it would drag the
    guide's ambient engine and any concurrent tile to software with the one session that needs
    it, and it fails DV Profile 5 outright (softwarePathCannotRepresent,
    VideoRoutingPolicy.swift:135 → the throw at AetherEngine.swift:3774).
  • A per-session route that is not an API: a VOD source the demuxer cannot seek is forced to
    software (:3729-3741, "source is forward-only, forcing software path"), which a host reaches by
    presenting an IOReader whose seek(offset: 0, whence: SEEK_SET) fails
    (Demuxer/CustomIOReaderBridge.swift:92 makes seekability the host's answer; Demuxer.swift:230
    carries it) — LoadOptions.sequentialOrigin (PlayerState.swift:384) exists precisely to opt
    archives out of it. So the honest statement is not that we cannot get a session onto
    SoftwarePlaybackHost; it is that the only way costs us the source: no seeking, no mid-play
    audio switch (:5357) or title switch (:5397) on that session, and reloadAtCurrentPosition()
    itself is gated off (guard customSourceIsSeekable, :4055) — so it also un-composes with ask
    (a) — while DV Profile 5 still hard-fails on arrival (:3758-3774). The branch is VOD-only
    (!options.isLive), so it does not exist for our live rung at all.

The START case is covered on our side (our 60/240 s start deadline → start timeout → our ladder
demotes the item off the rung for the next start). The MID-PLAY version — a stream whose in-band
parameter sets turn into something VideoToolbox cannot decode after the picture has been running
— has no in-place answer once the second engine is gone: the only route left is to tear the
session down and restart the item on the demoted rung (a server transcode), i.e. the viewer
watches the picture drop and rebuild mid-scene.

The ask. A per-session way to say "serve this source through SoftwarePlaybackHost",
scoped to the session and without lobotomising the source: a LoadOptions field
(preferredDecodePath / forcesSoftwareDecodePath; 6.58.0's forceDolbyVisionOnNonDVDisplay is
the precedent for adding one), composing with (a) into an in-place correction. An engine-side
detector would be better still but is a bigger ask; the lever is the piece a host cannot build
without paying the seek axis for it.

What we have and have not measured. No mid-play wall reproduced on our stack (our Apple TV
4K hardware-decodes what we own; the High 4:2:2 / Rext material in the library is small). This
is code-anchored plus an engine we are removing, not a field repro — say so if you want a
fixture first (an hev1 remux with in-band parameter sets over a Rext stream is the shape we
would aim at). For calibration: the engine we are dropping detected this class off libVLC's error
stream (20 decoder-module error lines within 1.0 s of each other) and answered with an in-place
rebuild with hardware decode off — a heuristic that only ever ran while libVLC was the decoder.
We are not asking for that heuristic — only for the lever.

Filed as groundwork for the removal of our second engine (three related asks, filed separately so each can move on its own).

Activity

  1. superuser404notfound commented on Sep 2, 2026

    @superuser404notfound
    Owner

    Shipped in 6.64.0 as LoadOptions.preferredDecodePath (.automatic / .software).

    options.preferredDecodePath = .software                                          // at load
    try await player.reloadAtCurrentPosition { $0.preferredDecodePath = .software }  // mid-play, via #460

    Thank you for separating the detection from the escape in the write-up. That framing is what made the scope obvious: hasNewPixelBuffer against softwareHostFramesEnqueued was never the gap, and pricing the IOReader route honestly (rather than calling it impossible) is what showed that its cost is the source's whole seek axis, including the reload it would have to compose with.

    Not VOD-only. The lever sits outside every !options.isLive guard, so it applies to the live rung too. That was the deciding argument for placing it where it is rather than next to the #2 gate: a live load never reaches a classification step at all, so live had no escape, no probe verdict, and nothing to correct.

    One-way, and the missing case is the guarantee. DecodePath has no .native. Every route the engine sends to software it sends there because the native path cannot serve it (AV1 without hardware decode, VP9, a forward-only source, MVC carriage, a format VideoToolbox cannot hardware-decode), so a native preference would only ever buy a black screen. A host's evidence is always "this native session is not decoding" and never the reverse. A test pins that the type stays two-cased, so if a .native is ever added the one-way claim has to be revisited with it rather than quietly lost.

    It does not suspend what the software path cannot represent, and it should not. Forcing software on a source whose only signal is IPT-PQ-c2 (HEVC P5, AV1 P10.0) still fails the load with dolbyVisionUnplayableOnSoftwarePath instead of decoding as YCbCr and rendering green/purple. A demuxed-audio live source still fails rather than playing silent. An override says which host serves the session, not what that host can do, and there is a test on exactly that, because it is the change one would most plausibly have written straight through those guards.

    One case where it does nothing, stated because it would otherwise look applied: on nativeRemoteHLS the engine demuxes and decodes nothing (AVPlayer plays the remote playlist), so there is no decode path to prefer. The engine logs that it ignored the preference.

    Measured on a 300 s H.264 fixture, all three arms, including the composition with #460:

    # no override
    [AetherEngine] dispatch: codec=27 → native
    
    # mid-play, --reload-applying decode-path=software at +10 s
      t=09 state=playing cur=9.00 buf=56.00
      HOSTCALL reloadAtCurrentPosition(applying: preferredDecodePath=software) at +10000 ms (t=9.90s)
    [AetherEngine] #460: reload applying preferredDecodePath
    [AetherEngine] #461: host asked for the software path, overriding the native route
    [AetherEngine] dispatch: codec=27 → software
      #460 correction applied, session resumed at 10.81s from 9.90s (state=playing)
    

    A native session became a software session at its own playhead, no restart. Note the one shape where that composition does not re-route: reloadAtCurrentPosition on a custom IOReader source rebuilds on the backend it was already on, so a decode-path correction there takes effect at the next load. URL sources re-run the full routing and switch in place.

    Two things I did not do, both deliberate. No engine-side detector, as offered: the heuristic worth having is not the one being replaced (counting libVLC error lines only ever worked while libVLC was the decoder), and an engine-side one wants a real fixture to calibrate against rather than a plausible threshold. If an hev1 remux with in-band parameter sets over Rext turns up on your side, that is the input that would make it a measurement. And no repro from here either: the change is code-anchored the same way the report is, verified end to end on the routing and on the composition, not on a mid-play VideoToolbox wall.

    aetherctl play --sw now drives this option instead of the process-global test hook, so the harness exercises what a host calls; --reload-applying decode-path=software drives the correction. Docs in docs/api.md under "Overriding the decode path". Leaving this open until it has been tried on your stack. #462 next.

  2. cmcpherson274 commented on Sep 2, 2026

    @cmcpherson274
    Author

    Tried on our stack at 6.65.0 (50a2d3ee): we scripted the arc the ask targets — our start-patience detector driven by our own first-frame latch on a healthy H.264 source — and the composition with #460 did the thing on hardware. We have no real member of the population on the bench (our one damaged-head fixture decodes by concealment and starts normally), so this measures the composition mechanics, not the fix on a damaged head.

    Where it plugs in. Our wrapper already had the detector: the damaged-head "start patience" arc (a native session that is provably alive — clock advancing, .playing — but has painted nothing past the normal start window defers its terminal to a 240 s cap). #461 gave the escape: at the moment patience engages (60 s) the wrapper corrects the session to preferredDecodePath = .software in place through reloadAtCurrentPosition(applying:). VOD full-screen only for now (arming any "not decoding" evidence on live is an owner call on our side, since a dead channel would otherwise wait up to 240 s), once per wrapper, never when already on software / on the remote-HLS bypass / on a DV P5 or AV1 P10 source (we refuse those before asking, from the probe's dvProfile — over-refusing all AV1 P10.x because the probe carries no BL-compat id, which is free on this silicon).

    Measured on an Apple TV 4K (3rd gen, tvOS 26.6), an SDR H.264 MKV, with our first-frame latch held for 75 s to script the frameless start (the source itself painted natively at t+0.22 s):

    09-02 09:19:13.291  [AetherEngine] dispatch: codec=27 → native
    09-02 09:19:13.322  [AetherEngine] #321: effective video route = loopback
    09-02 09:20:13.311  [Aether] start patience engaged — alive with no picture at 60s (cap 240s)
    09-02 09:20:13.311  [Aether] decode-path escape — alive with no picture at 60s, correcting this session to the software path (#461)
    09-02 09:20:13.336  [Aether] option correction → preferredDecodePath=software — session-preserving reload (#460)
    09-02 09:20:13.337  [AetherEngine] #460: reload applying preferredDecodePath
    09-02 09:20:13.375  [AetherEngine] #461: host asked for the software path, overriding the native route
    09-02 09:20:13.375  [AetherEngine] dispatch: codec=27 → software
    09-02 09:20:13.427  [AetherEngine] #321: effective video route = software
    09-02 09:20:13.428  [Aether] option correction done (preferredDecodePath=software) — subtitle session + audio pick carried by the engine
    09-02 09:20:13.708  [SWHost] first video frame enqueued: pixfmt=0x34323076 size=1920x1080 pts=87.321s
    09-02 09:20:13.715  [AetherEngine] #361 startup 8/8 presenting (gen 2)
    

    Native → software at the playhead in 117 ms, same engine instance; the software host enqueued its first frame 0.28 s after the correction and presented at .715. Our own started breadcrumb waited out the scripted 75 s latch (started (route software, 75.1s)) — that is the rig, not the engine. A second run of the same leg earlier in the day read 116 ms.

    On the simulator, whose VOD route is already software, two separate legs: our policy stands the escape down before asking (09-02 09:18:06.508 [Aether] decode-path escape stood down — already software, patience having engaged at .506), and a separate rig that drives the #460 correction directly gets your honest no-op (09-02 09:00:18.926 [AetherEngine] #461: host asked for the software path; the routing had already chosen it). The device leg is the only one that flips a route. All three are retained.

    Two things we did not do, deliberately. No engine-side detector — ours engaged unaided at 60 s of wrapper life and the escape issued in the same millisecond; and no live arming yet — the escape is D4-compatible on our side (same engine, same tuner stream, same rewind window, no renegotiation), the trigger on live is the open question.

    One note that belongs to the docs rather than the code. A mid-play preferredDecodePath correction on a custom-IOReader session is accepted and takes effect only at the next load(): preferredDecodePath is read at exactly three sites in Sources/AetherEngine, all inside public func load( (AetherEngine.swift:3207 / :3824 / :3836), while the custom-source rebuild picks its host from wasOnSoftwarePath (AetherEngine+Loading.swift:1931, branch at :2030) — and on a live custom source that reopen lands at the reader's own byte 0 (LiveReloadPolicy.resumePosition is nil for live). Your shipping comment on #461 does say the custom-source rebuild stays on its backend; docs/api.md's "Where a correction lands" (:139-146) does not list preferredDecodePath among the install-for-next-load fields while "Overriding the decode path" (:153) recommends the pairing. On our spool arm that combination would be accepted, destructive and inert; we guard it host-side. If you would rather have it refused by name before teardown (a SessionReloadRefusal case reached from reloadAtCurrentPosition(applying:) when the proposal changes preferredDecodePath on a custom source), that is the spelling we would consume; a docs line is fine too.

  3. superuser404notfound commented on Sep 3, 2026

    @superuser404notfound
    Owner

    Thank you for running it on hardware and, more than that, for the last paragraph. The docs note was the actual finding here, and it was worse than you put it.

    Confirmed, and it was not a documentation gap. preferredDecodePath is read at three sites, all inside public func load(, exactly as you traced. The custom-source rebuild picks its host from wasOnSoftwarePath and never reads the option, so the correction is written into loadedOptions, named in the reload's own "applying" log line, and then ignored. That is the one outcome #460's rules forbid: a correction either lands or is refused by name, never three quarters of the way. And docs/api.md's "Where a correction lands" did not merely omit the field, it said "the routing, probe-budget, live-join, deinterlace and subtitle-preparation fields all apply there". preferredDecodePath is a routing field, so the paragraph asserted the opposite of what the code did.

    The destructive half is already gone on main. You measured on 6.65.0, where the reopen of a live custom source did land at the reader's byte 0. That is fixed in the #460 follow-up (6626b1f7, merged, not yet released): a live reopen leaves the reader alone and moves the AVIO axis onto its cursor instead. On the harness the same run went from a playhead of 41.5 s falling to 1.9 s with the whole delivered window re-read, to a reach-back of 0.0 MB. So on your spool arm the combination was accepted, destructive and inert; from that commit on it is accepted and inert, and from this one it simply lands.

    I did not build the spelling you offered, and the reason is your own stack. A SessionReloadRefusal that fires whenever a proposal changes preferredDecodePath on a custom source is honest, cheap and exactly wrong for the population #461 exists for: a spool-backed live source reading through an IOReader, with no second engine to hand a struggling stream to. Refusing there would have documented the gap rather than closed it, and it would have left your wrapper permanently guarding host-side against a lever it cannot use. So the rebuild now asks the same pure routing policy load asks, seeded with the backend the session is on, and the correction lands on both source shapes.

    The one-way type is what makes re-routing that path safe. The comment guarding it warned that loadNative on a software-routed AV1 source throws unsupportedCodec, which is the reverse direction. DecodePath has no .native, so the only flip the reopen can make is native to software, and the software path is the general one. That asymmetry is now load-bearing rather than decorative: the dangerous direction is unreachable by construction instead of by a comment asking the next reader not to write it. keepNativeHost and the two post-load fixups (the native-only live watchdog, the software-only track republish) follow the target route rather than the previous one.

    Your refusal does exist, narrower. What the software path cannot REPRESENT is refused before any teardown, with two new cases: SessionReloadRefusal.softwarePathCannotRepresentSource (IPT-PQ-c2, so HEVC P5 and AV1 P10.0) and .demuxedAudioLiveIsNativeOnly. Both guards live after the routing decision inside load, so on a correction they would have failed a session that was already torn down, which is not a refusal that costs nothing. Deciding them early needs the base-layer compatibility id to outlive the probe, so it is now retained beside sourceDVProfile. Note this covers the URL branch too, which had the same shape: a correction onto software on a P5 source used to tear the session down and only then throw.

    That also means your over-refusal of all AV1 P10.x is no longer the only option available to you. The engine refuses P10.0 by compatibility id and lets P10.1 / P10.2 / P10.4 through, so you can ask and read the refusal rather than pre-filtering on a profile number the probe cannot fully qualify.

    Measured. customio gained --reload-decode-path, because the existing --reload-at correction is an httpHeaders probe that is inert on a custom source by design and therefore could never measure this field. Seekable custom VOD source and the live spool reader:

      RELOAD applying preferredDecodePath=software: playhead=0.00s backend=native
    [AetherEngine] #460: reload applying preferredDecodePath
    [AetherEngine] #461: reload re-routing this session native -> software on the host's preference (custom source: true)
      RELOAD done: playhead 0.00s -> 0.33s, backend native -> software, decoder=libavcodec H264 (SW)
    

    The same run with only the routing change reverted, which is the state you measured: #460: reload applying preferredDecodePath, then backend native -> native, decoder=VideoToolbox H264 (HW).

    On the live arm the rebuild keeps the 0.0 MB reach-back. One number there needs reading carefully, so I will state it rather than quote it: the harness anchors its retention slope at 60 s to skip the load step, and --reload-at 60 puts a second step exactly on that anchor. A 100 s run reads ratio 1.31 and means nothing by it. Over 260 s the footprint steps from 25 to 66 MB across the switch, then sits flat at 67 for 140 s and falls to 60, ratio 0.18 and still falling. That is the software pipeline's baseline, not a session retaining anything.

    The refusal arm is measured on the Dolby browser test kit, which carries its own control, the same material and grading cut two ways:

    # Profile 5, IPT-only
      REFUSED state=playing backend=native playhead=0.00s (was 0.00s) decoder=VideoToolbox HEVC (HW)
    VERDICT: correction refused, session untouched and still playing
    # Profile 8.1
      RELOAD done: backend native -> software, decoder=libavcodec HEVC (SW)
    

    On your two deliberate omissions, both are the right call from here. Your detector engaging unaided at 60 s and issuing the escape in the same millisecond is the part I could not have built: an engine-side detector still wants a real fixture to calibrate against rather than a plausible threshold, and a native session that is provably alive with no picture is a fact only a host holds. The live trigger genuinely is the open question, and it is yours rather than the engine's: the escape is D4-compatible, but "not decoding" and "the channel is dead" look identical from in here, and a 240 s patience cap is a viewer-facing decision.

    Merged in d6f7c7d6 (PR #473), not released yet; it collects with the #460 follow-up and two other unreleased changes. Leaving this open for your run on a session that actually needs the escape, rather than a scripted one. And if that hev1 remux with in-band parameter sets over Rext ever turns up on your side, that is still the input that would turn the detector into a measurement.

  4. superuser404notfound commented on Sep 3, 2026

    @superuser404notfound
    Owner

    The follow-up (07347cf4: a decode-path correction reaches a custom IOReader session, and .softwarePathCannotRepresentSource / .demuxedAudioLiveIsNativeOnly refuse before any teardown) is released in 6.67.0. What is still open here is a run on a session that actually needs the escape.

  5. cmcpherson274 commented on Sep 16, 2026

    @cmcpherson274
    Author

    "What is still open here is a run on a session that actually needs the escape."

    Here is that run, plus three staged ones.

    Pin: 6.81.0 (c7e7adb5), measured 2026-09-12, posted today (09-16). Upstream is 7.1.0 today — eleven releases past it (6.82.0 → 7.1.0, the major among them); our next bump targets 7.1.0.

    We deleted our pre-filter. At E-5 the wrapper refused the escape itself for HEVC P5, and over-refused every AV1 P10.x because our probe carries no BL-compat id — a guess we only made because before 6.67.0 your answer arrived after the session was down. Yours is raised before any teardown, so the guess is worse than asking: AetherDecodePathEscapePolicy.dolbyVisionUnrepresentable and its stand-down case are gone, and the wrapper prints refusal.rawValue verbatim. AE#532 is the second reason: a P5 record its own RPU corrects is representable in software and is not refused (AetherEngine+ReloadWithOptions.swift:86-89) — which our guess would have.

    Four escapes on Office2 (Apple TV 4K gen 3, tvOS 26.6 / 23L773). Three carry JF_AETHER_FRAMELESS=75, which suppresses our first-frame latch and nothing else, so a started (route …, 75.Ns) is the rig releasing, not a decoder's first frame — and the P8.1 leg never reaches one. The fourth has no rig.

    1. Native h264 (DEV-E6-escape-native.log): the E-5 flip, unchanged — our escape line at 12:41:09.198, dispatch: codec=27 → software at .255, option correction done at .305. 107 ms, against 117 ms at 6.65.0 on this box.

    2. The real damaged head, no rig (DEV-E6-escape-real2.log)

    The First 9½ Weeks, source probe: h264 1920x1080 23.976fps sdr, product path, start patience engaged at 14:06:52.939:

    09-12 14:06:52.940  [Aether] decode-path escape — alive with no picture at 60s, correcting this session to the software path (#461)
    09-12 14:06:53.192  [Aether] started (route software, 60.4s)
    

    Sixty seconds alive with no picture on the native route, then a picture 253 ms after that patience mark. (No engine mirror: TEVEMATE_AETHER_LOG=1's h264 concealment warnings rotated our first attempt's log twice.)

    3. DV P5 — your refusal, measured (DEV-E6-escape-dv-p5.log, prepared: codec=dvh1.05.03,ec-3 … DV=profile5 …)

    09-12 12:45:19.581  [AetherEngine] #461: decode-path correction refused, the software path cannot serve this session: softwarePathCannotRepresentSource
    

    Ours in the same millisecond reads option correction refused (softwarePathCannotRepresentSource) — session kept (preferredDecodePath=software), and it was: started (route loopback, 75.3s) at the rig's release. That is what the deletion rests on.

    4. The finding — DV P8.1 (DEV-E6-escape-dv-p8.log)

    T1 - DV P8.1 HDR10 - DV8 Lake dvh1, prepared: codec=hvc1.2.4.L153 supplemental=dvh1.08.06/db1p … range=PQ DV=profile81 … duration=110.1s. The native loopback session was healthy — #361 startup 8/8 presenting (gen 1) at 12:42:18.179, #1 timeControlStatus=playing reason=- t+1.30s at .228 — and the rig escaped it 60 s in:

    09-12 12:43:14.925  [Aether] video route → none            ← ours; the native session is gone here
    09-12 12:43:15.034  [AetherEngine] dispatch: codec=173 → software
    09-12 12:43:15.057  [SWHost] selected HardwareVideoDecoder (VT HEVC) for codec_id=173
    09-12 12:43:15.062  [Aether] option correction threw (sessionCreationFailed(status: -4)) — preferredDecodePath=software; the caller decides on a fresh install
    

    The reading, with no blame in it. Your gate covers representability and P8.1 passes it correctly (decodePathRefusal, AetherEngine+ReloadWithOptions.swift:203-243). It fails one stage later, after the teardown. The software host re-consults the probe that "FAILS OPEN by design (four classes it cannot classify keep the native path)" (PlayerState.swift:756-762) and keeps HardwareVideoDecoder for HEVC when it answers yes (Native/SoftwarePlaybackHost.swift:705-719). That decoder is VideoToolbox with no software fallback: VTDecompressionSessionCreate under kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder: true (Decoder/HardwareVideoDecoder.swift:157-162) answered −4, and the throw at :193-204 leaves try videoDecoder.open uncaught (SoftwarePlaybackHost.swift:746). So the escape's destination can decline to be software — for the formats the probe deliberately cannot classify.

    The probe answered from one of those keep-native returns — a code read: it returned yes (the host would not have picked HardwareVideoDecoder otherwise) and logged nothing, while its only logging exit is the one that builds the throwaway session. The P8.1 leg carries no [VTProbe] canHardwareDecode line at all; the h264 leg carries one before each of its two dispatch: lines (canHardwareDecode codec=27 1920x1080 -> true (status=0), 12:40:09.194 and 12:41:09.255), from the routing gate — the host's own consult (SoftwarePlaybackHost.swift:711-713) is HEVC-only. Your comment on the in-band-parameter-set guard already names the class — "the common Dolby-Vision MP4 recipes" — and the number: "VideoToolbox has no SPS to configure a decoder and fails the session with -4" (Video/VTCapabilityProbe.swift:56-60). We have not read this file's hvcC to confirm that is its shape, and could not match −4 to a VideoToolbox status constant; it is reported as your log printed it.

    All anchors are 6.81.0 and every cited region is byte-identical at 7.1.0 (SoftwarePlaybackHost:706-720, :747; HardwareVideoDecoder:189-200; VTCapabilityProbe:52-56; PlayerState:814-820; decodePathRefusal:242-282), bar the require-hardware spec, which 7.0.0's floor flattened out of its #available (:156-158), key unchanged.

    Two shapes, your pick. A VT dry-run on that branch before the teardown, so a creation failure joins softwarePathCannotRepresentSource among the refusals that cost nothing; or SoftwarePlaybackHost catching sessionCreationFailed and falling back to SoftwareVideoDecoder — the same fail-open one stage later, keeping the session. Or tell us to pre-filter P8 host-side.

    Our call is to keep the pre-filter out, held lightly — this is the first P8.1 escape measured on any pin. A pre-filter would trade "error card at +60 s, Retry" for "capsule to the 240 s cap, then the same card": 180 s more black, same destination. What made it benign is ours: the E8 demote is @State on our player view, so a fresh launch of the same title ten minutes later tuned clean (started (route loopback, 3.6s), 12:53:54.007). That its next start() lands the title on our AVPlayer rung is a code read — no Retry was pressed.

    Live arming is still owner-gated here, and still ours rather than yours. #461 can close once you have read the P8.1 arc; the question needn't hold it open.

  6. added a commit that references this issue on Sep 17, 2026
  7. superuser404notfound commented on Sep 17, 2026

    @superuser404notfound
    Owner

    Thank you for the real damaged-head run, and for reading the P8.1 arc down to the decoder. Your reading is right, and it reproduces on the Mac without your file.

    The defect is one consult, not the escape. SoftwarePlaybackHost asked VTCapabilityProbe.canHardwareDecode, the routing gate's question, and read its answer as "open HardwareVideoDecoder". That probe fails open on purpose for routing: no extradata, Annex-B extradata, in-band parameter sets and a format-description failure all answer "keep native", because AVPlayer's decoder finds the parameter sets in the stream. HardwareVideoDecoder builds its format description from the hvcC alone and requires hardware with no software fallback, so every one of those four classes is a format it can never open. The same ignorance means "native is safe" to the router and "libavcodec is safe" to the software host, and a Bool cannot say both.

    Neither of the two shapes you offered, and no host-side pre-filter. A VT dry-run before the teardown would have refused a correction that software can serve, and a catch that falls back to SoftwareVideoDecoder would undo the reason the hardware decoder refuses to fall back at all (a 4K stream silently decoding on the CPU). The probe now returns a verdict, .supported / .unsupported / .unclassifiable(reason:). The routing gate reads it exactly as before and keeps native unless the verdict is .unsupported. The software host opens HardwareVideoDecoder only on .supported and hands everything else to libavcodec. The four unclassifiable returns were silent, which is why your P8.1 leg carries no [VTProbe] line; they now log their reason:

    [VTProbe] hardwareDecodeVerdict codec=173 3840x2160 -> unclassifiable (in-band parameter sets)
    

    So your next log names the shape of that file, which neither of us has confirmed yet.

    Measured. The Dolby browser test kit's P8.1 UHD asset carries its parameter sets in the hvcC and does not reproduce, so I built the two shapes from it: rewritten with MP4Box -add ...:xps_inband (numOfArrays 0), and remuxed to MPEG-TS (Annex-B extradata). The control is an hvc1 encode with parameter-set arrays.

    arm before after
    play --sw, in-band LOAD FAILED: sessionCreationFailed(status: -4) libavcodec, playing
    play --sw, TS LOAD FAILED: sessionCreationFailed(status: -4) libavcodec, playing
    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 from 4.80 s, playing at 14.05 s
    same, TS same error resumed at 5.22 s from 4.40 s, playing
    play --sw, control HardwareVideoDecoder opened unchanged

    The before arm of the correction is your 12:43:15 sequence line for line: #460: reload applying preferredDecodePath, dispatch: codec=173 → software, selected HardwareVideoDecoder (VT HEVC), then -4.

    One thing this does not answer, stated before it gets quoted. On that population the escape now lands on libavcodec, and whether libavcodec holds a 4K Main10 stream in real time on an Apple TV 4K (3rd gen) is unmeasured. The M1 arms kept their clock but say nothing about that: the drop counter play prints scatters more between two runs of one arm than between arms. If your retest shows the escape landing and then dropping frames, the next step is teaching HardwareVideoDecoder to take its parameter sets from the first keyframe, which is the hardware path for exactly these files, rather than anything on your side.

    Merged in 722e6aea (PR #542), not released yet. Leaving this open for your P8.1 leg on the release.

  8. superuser404notfound commented on Sep 17, 2026

    @superuser404notfound
    Owner

    Released in 7.1.1 (755cc21c), and Sodalite pins it as of 413bfd4a, so the next Sodalite TestFlight build carries the fix for the P8.1 leg.

  9. cmcpherson274 commented on Sep 21, 2026

    @cmcpherson274
    Author

    Here is the P8.1 leg on the release. The verdict names the shape of our file, two of your four classes turn out to be on this box, the escape takes — and the endurance arm ran, with a result that is not the one it set out to get.

    Two pins, each measurement labelled with its own: the shape-of-the-file answer and the escape arc were measured at 7.1.3 (13a86172) on 2026-09-17 and reproduce line for line at 7.7.1 (fa67d586) on 2026-09-19; the endurance legs are 7.7.1 only. Office2, Apple TV 4K (3rd gen) — AppleTV14,1, 5 active CPUs, 3.88 GB, read off the tvOS report quoted below — tvOS 26.6 (23L773), our app rebuilt on Xcode 27.0 / Swift 6.4. Four releases have landed since the last of these legs ran (7.8.0 → 7.10.0); no figure below is from any of them. Prefixes trimmed, tails and inner clauses elided (…); the rest verbatim. Bare :N are lines in the named log. Engine source line numbers are at 7.7.1; VTCapabilityProbe.swift and VideoRoutingPolicy.swift are byte-identical 7.1.3 → 7.7.1, so theirs hold at either pin.

    The shape of the file

    In-band parameter sets — your first synthesised arm: configRecordCarriesParameterSets reading numOfArrays as the 23rd byte (VTCapabilityProbe.swift:148) and returning false into the unclassifiable("in-band parameter sets") at :94.

    09-19 17:34:58.004  [VTProbe] hardwareDecodeVerdict codec=173 3840x2014 -> unclassifiable (in-band parameter sets)
    

    DEV-E8-escape-dv-p8.log:61 at 7.7.1; the same line at DEV-E7-escape-dv-p8.log:62, 09-17 15:23:17.147, at 7.1.3. The routing gate on the native load. It fires twice more in the same leg at both pins — on the correction's reload, and between [SWHost] session start and [SWHost] HDR mode ON, which is the consult you changed — and on the opening load of each of our two ordinary P8.1 legs, which need no escape and both start on loopback in 3.7 s at 7.7.1 (DEV-E8-dv-p81-dvhe.log:59, DEV-E8-dv-p81-dvh1.log:59). Those two are separate items whose prepared: lines are identical (hvc1.2.4.L153 supplemental=dvh1.08.06/db1p, 3840x2014, 110.1 s); we have not read the sample entries ourselves, so we claim only that the config record answers identically for both.

    And a second class on the same bench, on ordinary library titles rather than test assets:

    09-19 17:53:32.920  [VTProbe] hardwareDecodeVerdict codec=173 3840x2160 -> unclassifiable (Annex-B extradata)
    

    DEV-E8-axis-seek-4200.log:58 and DEV-E8-axis-cues-pgs.log:71: two different feature-length 4K HEVC titles (hvc1.2.4.L153, 5972.3 s and 5737.7 s, SDR), both dispatch: codec=173 → native and painting in 1.0 s and 1.9 s (started (route loopback, …)) — the gate's fail-open doing its job. Census over every 7.7.1 device log of that day — 66 slices, two further legs of the day excluded because they ran on our 7.1.3 control build: 93 probe consults logged — 85 classifiable, every one -> true (67 codec=27, 18 codec=173) and 8 unclassifiable (6 in-band across our two P8.1 assets, 2 Annex-B on the two titles above), beside 66 of the separate codec=av01 hwSupported=false. Two of your four classes on one box, and no .unsupported anywhere in the 93.

    The escape takes, where 6.81.0 threw

    play:b8d16b7a…;t=30 with JF_AETHER_FRAMELESS=75, which suppresses our first-frame latch and nothing else — so this is a staged escape on a native session that was healthy (#361 startup 8/8 presenting (gen 1) at 17:34:59.327, #1 timeControlStatus=playing reason=- t+1.33s at .356), not a damaged head. DEV-E8-escape-dv-p8.log at 7.7.1, one arc:

    09-19 17:35:56.094  [Aether] start patience engaged — alive with no picture at 60s (cap 240s)
    09-19 17:35:56.095  [Aether] decode-path escape — … correcting this session to the software path (#461)
    09-19 17:35:56.096  [Aether] option correction → preferredDecodePath=software — session-preserving reload (#460)
    09-19 17:35:56.230  [VTProbe] hardwareDecodeVerdict codec=173 3840x2014 -> unclassifiable (in-band parameter sets)
    09-19 17:35:56.230  [AetherEngine] #461: host asked for the software path, overriding the native route
    09-19 17:35:56.230  [AetherEngine] dispatch: codec=173 → software
    09-19 17:35:56.261  [SWHost] session start: videoCodecID=173 audioCodecID=none duration=110.1s
    09-19 17:35:56.262  [VTProbe] hardwareDecodeVerdict codec=173 3840x2014 -> unclassifiable (in-band parameter sets)
    09-19 17:35:56.262  [SWHost] HDR mode ON on display layer (transfer=16)
    09-19 17:35:56.262  [SWDecoder] Opened: 3840x2014, codec=hevc, threads=5, 10-bit
    09-19 17:35:56.269  [Aether] option correction done (preferredDecodePath=software) — …
    09-19 17:35:57.309  [AetherEngine] #361 startup 8/8 presenting (gen 2)
    09-19 17:36:22.288  stats final aether …: dropped 0 stalls 0 startup 75.1s obs 8.3Mbps audio none
    

    The slot between session start and HDR mode ON held [SWHost] selected HardwareVideoDecoder (VT HEVC) at 6.81.0; at 7.1.3 and at 7.7.1 it holds the verdict, and the decoder that opens two lines later is libavcodec. Picture 1.21 s after the escape line; the 75.1s in started (route software, 75.1s) is our rig's latch releasing, not the decoder. The 7.1.3 arc is the same lines at 15:24:14.956 → 15:24:16.155 (DEV-E7-escape-dv-p8.log:158–:209), and that leg's stats final reads the same dropped 0 stalls 0 … obs 8.3Mbps — at 75.0s of rig latch against 75.1s here, which, apart from the wall-clock stamps, is the only number in this section that is not the same at both pins.

    At 6.81.0 (c7e7adb5) — same title, same box, byte-identical route and rig (screen=play:b8d16b7a…;t=30 env=JF_AETHER_FRAMELESS=75 in all three drivers' own stdout), DEV-E6-escape-dv-p8.log, 09-12. The other difference is the toolchain: that build is Xcode 26.6 / Swift 6.3.3. We name it rather than claim it cannot matter:

    09-12 12:43:15.034  [AetherEngine] dispatch: codec=173 → software
    09-12 12:43:15.057  [SWHost] selected HardwareVideoDecoder (VT HEVC) for codec_id=173
    09-12 12:43:15.062  [Aether] option correction threw (sessionCreationFailed(status: -4)) — …
    09-12 12:43:15.062  [Aether] decode-path escape did not take — the start-patience cap still owns the terminal
    09-12 12:43:15.063  engine demote (E8): aether error errKind=sourceOpenFailed checkpoint=sessionConstructed — …
    09-12 12:43:15.063  ERROR Aether error: Failed to load: Decoder session failed (-4) | …
    

    The last five of those six lines are 0 at 7.1.3 and 0 at 7.7.1; only dispatch: codec=173 → software survives, and there it is followed by the verdict and [SWDecoder] Opened instead of by the VT selection. The 6.81.0 leg carries no hardwareDecodeVerdict line at all, and no stats final.

    The endurance arm — and the thing it measured is not libavcodec

    We ran it, and the first thing to say is that our fixture was in the wrong population.

    The title is a feature-length UHD remux — 3840x2160, 23.976 fps, DV profile 8.1, mkv, File size: 83394264790 bytes over 7486.5 s, the served variant advertising AVERAGE-BANDWIDTH=89114526, video ~81 Mbps by our server's own probe. Two runs at 7.7.1, both forced onto the software path with JF_AETHER_FRAMELESS=75 from two different positions in the film (;t=600 and ;t=3000): DEV-E8-escape-dv-p8-endurance.log and DEV-E8-endurance-sw-t3000.log. Its config record is classifiable, so the probe answers canHardwareDecode codec=173 3840x2160 -> true (status=0) and the software host does exactly what you wrote it to do:

    09-19 17:40:02.299  [SWHost] selected HardwareVideoDecoder (VT HEVC) for codec_id=173
    09-19 17:40:02.303  [HardwareVideoDecoder] opened HEVC 3840x2160 10-bit transfer=16
    09-19 17:40:02.303  [AudioDecoder] Opened: 48000Hz, 6ch, codec=ac3
    

    :336/:338/:339, and the same three at :328/:330/:331 of the second run. So these two legs measure SoftwarePlaybackHost end to end — demux, AC-3 decode, clock, enqueue, display layer — with VideoToolbox doing the video. They are not a libavcodec reading, and we are not presenting them as one. Your sentence is about that population, and the only leg we have on it is the conformance clip above — a 110.1 s asset whose last 25 s ran on the software path.

    What the two runs show, from [SWHost] session start to the first rebuf=y:

    run 1 (;t=600) run 2 (;t=3000)
    real time held 220.0 s 239.0 s
    clock over wall, over the [SWDiag] ticks inside it 218.00 s / 218.007 s = 1.0000 237.00 s / 237.003 s = 1.0000
    disp per wall second 5,193 frames / 217.007 s = 23.93 5,651 / 236.003 s = 23.94
    lost / rate / rebuf in that stretch 0(+0) · 1.00 · n on all 219 ticks 0(+0) · 1.00 · n on all 238 ticks
    layerDrop across that stretch +1 on the first tick, then flat at 1 for 217 ticks, then +9 on the last flat at 0 for 237 ticks, then +4 on the last
    aLead · parkedPkts at start → end 4.03 → 0.20 · 81 → 0 4.01 → 0.29 · 78 → 0
    then 19 rebuffer episodes, 2.15–3.11 s each, median 7.4 s apart 20 episodes (19 of them closed before the leg ended), 2.41–2.84 s, median 7.6 s apart
    clock over wall after that 90.26 s / 144.005 s = 0.627 92.13 s / 145.002 s = 0.635
    dropped total (stalls) 127 (0) 130 (0)
    lost across every tick of the leg 0(+0) on all 364 0(+0) on all 384

    AE#549's rate= is what made the stopped-clock seconds legible, the day after it shipped: a dclk=0.00 tick that also reads rate=0.00 is the host parking its own clock, not a timebase stalling under it. The feed goes first — aLead and parkedPkts collapse while vLead stays inside 0.42–0.62 (run 1) and 0.45–0.61 (run 2) right up to the end, falling only on the last two ticks of run 1 and the last one of run 2 (the closing three readings are 0.42 · 0.29 · 0.08 and 0.53 · 0.49 · 0.16) and lost is still 0, and the host says so itself ([SWHost] audio lead exhausted (0.15s); pausing clock for rebuffer → rebuffered to 2.01s audio lead; resuming clock, run 1 :1311/:1320 and 18 more pairs).

    Two facts bound what this can mean. tvOS filed a cpu_resource diagnostic against our process in both runs — Tevemate-tvOS.cpu_resource-2026-09-19-174201.ips and …-210633.ips — each reading "90 seconds cpu time over 119 seconds (76% cpu average), exceeding limit of 50% cpu over 180 seconds", Action taken: none, each window opening within 42 ms of [SWHost] session start and closing 101.0 s and 120.2 s before that run's first rebuffer. And the native-route control — the same file, the same ;t=600, no rig — ran the identical stretch for 421 s with one timeControlStatus=playing at t+1.04s and no waitingToPlay after it, 0 ERROR, no stats Δ10s line at all, its reader sustaining 90.8 Mbps across the whole of it, against the title's own 89.1 Mbps container rate (avioFetchedMB 949 → 5171 from t=30 s to t=420 s, and that field is bytes ÷ 1024², so 4,222 MiB in 390 s; DEV-E8-endurance-native-control.log). Its segment fetches run seg149 → seg255, which the engine's own producer ledger puts at item 596.513s → 1021.270s, so that control did cover run 1's whole degradation, 875.0 s → 965.3 s on the same clock.

    So: time-dependent, not content, not the network feed — two different scenes degrade at 220 s and 239 s, and run 1's own stretch of the film streams cleanly on the native route for 421 s. The cause is not proven. The CPU report is a strong candidate and it is only a candidate: it is four microstackshots covering 8.6 s and 8.8 s of a 119 s window (ending 1.0 s and 3.8 s before the window itself does), its heaviest stack enters an unsymbolicated non-system image in our own process at the fourth frame with no VideoToolbox or CoreMedia frame anywhere in it, and its window precedes the degradation rather than coinciding with it. A thermal-state read beside [SWDiag], and the same leg on a lower-bitrate feature-length P8.1 title, are the two that would split it; both are cheap and both are ours to run. The one comparable clean reading we have is DEV-E8-escape-real2.log — libavcodec on 1080p H.264 through the same host, 64 ticks, 0 rebuffers, lost=0, layerDrop=0, aLead flat at 4.0 — which says nothing about 4K.

    If either run's whole [SWDiag] series is useful to you, say so and we will post it; we have kept both, 364 and 384 ticks. One sentence on 7.9.0, which we have not measured: since a CoreMedia-domain failure now hands the session to this host once per session, this host's endurance is presumably a thing that path inherits.

    Your conditional next step is not triggered. On the population it is scoped to — in-band parameter sets, Annex-B extradata — the escape lands on libavcodec and drops nothing: dropped 0 stalls 0, and lost=0(+0), rebuf=n, rate=1.00 and a layerDrop delta of (+0) on all 26 ticks of the clip — cumulative layerDrop reads -1 on the opening tick, before the layer is readable, and 0 on the other 25 — clock 84.39 → 109.39 over 25.001 s of wall, and it ends at [SWHost] end of media: clock parked at 109.408s rather than at a teardown. The frames that were dropped in this reply were dropped by a session whose decoder was VideoToolbox, on a file whose parameter sets are already in its hvcC. So "teaching HardwareVideoDecoder to take its parameter sets from the first keyframe" stays unopened on our evidence.

    The P5 control, unchanged

    DEV-E8-escape-dv-p5.log at 7.7.1 (prepared: codec=dvh1.05.03,ec-3 … DV=profile5 …):

    09-19 17:37:58.739  [Aether] decode-path escape — … correcting this session to the software path (#461)
    09-19 17:37:58.740  [AetherEngine] #461: decode-path correction refused, the software path cannot serve this session: softwarePathCannotRepresentSource
    09-19 17:37:58.740  [Aether] option correction refused (softwarePathCannotRepresentSource) — session kept (preferredDecodePath=software)
    09-19 17:38:13.842  [Aether] started (route loopback, 75.2s)
    

    Refused before any teardown, session kept and playing on. Escape line to session kept: 1 ms here, 2 ms at 7.1.3 (15:26:18.536 → .538) and 2 ms at 6.81.0 (12:45:19.579 → .581) — the same two lines at all three pins. That leg carries no verdict line, and the engine says why: DV Profile 5: VT probe skipped, native dvh1 path is the only correct decode (#176) (emitted at AetherEngine.swift:4358), which is VideoRoutingPolicy.swift:119-120 returning false before the canHardwareDecode closure at :122 is ever called. The probe fix did not widen the software path onto P5, which is the correct outcome.

    Closeable on our side whenever you like; the endurance arm is ours to finish, not a reason to hold it open.

  10. superuser404notfound commented on Sep 22, 2026

    @superuser404notfound
    Owner

    Thank you for this. The census in it is the first field reading this gate has ever had: 93 consults, 85 classifiable and every one of them -> true, 8 unclassifiable across four assets, and no .unsupported anywhere in the set. That last part is worth saying out loud, because it means the routing gate's fail-open is carrying the entire real-world burden of the question and the strict answer has yet to be needed on a shipping box.

    Closing this. The escape does what it was built to do, on both classes you found, at both pins.

    Confirmed against the source

    Every one of the five code claims holds, and two of the files are frozen: VTCapabilityProbe.swift and VideoRoutingPolicy.swift are byte-identical from 7.1.3 through 7.10.0 and on to main, so the 7.7.1 line numbers hold at every pin anyone is likely to test.

    record[22] as numOfArrays at VTCapabilityProbe.swift:148 with the doc line above it saying so in words, the in-band parameter sets verdict at :94, and the gate that decides the software host's decoder at :41:

    var opensHardwareDecoder: Bool { self == .supported }

    So .unsupported and every .unclassifiable(reason:) fall through to libavcodec, which is the whole of the fix and exactly what your escape arc shows in the slot where 6.81.0 selected VT and then threw.

    Two precisions

    The DV Profile 5: VT probe skipped line is at 4359 in 7.7.1, which is what you read, and at 4428 on main. The string is unchanged; AetherEngine.swift grew above it by about seventy lines. Worth knowing before anyone diffs a future capture against your numbers.

    The second one is a genuine caveat on "the probe is never called for P5". True of VideoRoutingPolicy.forcesSoftwareForUndecodableFormat in isolation, which matches the P5 case first and returns before the closure. Not true of the engine, because the call site does not pass the raw profile:

    dvProfile: presentsDolbyVisionBaseLayer ? nil : (correctedDVProfile ?? dvProfile),
    canHardwareDecode: { VTCapabilityProbe.canHardwareDecode(codecpar: codecpar) })

    A P5 source reaches the probe when the base layer is being presented on its own, or when the RPU-corrected profile is not 5 (AE#532, a Profile 5 record the RPU corrects). Your P5 control has neither, which is why it logged no verdict, and the refusal it took is the correct outcome either way.

    The conditional step stays unopened, and for the reason you give

    Agreed, and the discriminator is the one you named rather than the drop count: the frames dropped in the endurance arm were dropped by a session whose video decoder was VideoToolbox, on a file whose parameter sets are already in its hvcC. Teaching HardwareVideoDecoder to take its parameter sets from a keyframe would not have touched a single one of them. It is strictly hvcC-driven today (HardwareVideoDecoder.swift:130-152 is the only place a format description is built, and it throws noExtradata without one), and it stays that way until something measured asks otherwise.

    The endurance arm has its own thread now

    #592, with your two runs as its opening measurement, because your reading of it is right and the conclusion follows: your fixture was in a different population, and the leg measures SoftwarePlaybackHost end to end with VT doing the video.

    Two things came out of following it into the source. The software route stops sharing the native route's read path one line after Demuxer.readPacket: it inserts a producer thread and an on-disk packet spool, every packet crossing it through a binary property list, which is roughly five to seven copies of every compressed byte plus two PropertyList codings, all serialised through one lock pair. At 81 Mbps that is about 10 MB/s each way; at 5 Mbps it is 0.6. And the one bound in that path expressed in bytes rather than seconds, min(2 GiB, free / 4), is compared against a residency figure that includes consumed-but-retained history, so it fills purely as a function of elapsed session time. 2 GiB at your file's rate is 211 s. Your two runs held for 220 s and 239 s.

    That is a match on the clock and not yet on the magnitude, and I have written it up as a candidate with the test that kills it: if the spool budget is what turns over, then the lower-bitrate feature-length title you already planned has to run clean for proportionally longer, and if it breaks at 220 s again the candidate is dead. Details and the two cheaper confirmations are on #592.

    One more thing came out of it that is entirely ours, unrelated to your report except that reading around the refusal is what surfaced it: since 7.8.0, a correction that gets refused was ending a running recording on its way out, which is precisely the rule #461 round 2 was built to keep. PR #591.

    The [SWDiag] series stays welcome on #592 whenever convenient; the fields I would read first are delay= and parkedPkts during the rebuffer episodes, and whether [SWHost] releasing rebuffer hold appears at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions