Skip to content

The software path needs far more of the box than the native path to move the same bytes on VOD #592

Closed

Description

@superuser404notfound

Split out of #461, where @cmcpherson274 ran an endurance arm on SoftwarePlaybackHost and reported it in full: #461 (comment)

The measurement is his and the fixture turned out to be in a different population than #461's, which is why this is its own thread. It is worth one regardless of what caused the degradation, because of what the code says in the middle of it.

The measurement

Apple TV 4K (3rd gen), tvOS 26.6, engine 7.7.1 (fa67d586). A feature-length UHD remux, 3840x2160 23.976 fps, Dolby Vision profile 8.1, AC-3 5.1, 7486.5 s, video around 81 Mbps, forced onto the software path from two positions in the film. Its hvcC is classifiable, so the host opened HardwareVideoDecoder (VT HEVC) for video and libavcodec decoded only the AC-3.

From [SWHost] session start, both runs:

run 1 run 2
clean playback 220.0 s 239.0 s
clock over wall in that stretch 1.0000 1.0000
aLead start → end 4.03 → 0.20 4.01 → 0.29
parkedPkts start → end 81 → 0 78 → 0
vLead through the whole stretch 0.42 to 0.62 0.45 to 0.61
lost on every tick of the leg 0(+0) on 364 0(+0) on 384
then 19 rebuffer episodes, 2.15 to 3.11 s, median 7.4 s apart 20 episodes, 2.41 to 2.84 s, median 7.6 s apart
clock over wall after that 0.627 0.635

The same file over the same stretch on the native route ran 421 s clean with its reader sustaining 90.8 Mbps, so the source can be read faster than real time on this box.

What the code says

AudioLookaheadPolicy.clockAction takes an atRingEnd flag, and that flag is the whole discriminator. AudioLookahead.swift:53:

Only a DRY ring at the edge is a source underrun. A low lead with packets still in the ring is decode lag; the next pump pass refills it without touching the clock.

The DVR arm feeds it honestly, SoftwarePlaybackHost.swift:2049:

atRingEnd: audioLookahead.current >= ring.seqBounds.end,

The VOD arm, which is the one in these two runs, hardcodes it, SoftwarePlaybackHost.swift:2456:

atRingEnd: true,

with its own note above it at :2441:

In this loop there is no ring to distinguish decode lag from a dry source, so a sub-threshold lead IS treated as source-starved.

So on VOD, [SWHost] audio lead exhausted (0.15s); pausing clock for rebuffer is a statement about the lead and not about the source. On a local file that the native route reads at 90.8 Mbps, "the source ran dry" is the less likely of the two readings, and it is the one the host acts on.

There is a second thing in the same loop. applyAudioClockAction sets the rebuffer hold; waitForRenderer releases the same hold twelve hundred lines later with the reason "the renderer needs a running clock to take parked video" (:2431), because a stopped synchronizer never drains the renderer and this thread is the only one that could lift it. Two arms of one loop with opposite policies on the same flag.

The arithmetic

Over the clean stretch the lead erodes 3.83 s in 218.007 s of clock, which is a 1.76 % delivery deficit (run 2: 3.72 s in 237.003 s, 1.57 %). After the transition, clock over wall reads 0.627 and 0.635.

Those two numbers cannot both describe the same pipeline capability. A pipeline that can only source 63 % of real time does not hold clock over wall at 1.0000 for 218 consecutive seconds with lost=0 on every tick; a 4 s cushion in front of a 37 % deficit is gone in eleven seconds, not two hundred and eighteen. So either the capability collapsed at t=220 s, or the 37 % is manufactured by the response to a deficit that stayed small.

I am not claiming which. That is the question this issue is for.

Why it is not just a test rig

Since 7.9.0 this host is on a user-facing recovery path. AetherEngine+SoftwarePathEscalation.swift hands a session to SoftwarePlaybackHost once per session when AVPlayer refuses the media itself (a CoreMedia-domain failure), via reloadAtCurrentPosition { $0.preferredDecodePath = .software }. The population that trips that rung is 4K remuxes, which is exactly the population measured here. Whatever this host's endurance is at 4K, that rung now inherits it.

What would split it, at no cost to anyone's evening

Three reads of logs that already exist, no new device run:

  1. Does [SWHost] releasing rebuffer hold appear in either endurance log? It fires only when the demux read gate holds, and on this arm the gate holds only at parkedVideoCap = 256. If it appears, the refill was competing with a held read and the oscillation is partly self-inflicted. If it never appears, the read was never gated and the slowness is real.
  2. What does parkedPkts do DURING the rebuffer episodes? The clock is stopped, so the renderer drains nothing and parked depth should climb. Flat or falling during a pause says something else is holding the loop.
  3. delay= and dpts= across both phases. delay is accumulated render delay and it is the only field in the line that shows frames displayed LATE; a session that stalls and catches up drops nothing and enqueues on pace, and only that field grows. dpts gives the spacing of the timestamps the frames carried. Both are already in all 364 and 384 ticks.

Separately, and this one is ours: a thermal-state reading beside [SWDiag] is cheap and would retire the CPU hypothesis in one run rather than leaving it as a candidate.

Not in scope here

The #461 escape itself is fine and that issue is closed. On the population it is scoped to, sources the probe cannot classify, the escape lands on libavcodec and drops nothing: dropped 0 stalls 0, lost=0(+0), rebuf=n, rate=1.00 on all 26 ticks of the conformance clip. The frames dropped in the endurance arm were dropped by a session whose video decoder was VideoToolbox.

Activity

  1. superuser404notfound commented on Sep 22, 2026

    @superuser404notfound
    OwnerAuthor

    Following the code from the [SWDiag] fields back to the read path. There is a candidate with a number on it, and the number is a wall-clock one.

    The SW path is not the same read path past Demuxer.readPacket

    The native route and the software host share AVIOReader and the demuxer, which is why the same file read at 90.8 Mbps on the native control. They diverge one line later, SoftwarePlaybackHost.swift:2556-2566:

    if let readAhead {
        packet = try readAhead.read(isCurrent: { admitsRead(genBeforeRead) })?.makeAVPacket()
    } else {
        packet = try demuxer.readPacket(isCurrent: { admitsRead(genBeforeRead) })
    }

    readAhead is built for every remote seekable VOD source (:944, if !isLive, dem.isSourceSeekable, !dem.readsSourceDirectly), so it is on for this session and off for a file:// one. It is a producer thread plus SoftwarePacketDiskFIFO, an on-disk packet spool, and every packet crosses it as a binary property list (SoftwareStoredPacket.swift:21-29):

    func encoded() throws -> Data {
        let encoder = PropertyListEncoder()
        encoder.outputFormat = .binary
        return try encoder.encode(self)
    }
    static func decode(_ data: Data) throws -> Self {
        try PropertyListDecoder().decode(Self.self, from: data)
    }

    At 81 Mbps and 23.976 fps that is roughly 425 KB per video packet, about 10.2 MB/s encoded to disk and 10.2 MB/s read back and decoded, plus five to seven full copies of every compressed byte before it reaches VT, all serialised through the operations lock and the FIFO's own lock. At 5 Mbps the same machinery moves 0.6 MB/s. This is the part of the path whose cost scales with the compressed bitrate, and it exists only on the software route.

    That is a plausible shape for a small, constant, from-the-first-second deficit. The measured one is 1.76 % (run 2: 1.57 %).

    The one bound in that path measured in BYTES

    SoftwarePlaybackHost.swift:964 builds the spool with retainConsumed: true, and in that mode a pop() advances the reader cursor without reclaiming. The quantity the read-ahead parks on is SoftwarePacketDiskFIFO.swift:31-34:

    /// Logical file bytes, including headers, consumed prefixes and opt-in retained history.
    let diskByteCount: Int
    /// Includes consumed history in retained mode; unlike byteCount, this is a residency limit.
    var residentByteCount: Int { diskByteCount }

    So the spool grows at the source bitrate for the whole session, independent of how far ahead the producer is running. Its ceiling is HLSVideoEngine.sessionRetentionBudgetBytes (HLSVideoEngine.swift:820-825), min(2 GiB, free / 4).

    Nothing trims until that ceiling is actually reached. Both trim calls are while diskBytes > budget loops (SoftwarePacketDiskFIFO.swift:255), one on every produced packet (SoftwarePacketReadAhead.swift:413) and one on every consumed packet (:292), and both return at the loop condition until the budget is crossed. At the crossing they start doing real work on both threads: an lstat and a synchronous FileManager.removeItem of a 4 MiB chunk file, inside the FIFO lock, on the demux thread that is also decoding the audio and feeding VT.

    Time to that crossing is a byte budget divided by a byte rate:

    source rate 2 GiB / rate
    81.6 Mbps (this file) 211 s
    40 Mbps 430 s
    20 Mbps 860 s
    5 Mbps 3440 s

    The two runs turned over at 220 s and 239 s.

    What that is and is not

    It is the only quantity in this path that produces a wall-clock cliff which moves with bitrate, and it lands within 5 to 13 % of both measurements. It is not proof: I have not found a mechanism at the crossing that by itself accounts for losing 36 % of real time, and roughly 2.4 chunk deletions per second is not obviously that expensive. So the clock matches and the magnitude does not, yet.

    The prediction that settles it, at no extra cost

    The next arm already proposed on #461 is the same leg on a lower-bitrate feature-length P8.1 title. That run is now a pre-registered test rather than a second data point:

    • If the spool budget is the clock, turnover scales as budget / bitrate. Half the bitrate has to buy roughly twice the clean stretch. A 40 Mbps title should run clean for around seven minutes, not three and a half.
    • If it turns over at 220 s again regardless of bitrate, this candidate is dead and the thermal or CPU reading owns it.

    Two cheaper confirmations from material that already exists:

    1. cachedBytes in the 30 s memprobe (AetherEngine+Diagnostics.swift:519-533) climbing linearly and plateauing at the tick the first audio lead exhausted fires. That is the crossing, seen directly.
    2. Free space on the device's tmp volume. The budget is min(2 GiB, free / 4), so under 8 GiB free the turnover has to come earlier than 211 s, proportionally.

    Two corrections to how the line reads

    While tracing the fields: vLead is the minimum over the interval of renderer.newestEnqueuedPtsSeconds - clock, and the renderer is hard-bounded by isReadyForMoreMediaData, which is exactly what drainParkedVideoNonblocking gates on. So a flat 0.42 to 0.62 is the display layer's own queue target and says nothing about upstream headroom. And lost is _untimedFramesDropped + _sampleBuildFailures, frames the decoder produced that never reached the layer, not a render-deadline counter.

    aLead is the only field in the whole line that can see read-path headroom, which is why it is the only one that moved.

    Ours to run

    This does not need the Apple TV. The spool, the budget and the bitrate are all the same on macOS, so aetherctl play --sw against a high-bitrate source over HTTP should show the same crossing at the same place, with the temp directory as a direct readout. That is the next thing I will do here.

  2. superuser404notfound commented on Sep 22, 2026

    @superuser404notfound
    OwnerAuthor

    Ran it here. The clock half reproduces exactly. The cost half does not, and I am retracting it.

    Harness

    M1, 8 cores, 16 GB. aetherctl play --reload-applying decode-path=software --reload-applying-at 500 against a threaded range origin on loopback. Fixture built to be cheap to decode and expensive to spool, which is what separates the spool from the decoder: 960x540 lossless x264 over a noise filter, AC-3 5.1, 105.8 Mbps = 13.2 MB/s, 170 s. Spool depth read once a second from $TMPDIR/aether-software-packets-*.

    Free space was 4.00 GiB at load, so the budget was free / 4 rather than the 2 GiB cap. Prediction written down before the run: plateau at 1074 MB, reached at t ≈ 41 s.

    The spool behaves exactly as read from the source

    predicted run 1 run 2 (box under load) run 3
    plateau 1074 MB 973 MB 1011 MB 990 MB
    reached at 41 s 37 s 41 s 37 s

    And the shape is the one the code implies rather than the intuitive one. The first 2 seconds put 505 MB on disk, which is the 40 s forward window at this bitrate (predicted 529 MB). Everything after that is retained history, climbing at 12.7 MB/s against the source's 13.2, until it stops dead at the budget. So the spool's size is a function of elapsed session time, not of how far ahead the producer is running, and the crossing is budget / bitrate away from the start.

    That part is settled.

    The crossing is free, on three arms

    aLead sits at 4.00 to 4.03 for the entire 120 s, straight through the crossing. dclk=1.00, rate=1.00, lost=0(+0), delay=0.00(+0.00), and zero audio lead exhausted, rebuffered to or releasing rebuffer hold lines in any run.

    Then I measured the cost directly rather than its consequences, sampling the process's CPU time each second:

       t    cpu_s/s   spool_MB
      23.3   0.37      817.7        <- filling
      32.2   0.44      928.2
      36.6   0.42      985.1        <- crossing
      41.0   0.40      990.4        <- plateau, trim loop now live on every packet
      63.1   0.43      988.6
     107.3   0.39      991.8
    

    Flat at 0.41 core before and after. Deleting a 4 MiB chunk every 0.3 s, plus the two while diskBytes > budget loops now evaluating on every packet instead of returning at the condition, costs nothing measurable. Repeating the run with seven CPU burners against it (load average 8.8) changed nothing either: aLead still pinned at 4.00.

    So the budget crossing is real, it is elapsed-time-keyed, and by itself it is not expensive. My earlier comment offered it as the candidate for the degradation. On this evidence it is not, and the 211 s arithmetic matching 220 s and 239 s has to be treated as a coincidence until something else supports it.

    What the failure of that hypothesis sharpens

    Working through the rebuffer cadence properly, the transition is a bigger step than I gave it credit for, and that matters for whatever does explain it.

    In phase 2, each cycle is a pause of about 2.6 s and then about 4.8 s of playing, during which the lead falls from the 2.0 s resume target to the 0.15 s pause threshold. That is 1.85 s of content lost in 4.8 s, a 38 % deficit, and it predicts clock over wall of 0.65 against the 0.627 measured. Phase 1's deficit was 1.76 %.

    So the pipeline's delivery really does change by a factor of about twenty at the transition. It is not a small deficit amplified by the response; the amplification argument in my first comment was wrong about magnitude too. Something genuinely steps.

    The refinement I would put money on now, and cannot test here

    The spool is a temp-directory file that the whole system's unified buffer cache sits in front of. On this Mac the budget was 1.0 GiB against 16 GB of RAM, which is nothing. On an Apple TV 4K (3rd gen) with 3.88 GB total and plenty of free storage, the budget is the full 2 GiB cap, which is more than half of physical memory, written at 10 MB/s and read back at 10 MB/s.

    That gives a step at exactly the same place for a different reason: while the spool is growing, reads of just-written chunks are page-cache hits; once it plateaus at a size the box cannot hold, they are not. The cost would appear only on a memory-constrained box, which is precisely why three arms on a 16 GB machine see nothing, and it would be invisible to a CPU sampler because the cost is a stall, not cycles.

    It also makes a design point that stands on its own regardless: sessionRetentionBudgetBytes bounds a temp spool by free storage (min(2 GiB, free / 4)) and never by physical memory, so the tighter the box's RAM the closer its spool gets to the size of RAM, which is backwards.

    The discriminator from the earlier comment is unchanged and now carries both hypotheses: the lower-bitrate title has to buy proportionally more clean time. A memory-keyed crossing scales with budget / bitrate exactly as a cost-keyed one would.

    Two new things worth reading off the runs already on disk, both free:

    1. Free space on the device's storage at load. It sets the budget, and with it where the crossing lands. Under 8 GiB free the crossing has to come earlier than 211 s, proportionally.
    2. Any tvOS memory-pressure or jetsam note in the same window as the first rebuffer. A cpu_resource report was already filed; a memory event alongside it would be decisive.
  3. superuser404notfound commented on Sep 22, 2026

    @superuser404notfound
    OwnerAuthor

    Reproduced the degradation here, answered my own three questions off my own logs, built the obvious fix, and measured it into the ground. Posting all of it because the dead direction is the useful part.

    The shape reproduces on a Mac

    Harness: 4K H.264 at 164 Mbps, AC-3 5.1, over the threaded loopback origin, on the software path. H.264 is the right codec for this because the software host's VideoToolbox branch is HEVC-only, so video is libavcodec and the loop is the thing under test. Raw decode of that file runs at 2.28x real time using about 3 cores, so the session starts with margin, exactly as yours did.

    Then the load lands mid-session, at t=14 s, as two more concurrent decodes of the same file. That ordering is the whole experiment: the everHadLead latch only arms once the lead has genuinely reached 2.0 s, so a session that starts starved never arms the rebuffer at all. An earlier arm that loaded the box from t=0 drove aLead to -43 s with the clock running at rate=1.00 and produced not one rebuffer line, which is worth knowing on its own.

    With the load applied after a healthy start:

      exhausted=25  rebuffered=10  releasingHold=15
      mean dclk (= clock over wall) = 0.653
      max parkedPkts = 256  (cap 256)
      audio continuity: gaps>2ms=0
    

    0.653 against your 0.627 and 0.635. Same signature.

    The three questions, answered on my rig

    1. Does [SWHost] releasing rebuffer hold appear? Yes, 15 times against 25 pauses. Only 10 of the 25 holds ended by reaching the 2.0 s refill target. The other 15 were cancelled by the read gate.
    2. What does parkedPkts do during the episodes? It climbs, 83 → 100 → 193 → 250, and then pins at the 256 cap for the rest of the run.
    3. Those two are one fact. The clock stops, so the synchronizer stops, so the renderer stops draining, so the park FIFO fills; at the cap shouldHoldDemuxRead closes the read gate on the very loop that has to pull the audio the rebuffer is waiting for, and waitForRenderer has to lift the hold to make any progress at all. Once parked pins at the cap the rebuffer mechanism is effectively disabled, and the session just grinds.

    So the pathology I described is real and now measured rather than argued.

    The fix I proposed does not work, and I am withdrawing the reading behind it

    The proposal was that the VOD arm's hardcoded atRingEnd: true is a lie, because since AE#512 that loop does have a store to ask: SoftwarePacketReadAhead's unread depth is the same fact the DVR arm reads off ring.seqBounds.end. I wired it up, with the conservative true kept for the direct loop that has no read-ahead, and ran the identical arm:

    before with the fix
    clock pauses 25 0
    clock over wall 0.653 0.960
    max parkedPkts 256 (at cap) 85
    aLead / vLead at the end -1.86 / -11.25 -15.27 / -15.55
    layerDrop 181, delta +0 593, delta +8/s

    The clock runs at 96 % of wall and the content is fifteen seconds behind it, with the layer still dropping at the end of the run where the unfixed arm had settled at zero. That is precisely what AudioLookaheadPolicy warns about in its own comment: a free-running clock permanently ahead of the stream, every later sample landing in the clock's past, continuous chopping that never recovers.

    And that means my reading of the code was wrong. On VOD the source is never "produced but not yet arrived"; the bytes always exist. So a low audio lead on VOD always means the session cannot consume at real time, and stopping the clock is the correct answer to that, not a misdiagnosis of it. The hardcoded true is a deliberate mapping of that fact, and the comment above it says as much. The discriminator the DVR arm needs is one this arm genuinely does not.

    Branch discarded.

    What that leaves

    If the rebuffering is correct behaviour, then the defect is upstream of it: the session should not have been under real time in the first place. Your native control read the same file at 90.8 Mbps on the same box while the software route could not sustain 81.

    One number toward that, with a caveat attached. On the same fixture and the same machine, the engine's own process costs about 0.10 core on the native route and 0.41 core on the software route. The caveat matters: AVFoundation decodes out of process, so the native figure excludes its decode entirely while the software figure excludes nothing. It is not a total-cost comparison. It is a fair comparison of what the ENGINE spends, and that is where the per-packet property-list round trip and the five to seven copies live.

    So the question this issue should now answer is not "why does the clock stop", it is "why does this route need so much more of the box than the other one to move the same bytes". The lower-bitrate arm still splits it cleanly, and a lower per-byte cost would move the whole curve rather than one threshold.

  4. changed the title [-]SoftwarePlaybackHost cannot tell decode lag from a dry source on VOD, and the answer it picks is expensive[/-] [+]The software path needs far more of the box than the native path to move the same bytes on VOD[/+] on Sep 22, 2026
  5. superuser404notfound commented on Sep 22, 2026

    @superuser404notfound
    OwnerAuthor

    Retitled, because the old title stated the reading the comment above withdraws, and a title outlives every correction under it.

    To save the next reader the three screens: the atRingEnd discriminator is dead and should not be re-proposed. On VOD the bytes always exist, so "produced but not yet arrived" is not a possible state, a low audio lead can only mean the session cannot consume at real time, and stopping the clock is the correct response. The hardcoded atRingEnd: true on the VOD arm is a deliberate and correct mapping rather than a lie. Wiring the discriminator up measured 0 clock pauses and a clock fifteen seconds ahead of the content, still chopping at the end of the run. The spool-budget crossing died one comment earlier, on three arms that showed the crossing costs nothing.

    What is left is the question in the new title, and the pre-registered discriminator for it is unchanged: the same endurance leg on a lower-bitrate feature-length P8.1 title. If turnover scales as budget / bitrate, half the bitrate buys roughly twice the clean stretch; if it turns over at around 220 s regardless of bitrate, both byte-keyed hypotheses die and thermal or CPU owns it.

    The leading mechanical candidate for the per-byte cost, to be specified only after that leg: every compressed byte crosses a PropertyListEncoder/Decoder round trip per packet on the way to an on-disk spool (SoftwareStoredPacket.swift:21-29), roughly 425 KB per video packet at around 10 MB/s written and read back, plus five to seven copies, all through the FIFO locks, and existing on the software route only.

    One design finding in here is worth naming independently of the bug: sessionRetentionBudgetBytes bounds that spool by free storage and never by physical memory (HLSVideoEngine.swift:820-825, min(2 GiB, available / 4)). On a 3.88 GB Apple TV the cap is more than half of RAM, which is backwards for a RAM-constrained box whichever way this issue lands.

  6. superuser404notfound commented on Sep 22, 2026

    @superuser404notfound
    OwnerAuthor

    The per-byte candidate is dead, and on the reported codec the routes cost the same CPU

    Two measurements on an M1, taken because the endurance leg is device-bound but the per-byte cost is not.

    1. The envelope is not the cost

    SoftwareStoredPacket's PropertyListEncoder/Decoder round trip, own payload per round so an encoder copy is a copy the number contains (PR #603 carries the instrument):

    200 packets, 81.1 MB: encode 0.079 s = 1028 MB/s (395 us/pkt),
                          decode 0.006 s = 12670 MB/s (32 us/pkt), envelope overhead x1.0007
    

    At the session's roughly 10 MB/s that is about 24 packets per second, so 24 x 427 us is around 1% of one core. Five times slower on an A15 still leaves 5%.

    The 395 us for 425 KB is about four to five full copies, so the "five to seven copies" reading above was accurate. The inference that they are expensive was not, and the envelope adds 0.07% to the payload so nothing is base64 inflated. Dead candidate, not to be re-proposed or optimised.

    2. With the same decoder, the software route does not cost more CPU

    The 0.41-against-0.10-core figure further up was taken on a 164 Mbps H.264 fixture, where the software arm had libavcodec decoding the video and the native arm did not. That gap was the decoder, not the route.

    Repeated on the codec the report actually ran, 4K HEVC at 40 Mbps with AC-3 5.1, so HardwareVideoDecoder (VT HEVC) handles video on both routes, aetherctl play with and without --sw, 30 samples of steady state per arm, two passes:

    arm mean process CPU peak RSS buf ahead of the playhead drop at t+59
    native 6.24% / 6.96% 293 MB 47.1 s 0
    software 5.74% / 6.12% 109 / 117 MB 0.41 s 350 / 357, climbing

    CPU is level, and the software route is the lighter one in memory by a factor of about 2.6.

    What that leaves, and it is a different question

    The asymmetry that survives both measurements is runway. engine.bufferedPosition, the same published field on both routes, sits 47 seconds ahead of the playhead on native and 0.41 seconds on software, on the same local file on a machine with ample headroom. A route that runs on 0.41 s of runway has no margin for any perturbation at all, which is the shape of a session that plays clean until something disturbs it and then oscillates rather than recovers.

    So the question this thread has been asking, "why does this route need so much more of the box", does not survive its own measurement on the reported codec. The one worth asking instead is why the software route never builds a buffer where the native one builds forty-seven seconds of it.

    Caveats, so none of this is read wider than it was taken: M1 rather than an Apple TV, a local file rather than a network source, and a CLI run binds no render surface, so the drop counter deserves care even though the 0-against-350 gap is far outside the run-to-run variation this harness is known for.

    The pre-registered bitrate leg is unaffected and still splits the endurance question. Two fixtures for it are built, 4K HEVC with AC-3 5.1 at 80 and 40 Mbps, six minutes each, which brackets both hypotheses' predicted turnover inside one file.

  7. superuser404notfound commented on Sep 22, 2026

    @superuser404notfound
    OwnerAuthor

    Correcting the comment above: it was taken on the wrong path, and the corrected arm reverses its conclusion

    A file:// source never takes the spooled path. SoftwarePlaybackHost gates the read-ahead on if !isLive, dem.isSourceSeekable, !dem.readsSourceDirectly, with the reason in the comment beside it: "A local path is left on the direct loop: the spool exists to avoid a second trip to a SOURCE, and re-reading a file is a page-cache hit."

    So the CPU parity and the "0.41 s of runway" in the comment above describe the direct loop, which touches neither the spool nor the envelope. The reported case streams from Jellyfin over HTTP and takes the spooled path. Verified rather than assumed: with 5.6 GiB free and no packet cache unavailable line, that session created no aether-software-packets-* directory at all.

    Re-run over Scripts/slowrange.py at 400 Mbps with 5 ms of latency, so the spool is live. 4K HEVC at 40 Mbps with AC-3 5.1, VT HEVC on both routes, 30 steady-state samples per arm, two passes:

    arm mean process CPU peak RSS peak spool buf ahead
    native 8.26% / 8.32% 530 / 731 MB none 47.3 s
    software 14.71% / 15.28% 327 / 534 MB 456 / 923 MB 0.51 s

    So the thread's premise holds after all, at about 1.8x rather than the 4.1x further up. That earlier figure was taken on an H.264 fixture where only the software arm had libavcodec decoding the video, so it was measuring the decoder. This pair holds the decoder fixed and still separates.

    The envelope is not where it goes, which the first comment got right for the wrong reason. The profile agrees with the benchmark at about 1 to 1.5% of a core, and it also names why that cost exists at all:

    SoftwareStoredPacket.encoded() -> PropertyListEncoder.encode
      -> __PlistEncoderBPlist.wrapGeneric
        -> Set._Variant.insert(_:)   -> Data.hash(into:) -> Hasher.combine(bytes:)
    

    The binary plist encoder hashes the whole 425 KB payload to deduplicate objects in its table, for a blob that can never be a duplicate. That is free to remove and worth removing on its own, but it is 1.5% and not 80%.

    Two things the corrected arm does NOT settle, stated because the numbers invite it:

    sample counts wall presence in a stack, not CPU, so the demux loop showing 7442 of 8334 samples inside waitForRenderer -> NSThread.sleepForTimeInterval means that thread is mostly asleep, not that it burns CPU there. What the stack does show is the shape: the renderer wait is a sleep-poll rather than a condition variable, and the sleep returns through cerror_nocancel on 255 of those samples. Naming where the 1.8x actually goes needs a CPU-attributed profile, not this one.

    And the runway asymmetry survives the correction but has a plain explanation rather than a defect behind it: buf is 47.3 s on native and 0.51 s on software, but the software spool's lookahead is only ahead=8.5 to 15.6 MB, about two to three seconds, with the 456 MB being mostly retained consumed history (retainConsumed: true). bufferedPosition is reporting honestly; the route simply runs on a short runway.

    Fixtures for the pre-registered bitrate leg are built, 4K HEVC with AC-3 5.1 at 40 Mbps, six minutes, with the 80 Mbps twin reproducible from the same command.

  8. superuser404notfound commented on Sep 22, 2026

    @superuser404notfound
    OwnerAuthor

    Released in 7.13.0 (18a18aac). Both consumers are pinned to it.

  9. cmcpherson274 commented on Sep 23, 2026

    @cmcpherson274

    Three reads, off logs that already existed, and then the pre-registered bitrate leg itself, run on the same Apple TV on 2026-09-22. The three reads answer the same at both pins, and two of them are not the answer the question expected. The leg rules out a turnover at ~220 s and a turnover set off by the spool budget's crossing on its own; what it leaves open is in §7. And the reference title itself, run once more through the same leg on a 7.13.0 build, did not turn over in 364 s of software session: one run, and a reading of 7.13.0 rather than of its frontier search alone (§8).

    Two pins for §§1-7, each measurement labelled with its own: 7.7.1 (fa67d586) on 2026-09-19 — the two runs this issue opens with — and 7.8.1 (b89240af) on 2026-09-21, a third run of the same leg on the same title from the same position, and again on 2026-09-22 for the four legs in §7. Apple TV 4K (3rd gen) AppleTV14,1, tvOS 26.6 (build 23L773, the one the box's own AppleCoreMedia user agent carries in every slice quoted here), app built on Xcode 27.0 / Swift 6.4. Prefixes trimmed; bare :N are lines in the named log. Engine source line numbers are at 7.7.1 unless said otherwise — and they are read at those two tags deliberately, since SoftwarePlaybackHost.swift moves again at 7.13.0 for AE#595's lazy still extractor, which is nowhere near this loop. Everything in §§1-7 ran on engines without 7.13.0's frontier search (7.7.1 and 7.8.1, §6); §8 is the one reading taken at 7.13.0, and it is labelled so.

    1. [SWHost] releasing rebuffer hold — it never appears. Not once, at either pin.

    run 1 (7.7.1, ;t=600) run 2 (7.7.1, ;t=3000) run 3 (7.8.1, ;t=600)
    audio lead exhausted 19 20 17
    rebuffered to 19 19 (the 20th never closed) 17
    releasing rebuffer hold 0 0 0

    Counted in Python over the whole slice, not with grep -c — the grep on this Mac is ugrep 7.8.4 and has mis-matched substrings on us before.

    The absence is real rather than a logging artefact, and that was checked rather than assumed. All three come out of the same loop through the same two-argument EngineLog.emit(_:category:) — SoftwarePlaybackHost.swift:2335 for the release, :2427-2431 for the exhausted and :2435-2439 for the rebuffered, all category: .swPlayback — and that overload delivers at .info (EngineLog.swift:55-57), which is the level our host handler receives. The two siblings are in all three endurance slices; the third would have been too. (They are absent from the four control slices, which have no pauses at all.) The literal also exists at both pins (:2335 at 7.7.1, :2371 at 7.8.1).

    So on this rig the read gate never held while a rebuffer hold was up, and waitForRenderer never waited under one — the release sits inside while stillWaiting() (:2383, the call at :2395), so a call that finds the gate already clear runs no body and logs nothing, and the zero is a count of waits rather than of calls. Your reading of what that means stands: the read was not gated, and the slowness is not self-inflicted by the gate.

    2. parkedPkts during the episodes — it climbs, and it never gets near the cap

    It does exactly what you predicted a stopped clock would make it do, and the ceiling it climbs toward is nowhere near 256.

    Run 3 (7.8.1), the tick immediately before each pause, the ticks inside the hold, and the first tick after the resume:

      ep 1: before=0  during=[0 11 28]  after=24    aLead during=[0.41 0.98 1.69]  hold=2.56s
      ep 2: before=0  during=[4 20 36]  after=28    aLead during=[0.66 1.17 1.97]  hold=2.92s
      ep 3: before=0  during=[0 15 33]  after=28    aLead during=[0.47 1.11 1.97]  hold=2.89s
      …
      ep17: before=0  during=[0 11 26]  after=30    aLead during=[0.15 0.92 1.49]  hold=2.84s
    

    before=0 on every one of the 19 / 20 / 17 episodes across the three runs. The FIFO is empty at the moment the clock stops and fills while it is stopped — the per-episode peak inside a hold runs 19–37 over the three runs (run 1 24–37, run 2 19–34, run 3 20–36) — and it is back to empty before the next pause, on all 56. At one-tick resolution the drain is not instant: the first tick after a resume is higher than the last in-hold tick on 28 of the 55 closed episodes, lower on 25 and equal on 2, because the resume lands mid-tick. rate reads the same loop from the clock's side: exactly 1.00 at the tick before every one of the 56 pauses and exactly 0.00 on every tick inside every hold — stopped, not slowed, with no deceleration ramp into it — so with parkedPkts=0 at those same 56 ticks, the loop is entirely healthy on the tick before it stalls.

    Whole-leg maxima, over 364 / 384 / 364 ticks: 84 · 85 · 84. parkedPkts is parkedVideo.count (:2963), which is precisely the quantity shouldHoldDemuxRead compares against parkedVideoCap = 256 (:664-672, :2282). It reaches a third of the cap at its highest point in any of the three runs, which is the same fact as §1 from the other side.

    vLead, since your own table carries it. The median is 0.50 in every run and in both phases, and the whole-leg range is 0.01–0.62 / 0.05–0.63 / 0.03–0.62. Phase 2 moves that median by about 0.10 — 0.51 / 0.52 / 0.51 in phase 1 against 0.41 in all three in phase 2 — while aLead over the same boundary falls by a factor of two — the video lead barely moves where the audio lead collapses, which is what a rebuffer decision keyed on the audio lead alone would do. The one place our material differs from your rig is the floor: our phase-2 minimum reaches 0.01 / 0.05 / 0.03 against the 0.42 and 0.45 you published, and all three of those ticks are inside a hold. It discriminates neither hypothesis — you have already read the field as the display layer's own queue target rather than a measure of upstream headroom — and it is here because it was in your table.

    The two clean software-host controls on the same box behave as the other end of the same scale: escape-real2 (1080p H.264, libavcodec, 64 ticks) holds parkedPkts 68–79 at 7.7.1 and 70–79 at 7.8.1, with aLead pinned at 4.00–4.03 at 7.7.1 and 3.99–4.03 at 7.8.1, and zero rebuffers; and a fourth, shorter software run on the 81 Mbps title itself (133 ticks, 7.8.1 + a host-side fix of ours) is clean throughout at 76–84 — it simply ended before 220 s.

    3. delay= and dpts= across both phases — delay never moves, in either phase

    delay= reads 0.00(+0.00) on every tick of every run — 364, 384 and 364 of 364, 384, 364, in phase 1 and phase 2 alike. One distinct value in each slice. It is available rather than absent (-1 would print as -, and layerDrop from the same loadRenderMetrics() call moves in the same ticks), so this is a measured zero.

    That is the field you named as the only one that shows frames displayed LATE, and it says none were. lost= is likewise 0(+0) on every tick of all three runs, and enq == disp in 363 / 383 / 363 ticks of 364 / 384 / 364.

    dpts= reads 41.0/42.0 on every tick of phase 1 in all three runs — dead on the 41.71 ms cadence of 23.976 fps — and takes exactly two values over a whole leg: 41.0/42.0, and - on the 84 ticks where nothing was enqueued at all, every one of which carries enq=+0 and so has no min/max spacing to report. Eighty-two of those 84 are inside a rebuffer hold and two are not — run 2 :2024 (clk=3372.11 … aLead=2.07 … rebuf=n enq=+0 disp=+0 … dpts=-) and run 3 :1850 (clk=947.97 … aLead=1.95 … rebuf=n enq=+0 disp=+0 … dpts=-) — which is the right way round: the - tracks the empty enqueue, not the hold. It never widens and never shifts.

    So the picture in phase 2 is stopped, not late. Nothing arrives behind its deadline; the clock simply spends 37 % of the wall stationary — that figure being 1 − dclk from your own field, meaning the mean dclk over the phase-2 ticks, which reads 0.6228 / 0.6319 / 0.6230 against the 0.627 and 0.635 you published for the first two runs.

    4. The two cheaper confirmations

    cachedBytes is not in our logs, and the reason is worth a sentence. The 30 s memprobe line does not carry it at either pin: AetherEngine+Diagnostics.swift:319-367 builds the line, and cachedBytes (:524-528) reaches LiveTelemetry through the sampler (LiveTelemetrySampler.swift:402, at 7.7.1) and nothing else. What the memprobe prints on a software session is cacheMB and cacheCount, which come from nativeVideoSession?.diagnosticStats() and therefore read 0 the whole way through.

    But the memprobe does carry a byte series for the software route, which we had not read either. pumpFetchedMB is softwareHost.demuxer.avioBytesFetched / 1024 / 1024 (AetherEngine+Diagnostics.swift:448-467 readerWindowFragment, fed at :305-309; SoftwarePlaybackHost.swift:41-43) — the producer's own lifetime fetch, in MiB, every 30 s. It does not plateau; it climbs to the last sample of every run. Run 3:

      t=  30 s   883 MiB        t= 210 s  2465 MiB
      t=  60 s  1210 MiB        t= 240 s  2698 MiB   <- first rebuffer, +238.9 s on the clock
      t=  90 s  1519 MiB        t= 270 s  2905 MiB
      t= 120 s  1768 MiB        t= 300 s  3121 MiB
      t= 150 s  1974 MiB        t= 330 s  3320 MiB
      t= 180 s  2190 MiB        t= 360 s  3530 MiB
    

    Free space, which sets the budget, is in every one of our endurance slices already. The engine logs it from the native session that precedes the escape: [HLSVideoEngine] segment retention budget: 2048 MiB (volumeAvailable=100041 MiB, forwardWindow=10 seg) (run 3 :93; run 1 101579 MiB :94, run 2 101361 MiB :95). Both callers read the same NSTemporaryDirectory() volume through the same sessionRetentionBudgetBytes (HLSVideoEngine.swift:813-819 at 7.7.1, which is the :820-825 you quoted at a later pin; SoftwarePlaybackHost.swift:936-941), so the free/4 clamp does not bind here: ~98 GiB free, quarter of free ~25,000 MiB, and the spool's budget is the full 2 GiB cap.

    Which lets the crossing be located on the device, and it is not where the turnover is. In retainConsumed: true the spool grows with everything produced, so pumpFetchedMB is a proxy for its residency — imperfect in both directions (it counts container bytes the demuxer read rather than plist-encoded packet payload), which is why it is offered as a bound and not a measurement. Interpolating 2048 MiB on that series:

    run 1 (7.7.1) run 2 (7.7.1) run 3 (7.8.1)
    2 GiB crossed at 161.4 s 166.4 s 160.4 s
    first audio lead exhausted 219.1 s 238.2 s 238.9 s
    gap 57.7 s 71.8 s 78.4 s

    Both rows are wall seconds from that run's own [SWHost] session start, and the crossing is linear interpolation between the two 30 s samples that bracket 2048 MiB. That matters to the last figure. The memprobe's t= label is its own nominal grid and drifts from the session clock across a leg: +0.05 s at the first software sample, +0.99 s by t=360 s, and +0.16 to +0.42 s at the two samples that bracket 2 GiB. Reading the crossing off the label while reading the exhaust off the clock moves run 3's gap from 78.4 to 78.6 — a tenth that crosses a rounding boundary. One axis, both rows.

    And nothing happens at the crossing. Over the 20 ticks within ±10 s of it, in all three runs: dclk 1.00, rate 1.00, aLead 3.95–4.03, parkedPkts 79–85, layerDrop flat, delay= 0.00(+0.00), lost= 0(+0). That is an independent confirmation of your retraction, on the hardware rather than on a Mac, and from a different direction: the crossing on our box lands 58 to 78 seconds before the turnover — the read-ahead front-loads its 40 s forward window, so 883 MiB have already been read at t=30 s — and costs nothing when it happens. Read, not resident: pumpFetchedMB is demuxer.avioBytesFetched, which is the caveat above the table and the reason the crossing is offered as a bound.

    Thermal: there is no reading in any device slice, and the reason is structural rather than an omission. The engine does have one — [LagDiag] … thermal=nominal, LiveTelemetrySampler.swift:441-459 at 7.7.1 (:444-462 at 7.8.1 — the file shifted by three lines, so quote the pin with the anchor) — but it is emitted level: .verbose, which reaches OSLog debug and never a host handler, and its only caller is gated if let readings = nativeReadings (:386-387 at 7.7.1), so the software host does not produce it at any log level. We have it on the simulator only, off a log stream --level debug capture of a native session. Your own note that a thermal state beside [SWDiag] would be cheap is exactly right, and today's line cannot stand in for it.

    No memory event in the window. The device carries exactly one jetsam report — JetsamEvent-2026-08-28-083632.ips, three weeks before any of these legs — and it is present, unchanged, in the crash census taken before and after every E-8 hold, so nothing in this campaign added one. No memory-pressure note appears in any 2026-09-19 or 2026-09-21 device slice, and the two cpu_resource reports we hold (Action taken: none) carry no storage and no thermal field at all.

    5. The bytes, since that is what the new title asks about

    Same box, same title, same starting position (;t=600), same stretch of film, both routes, 30 s samples of the same field family (pumpFetchedMB is software-first, native-second — pumpBytesFetched, AetherEngine+Diagnostics.swift:512-514):

    software route (7.8.1, run 3) native route (7.7.1 control)
    peak 30 s window 91.4 Mbps (t=30→60) 101.2 Mbps (t=240→270)
    t=30 → t=360 s 2,647 MiB = 67.3 Mbps 3,591 MiB = 91.3 Mbps
    t=30 → t=420 s — (leg ended) 4,222 MiB = 90.8 Mbps
    the four degraded windows t=240→360 mean 208 MiB/30 s = 58.2 Mbps —

    Three caveats on that table, all in the direction of not over-reading it. The two columns are at different pins — the software column is run 3 at 7.8.1 and the native control is at 7.7.1, so the 90.8 Mbps that agrees with your own figure stays a 7.7.1 reading and the pair is a route comparison across a pin rather than within one. The title is VBR (its master manifest declares BANDWIDTH=178229052,AVERAGE-BANDWIDTH=89114526), so a 30 s byte count is the local content rate as much as a capability; and the two sessions cover slightly offset media windows, because the software arm played about 57 s on the native route before the escape (presenting (gen 1) :152 19:21:21.720 → dispatched (gen 2) :283 19:22:18.676, and on the media axis startPosition=600.00s :94 → the software session's first clk=657.04 :362). What survives all three: the software route's own reader was observed sustaining 91.4 Mbps for a 30 s window early in the session, and averaged 58.2 Mbps across the degraded phase with the consumer blocked on it 63.7 % of the wall and reservoir=0.0s on 135 of its 138 starvation lines (the other three read 0.2s). It is not topping out below the container rate; it stops being able to reach it.

    The reservoir is the thing that drains, and aLead is not. aLead holds at or above 3.90 on 196 of the 219 pre-pause ticks in run 1, 216 of 238 in run 2 and 209 of 238 in run 3 — the last such tick at +196 s, +226 s and +227 s — and then decays to the pause threshold in 23.1 s, 12.1 s and 11.8 s. What moves under it the whole time is the read-ahead's own forward window, 20.1 s → 10.0 s, with the producer promoting itself back to userInitiated at the second reading:

    run 1 (7.7.1) run 2 (7.7.1) run 3 (7.8.1)
    producer qos -> utility +3.0 s, reservoir=20.1s +3.1 s, 20.0s +3.0 s, 20.1s
    producer qos -> userInitiated +169.7 s, 10.0s +168.0 s, 9.9s +171.4 s, 10.0s
    implied drain 6.06 % 6.12 % 6.00 %
    starvation lines, all qos= 119, all userInitiated 159, all userInitiated 138, all userInitiated
    of those, reservoir=0.0s 118 of 119 157 of 159 135 of 138
    consumer blocked, phase 1 1 line at +0.1 s 3.4 % of wall 3.1 % of wall
    consumer blocked, phase 2 53.3 % of wall 67.4 % 63.7 %

    Phase 1 is [SWHost] session start to the first audio lead exhausted; phase 2 is that first exhaust to the last consumer starved line, and the blocked seconds are the difference of the cumulative blocked= counter across each span. Taking phase 2 to the last [SWDiag] tick instead moves them to 53.3 / 67.3 / 63.5, which is the size of the choice.

    6. What moved above our pin, and the arms as registered

    Written before your last three comments, re-cut after them, and re-cut again after the legs in §7 and §8 ran. We read the envelope retirement, the file:// correction that took the asymmetry back to ~1.8x on a live spool, and 7.13.0. Sections 1-5 stand as readings — sections 1-3 are the three reads you asked for, section 4 the two cheaper confirmations, section 5 a byte series off the same device — and none of them touches the envelope. The CPU question is where 7.13.0 moved.

    7.13.0's frontier search is the one change above our pin made for this issue, and it lives in the producer §5 is about. 3e9188bd (PR #604) turns SoftwarePacketCoverage.frontierSeconds(containing:timeBaseNumerator:timeBaseDenominator:) from a walk over the coverage's ranges into a binary search, +29 −6 in that file (:79-99 at 7.8.1; :79-122 at 7.13.0, and at 7.14.0, where the file is unchanged). Its per-packet caller is the read-ahead producer's park check — shouldParkLocked (SoftwarePacketReadAhead.swift:444-460, evaluated by the produce loop at :355) falls through to frontierLocked (:305-321), for the video and the audio coverage both — in a file that is byte-identical from 7.8.1 through 7.14.0, and that producer is the one whose consumer starved lines are counted in §5's second table. Your release note puts the fix at 15.25 % → 14.17 % process CPU on a 4K HEVC 40 Mbps AC-3 5.1 session over an HTTP origin with the spool held at 460 MB, and the commit's own pair is 14.71 / 15.28 % → 13.97 / 13.02 %. (The other 7.13.0 commit on this issue, f4dd999d, is the test that priced the envelope.)

    Every reading in §§1-7 ran on engines without it (7.7.1 and 7.8.1), and none of our logs can say how the walk was doing. §§1-5 are 7.7.1 and 7.8.1, and so is §7, which ran on 2026-09-22 at 7.8.1 because 7.8.1 is the engine we ship. rangeCount exists on both coverage types (SoftwarePacketCoverage.swift:22, and SoftwareVideoPacketCoverage.swift:43, which forwards it), but nothing in Sources reads it beyond that forwarding definition, at 7.8.1 or at 7.14.0 — at 7.14.0 its only readers are Issue592CoverageFrontierTests.swift:57 and :70 — so the island count of our sessions is in no slice we hold, and we make no claim about it. 7.13.0 also differs from 7.8.1 in more than the search (48 commits, 36 engine source files, the reader and the demuxer among them), so the reading in §8 is a reading of 7.13.0 and not of the search alone.

    What also moved is that you have a fixture of your own: the 40 Mbps one, 4K HEVC with AC-3 5.1, six minutes, with its 80 Mbps twin reproducible from the same command. Ours are a different experiment rather than the same one, and both differences are in the direction of your predicted turnover: feature-length real library titles, streamed from Jellyfin over HTTP on the Apple TV, on a box with ~98 GiB free so the retention budget is the full 2 GiB cap rather than the available / 4 clamp. But 40 Mbps sits between our two arms (31.3 and 25.7 Mbps) and the reference (89.1), which is exactly where §7 has nothing, and yours carries AC-3 5.1, the reference's own audio family. If you are willing to publish the 40 Mbps file and the command that builds its 80 Mbps twin, we would run both through the same rig on this Apple TV, started at the head of the file rather than at our leg's 600 s, so that your bench and ours would be reading the same bytes. Every endurance title in this reply — the reference and both arms — is Dolby Vision profile 8.1; if yours is not, that is a variable of its own, and we would report it beside the reading.

    One piece of arithmetic on those two rates, offered as a question rather than a correction. Six minutes at 40 Mbps is 1.80 GB = 1.68 GiB, and six minutes at 80 Mbps is 3.60 GB = 3.35 GiB. Against a 2 GiB budget the 80 Mbps twin would cross at 215 s, 4 to 24 s before the reference turned over (219.1–238.9 s); the 40 Mbps file never reaches 2 GiB inside itself. On a box where available / 4 binds instead — the 5.6 GiB free you report in the correction would clamp the budget to 1.4 GiB — the same two cross at 150 s and 301 s. §7 finds the crossing free on this box at two more rates, and §8 at the reference's own rate on 7.13.0; the segment retention budget: line is still worth printing beside any reading of them. And on our rig a six-minute file leaves about five minutes of software session after the minute the escape spends on the native route, which would cover the 80 Mbps twin's turnover if turnover scales with the rate from the reference (244–266 s), and not the 40 Mbps file's (488–532 s).

    Our arms, with the predictions written down first. Two lower-bitrate arms rather than one, both feature-length 2160p Dolby Vision profile 8.1 like the reference, both Matroska, and both carrying an E-AC-3 default track — the same decoder family as the reference's AC-3, so the audio bridge is not introduced as a second variable:

    arm source / video 2 GiB ÷ source 2 GiB ÷ video scaled from our measured 160 s crossing the time hypothesis
    A, 100 min 31.3 / 30.6 Mbps 548 s 562 s 455 s ~220–239 s
    B, 130 min 25.7 / 24.9 Mbps 669 s 690 s 555 s ~220–239 s
    the reference 89.1 / 81.1 Mbps 193 s 212 s (measured 160–166 s, at 7.7.1 and 7.8.1) measured 219.1 / 238.2 s (7.7.1) / 238.9 s (7.8.1)

    Each software session was to be held past its own byte prediction — ~630 s for A and ~770 s for B — and they ran 644.1 s and 785.1 s (§7); each arm is paired with a native control from the same position, so a byte series like §5's exists for both routes on both titles rather than on one. A ~44 Mbps midpoint exists in the library and was deliberately not used: its default track is TrueHD 8-channel, which changes the audio decode cost on the very host whose cost is one of the two surviving hypotheses.

    One change to the arms before they ran, stated with its reason. Arm B was first a DOVIWithHDR10Plus title, where the reference and arm A are DOVIWithHDR10, and on the software host the decode callback carries hdr10PlusData per frame straight into renderer.enqueue (SoftwarePlaybackHost.swift:813 and :818 at 7.8.1, with the per-session first-detection hook at :852-853) — the same class of second variable as the TrueHD one, on the same host. We swapped it for a DOVIWithHDR10 title before the run. 26 of the 41 P8.1 2160p titles in our retained probe responses whose video rate falls in the 24.4–25.7 Mbps band are DOVIWithHDR10 with an E-AC-3 6-channel English default (24 of 27 by source rate); the one we ran is Matroska, 130 minutes, at a source rate 0.785 % below the first choice's, which moved the byte prediction from 664 s to 669 s, the video-rate one from 691 s to 690 s and the scaled one from 551 s to 555 s — the table above carries the arm as run. Its HEVC level is 5.0 where arm A's and the reference's are 5.1; we note that rather than claim it is inert. No prediction had been posted here, so nothing already public moved.

    The separation was the point: 548 s and 669 s against a time hypothesis of ~220–239 s, on a box where the cap binds. The predictions above are the ones written down before the run; §7 is what it measured.

    It ran on 2026-09-22 between 18:01 and 18:43 EDT: the two software arms and their native controls, four legs in one hold, all at 7.8.1.

    7. The pre-registered bitrate leg, run 2026-09-22 at 7.8.1

    Same Apple TV, same rig and same engine as run 3, 7.8.1 (b89240af), in a newer build of our app: start at 600 s, with our test latch holding the first-frame signal for 75 s so that the #461 escape moves each session onto the software path at 60 s alive with no picture. The escape ran as it does in run 3 — arm A decode-path escape … (#461) :281 → option correction done (preferredDecodePath=software) :359, arm B :266 → :332 — after 57.5 s and 57.6 s on the native route (presenting (gen 1) → dispatched (gen 2); run 3's was 57.0 s). Both sessions opened [SWHost] selected HardwareVideoDecoder (VT HEVC) for codec_id=173 and [AudioDecoder] Opened: 48000Hz, 6ch, codec=eac3, the same decoder family as the reference's AC-3 (both tracks are Atmos E-AC-3, [JOC=Atmos] at arm A :114 and arm B :101, which the reference's AC-3 is not), and the budget line puts both on the full 2 GiB cap (segment retention budget: 2048 MiB (volumeAvailable=100266 MiB, …) arm A :111, 100241 MiB arm B :98). Each software arm was followed by a native control from the same position for 420 s. Every figure below is counted in Python from the four leg logs, and time is on one axis throughout: wall seconds from that session's own [SWHost] session start (arm A :345, arm B :319).

    arm (pin) title source route decoder line software session audio lead exhausted 2 GiB crossed at verdict
    A (7.8.1) 100 min, DV P8.1, E-AC-3 5.1 31.3 Mbps software selected HardwareVideoDecoder (VT HEVC) :347 644.1 s, 644 ticks 0 439.6 s no turnover; 204.5 s clean past the crossing
    A control (7.8.1) same title, same position 31.3 Mbps native started (route loopback, 3.1s) :194 none (420 s native) n/a not reached (1,955 MiB at 420 s) clean
    B (7.8.1) 130 min, DV P8.1, E-AC-3 5.1 25.7 Mbps software selected HardwareVideoDecoder (VT HEVC) :321 785.1 s, 785 ticks 0 613.9 s no turnover; 171.2 s clean past the crossing
    B control (7.8.1) same title, same position 25.7 Mbps native started (route loopback, 3.2s) :180 none (420 s native) n/a not reached (1,465 MiB at 420 s) clean
    reference, run 1 (7.7.1) 125 min, DV P8.1, AC-3 5.1 89.1 Mbps software selected HardwareVideoDecoder (VT HEVC) 364.1 s, 364 ticks 19, first at 219.1 s 161.4 s turnover 57.7 s after the crossing
    reference, run 2 (7.7.1, from 3000 s) same 89.1 Mbps software the same 384.0 s, 384 ticks 20, first at 238.2 s 166.4 s turnover 71.8 s after
    reference, run 3 (7.8.1) same 89.1 Mbps software the same 364.0 s, 364 ticks 17, first at 238.9 s 160.4 s turnover 78.4 s after

    Source is the served manifest's AVERAGE-BANDWIDTH (arm A :140 31339911, arm B :127 25673639, the reference 89114526 as in §5). The reference rows repeat §2's and §4's figures.

    Both software sessions, on every tick: rate=1.00 (644 of 644, 785 of 785), rebuf=n, delay=0.00(+0.00), lost=0(+0), corrupt=0. audio lead exhausted, rebuffered to and releasing rebuffer hold occur 0 times in both slices, and so does the bare substring releasing. aLead 3.97–4.03 on both. parkedPkts 74–85 on A after its first ten ticks (the first reads 12, the session filling) and 74–86 on B throughout, close to the 68–84 that §2's clean controls held. vLead median 0.51 and 0.52, 0.43–0.64 and 0.41–0.65 after the first ten ticks. dpts=41.0/42.0 on 785 of 785 B ticks and on 641 of 644 A ticks, the other three being A's first seconds (two - with enq=+0, one 41.0/41.0); enq == disp on every tick but each session's first; layerDrop 0 → 16 over A and 2 → 2 over B.

    Where the reference turned over — 219.1, 238.2 and 238.9 s — both arms were unremarkable: the 60 ticks between 200 and 260 s of session read rate 1.00 and dclk 1.00 on every one, aLead 3.99–4.03 (A) and 3.97–4.03 (B), parkedPkts 77–83 and 74–81, rebuf=n.

    The read-ahead said two things in each session and then nothing for the rest of the leg: the start-of-session consumer starved: waits=1 blocked=0.01s reservoir=0.0s qos=userInitiated at +0.1 s (A :363, B :336 — the same line, to the character, that all three reference runs open with) and producer qos -> utility (now=utility reservoir=20.1s …) at +0.8 s and +0.9 s (A :377, B :348). Neither has a producer qos -> userInitiated line, so the reservoir never came back down to the 10 s boost point, and neither has a starvation line after the first tenth of a second.

    pumpFetchedMB, the software host's own reader (§4), and its native counterpart on the controls, with the windows taken on the wall clock between consecutive 30 s samples:

    A, software A, native control B, software B, native control
    first → last sample 238 → 2,889 MiB (:441 → :2047, 30.3 → 631.3 s) 340 → 1,955 MiB (:250 → :693) 253 → 2,570 MiB (:418 → :2083, 30.3 → 781.4 s) 279 → 1,465 MiB (:232 → :760)
    30 s windows 33.1–42.8 Mbps, mean 37.0 (20) 15.3–53.5 Mbps, mean 34.7 (13) 23.5–29.1 Mbps, mean 25.9 (25) 22.1–29.9 Mbps, mean 25.5 (13)
    against the title's AVERAGE-BANDWIDTH 1.18x 1.11x 1.01x 0.99x

    Arm A's reader ran above its title's average over the stretch it played, and so did its native control over an overlapping one (600 s to about 1,020 s of the film, against the software session's 654 s to 1,297 s); the title is VBR, as §5 said of the reference. Neither control reaches 2 GiB inside 420 s.

    On the same series, interpolated exactly as in §4, 2048 MiB is crossed at 439.6 s on arm A (between :1484, 1,962 MiB at 421.0 s, and :1566, 2,101 MiB at 451.0 s) and at 613.9 s on arm B (:1683, 2,005 MiB at 601.2 s, to :1751, 2,106 MiB at 631.2 s) — both earlier than the 548 s and 669 s predicted, because the read-ahead front-loads its window (238 and 253 MiB were already read at 30 s, as 883 MiB were on the reference) and, on A, because its reader ran above its title's average. A then played 204.5 s past its crossing and B 171.2 s; the 20 ticks within ±10 s of each crossing read rate 1.00, aLead 3.98–4.02 and 3.99–4.03, parkedPkts 77–82 and 74–81, delay=0.00(+0.00), lost=0(+0). The reference turned over 57.7 to 78.4 s after its own crossing. §4's caveat applies unchanged: pumpFetchedMB is bytes read, so each crossing is a bound, not a residency.

    Your pre-registration, as you put it on 2026-09-22 at 09:04 UTC:

    If turnover scales as budget / bitrate, half the bitrate buys roughly twice the clean stretch; if it turns over at around 220 s regardless of bitrate, both byte-keyed hypotheses die and thermal or CPU owns it.

    The second branch did not happen. Neither session turned over at around 220 s, or at all: 644.1 s and 785.1 s of software session at 35 % and 29 % of the reference's source rate, rate=1.00 on every tick. So on this box at 7.8.1 thermal or CPU does not own it as a clock.

    The first branch, as the mechanism it was registered with, did not happen either. Both byte-keyed hypotheses put the clock at the spool budget; the budget was crossed at 439.6 s and 613.9 s and the sessions ran 204.5 s and 171.2 s clean past it, more than twice as long as the reference ran past its own (57.7–78.4 s). That is your retraction of the crossing as a cost, on the hardware, at two more rates: the crossing on its own does not turn a session over at 26 or 31 Mbps on this box. A crossing-keyed cost that only bites at the reference's rate is not ruled out by this; it belongs to the rate question below.

    What the legs do not rule out, and we would rather say it than have you find it, is the first branch's bare arithmetic. Scaled from the reference's own 219.1–238.9 s by source rate, budget / bitrate puts arm A's turnover at 623–679 s and arm B's at 761–829 s, and the legs ended at 644.1 s and 785.1 s, inside both windows (by video rate the windows are 582–634 s and 714–778 s, which the legs clear by 10 s and 7 s — not a margin to lean on). We sized the legs against the crossing, not against that. The one handle on it is bytes: on §4's series the reference turned over at 2,508 and 2,628 MiB read at 7.7.1 and 2,687 MiB at 7.8.1, and arm A read past 2,889 MiB (:2047, 631.3 s) with nothing moving, which a trigger keyed to the bytes the path has moved would not allow; arm B ended at 2,570 MiB (:2083) and does not test it.

    So, in your terms: the ~220 s clock is gone; the spool budget, on its own, is not what turns a session over at 26 to 31 Mbps; and a turnover that scales with the bytes moved is contradicted by arm A, by 202 to 381 MiB, and untested by arm B. What remains, at 7.8.1, is chiefly what the two arms and the reference differ on — the rate the software path has to carry (they also differ in content, in audio codec and, for arm B, in HEVC level). §5 is what the reference looked like at its rate, in run 3 at 7.8.1: the reader at 91.4 Mbps in its first window and 58.2 Mbps averaged across the degraded phase, the reservoir at 20.1 s at +3.0 s and at 10.0 s at +171.4 s, reservoir=0.0s on 135 of its 138 starvation lines. One ordering is worth adding to that: the first starvation line after the start of the session comes at +225.8 s in run 2 and +226.7 s in run 3, before those runs' first exhausts at 238.2 s and 238.9 s, but at +246.4 s in run 1, twenty-seven seconds after its first exhaust at 219.1 s — so the reader was not yet starving the consumer when run 1 began to turn over. The two arms never came near any of it: no boost, no starvation line after the first tenth of a second, readers averaging at or above their titles' rates over the whole leg (1.18x and 1.01x).

    One reading fits all three titles, and it is an inference, not a finding: that what the software path on this box can carry at 7.8.1 lies somewhere above what arm A asked of it — its reader held 37.0 Mbps for 601 s without the reservoir once falling to the boost point — and below what the reference asked of it. This leg does not measure where that line is, because nothing between 31 and 89 Mbps ran, and it does not say what the line is made of: a per-byte cost the box carries at 37 Mbps and not at 89 would look exactly like this, so what it retires is CPU as a clock, not CPU. The run-1 ordering above is a reason not to assume the line is the reader's alone.

    The discriminator for both open questions is one more rate, between the two populations, held as long as these were. A ~45 Mbps title puts the scaled budget / bitrate window at about 434–473 s, well inside a leg of this length, so one run would place a point between 31 and 89 Mbps and settle the bare arithmetic too. Every title of this class near that rate that we have probed, six of them from 43.6 to 46.0 Mbps source, has a TrueHD or DTS 8-channel default, the class of confound §6 declined, and the library's others at that rate are unprobed; your 40 Mbps fixture has the right audio family, and on our rig its six minutes are enough for the rate question — the reference turned over inside its first four minutes of session at 7.7.1 and 7.8.1 — and not for the arithmetic one (§6). Running A or B again past about 680 s or 830 s of session would settle the arithmetic without placing the point.

    All four legs ran at 7.8.1, and both software legs ran with the frontier walk that 7.13.0 removed. Whatever the island count was on these two titles — it is in no log (§6) — the walk did not turn either session over, 644 s at 31 Mbps and 785 s at 26 Mbps. Whether it is part of what turned the reference over is the question §8 puts to 7.13.0: the reference title, from the same position, through the same rig.

    8. The reference title again, run 2026-09-22 at 7.13.0

    One leg, on a build of our app whose only change from §7's is the engine pin and the strings that name it: AetherEngine 7.13.0 (18a18aac), with FFmpegBuild 3.4.0, the same FFmpeg libraries as 7.8.1, so between this build and §7's the engine source is the only variable, and every figure this leg produced is a 7.13.0 reading; the figures from runs 1 and 3 and from earlier sections set beside them keep their own pins. Runs 1 and 3 ran on earlier builds of our app, as §7 says of run 3, and from a different place in their hold: each ran third after the app was installed, following two escape legs of about two minutes each on other Dolby Vision titles, where this one ran first, straight after the install, so the box's state going into the leg was not matched, and it was not recorded. Same Apple TV, same title, same position and same recipe as runs 1 and 3: start at 600 s, the 75 s latch, the #461 escape at 60 s alive with no picture — decode-path escape … (#461) :283 → option correction done (preferredDecodePath=software) :351, after 56.7 s on the native route (presenting (gen 1) :155 → dispatched (gen 2) :286; 56.9 s in run 1, 57.0 s in run 3). The session opened [SWHost] selected HardwareVideoDecoder (VT HEVC) for codec_id=173 :340, [HardwareVideoDecoder] opened HEVC 3840x2160 10-bit :342 and [AudioDecoder] Opened: 48000Hz, 6ch, codec=ac3 :343, as runs 1 and 3 did, on the full 2 GiB cap (volumeAvailable=100125 MiB, :97); started (route software, 75.1s) :460 is our latch releasing. Time is wall seconds from [SWHost] session start (:338), the axis of §4 and §7.

    run (pin) software session audio lead exhausted 2 GiB crossed at reader, the nine 30 s windows after the first two verdict
    this leg (7.13.0) 364.1 s, 364 ticks 0 136.3 s 86.0–94.8 Mbps, mean 90.9 no turnover; 227.8 s clean past the crossing
    run 1 (7.7.1) 364.1 s, 364 ticks 19, first at 219.1 s 161.4 s 53.1–71.0 Mbps, mean 59.7 turnover 57.7 s after the crossing
    run 3 (7.8.1) 364.0 s, 364 ticks 17, first at 238.9 s 160.4 s 55.6–76.7 Mbps, mean 62.4 turnover 78.4 s after

    On every one of the 364 ticks: rate=1.00, rebuf=n, delay=0.00(+0.00), lost=0(+0), corrupt=0, dpts=41.0/42.0, and dclk 1.00 on every tick after the first. audio lead exhausted, rebuffered to and releasing rebuffer hold occur 0 times; the bare substring releasing occurs once, in #597 background teardown: releasing the video pipeline (:2077), logged when the app was sent Home to end the leg. aLead 3.94–4.03, parkedPkts 75–85, vLead median 0.52 (0.37–0.62), enq == disp on every tick but the first, layerDrop 2 → 7, and the memprobe's swDropped at 2 of 8,647 frames by the last sample (run 1: 125 of 7,360; run 3: 113 of 7,561). The 126 ticks from 239 s to the end of the session, which ran 145.0 s past run 1's onset and 125.2 s past run 3's, read rate and dclk 1.00, aLead 3.94–4.03, parkedPkts 76–84.

    The read-ahead said two things and then nothing, as on §7's arms: the start-of-session consumer starved: waits=1 blocked=0.01s reservoir=0.0s qos=userInitiated at +0.1 s (:355) and producer qos -> utility (… reservoir=20.0s …) at +3.1 s (:378). There is no producer qos -> userInitiated line (runs 1 and 3: +169.7 s and +171.4 s, reservoir 10.0 s) and no starvation line after the first tenth of a second (runs 1 and 3: 118 and 137 of them, the first at +246.4 s and +226.7 s).

    pumpFetchedMB on the same stretch of film, in Mbps on the wall clock between consecutive 30 s samples:

      memprobe t=     30→60   →90  →120  →150  →180  →210  →240  →270  →300  →330  →360 s
      7.13.0           93.2  89.9  90.2  93.5  89.2  94.8  91.1  92.8  92.9  86.0  87.6
      run 3 (7.8.1)    91.4  86.1  69.6  57.6  60.4  76.7  64.9  57.8  60.3  55.6  58.6
      run 1 (7.7.1)    93.3  84.4  69.0  55.3  63.0  71.0  61.2  56.0  55.0  54.0  53.1
    

    The three agree to within 6 Mbps over the first two windows. From the third on, runs 1 and 3 read 53–77 Mbps, and the fall began while their clocks still ran at 1.00, before the producer's boost at 169.7 s and 171.4 s and well before either turned over; this leg read 86–95 Mbps to the end, 91.0 Mbps first sample to last (3,585 MiB over 330.4 s, :535 → :2056), 1.02x the title's AVERAGE-BANDWIDTH and about what the native route's reader sustained on this title in §5 (90.8 Mbps, at 7.7.1). 2048 MiB is crossed at 136.3 s (:954, 1,870 MiB at 120.3 s, to :1095, 2,205 MiB at 150.3 s), earlier than in runs 1 and 3 because this reader did not slow, and the 20 ticks within ±10 s of it read rate 1.00, aLead 3.95–4.02, parkedPkts 75–81. By 219.1 s and 238.9 s of session, where runs 1 and 3 first exhausted at 2,508 and 2,687 MiB read, this reader had read 2,958 and 3,172 MiB, and it ended at 4,476 MiB (:2056, 360.6 s) with nothing moving. §4's caveat applies: bytes read, a bound, not a residency. The spool is the same code at both pins: SoftwarePacketReadAhead.swift, SoftwarePacketDiskFIFO.swift and SoftwareStoredPacket.swift are byte-identical from 7.8.1 to 7.13.0, the host builds the spool with the same block (SoftwarePlaybackHost.swift:941-976 at 7.8.1, :935-970 at 7.13.0), and sessionRetentionBudgetBytes (HLSVideoEngine.swift:820) is unchanged. No #561 line appears, so 7.9.0's escalation played no part.

    What this is. One run at 7.13.0, against three on this title at 7.7.1 and 7.8.1 that all turned over inside 240 s (runs 1-3; runs 1 and 3 from this position). A 364 s session, so the reading is no turnover before ~364 s, not no turnover at all. And 7.8.1 to 7.13.0 is 48 commits in 36 engine source files, the reader and the demuxer among them (§6), so this is a reading of 7.13.0 and not of the frontier search on its own.

    What it says, within that. A clock set by the title alone, one the engine cannot move, would have turned this session over inside 240 s, where all three earlier runs turned over; it did not. A clock set by the box is not ruled out as cleanly, because the box's state going into this leg was not matched (above) and there is no thermal reading on either side (§4); what argues against it, at a lower rate, is §7's arm B, which ran 785 s clean at 7.8.1 as the third leg of its own hold. The spool budget's crossing is free here at the reference's own rate, on the same spool code and the same 2 GiB cap, and a turnover keyed to the bytes the path has moved, which arm A contradicted at 31 Mbps on 7.8.1, is contradicted at 89 Mbps on 7.13.0, whose reader went 1,789 to 1,968 MiB past the bytes at which runs 1 and 3 turned over: neither byte-keyed reading of the crossing, the cost one or the memory one, is enough on its own at this rate on this engine. What the leg does show is where this run at 7.13.0 parts from runs 1 and 3 at 7.7.1 and 7.8.1. None of what accompanied the turnover in runs 1 and 3 appears in this one: the reader falling off from about 90 s into the session while the clock still ran, the boost at 169.7 s and 171.4 s, the starvation lines from 246.4 s and 226.7 s. That is the producer your frontier search sits in, and it is the shape your commit gives the walk, cheap early and expensive later; but the reader and the demuxer moved in the same span, and one run cannot tell the search from them. Nor does it measure how much of the box the software route needed to do it: there is no CPU reading here.

    What would firm it up. A second 7.13.0 run of this leg, held past 364 s and run third after the same two escape legs as runs 1 and 3: a second sample, a matched start, and the way to see a later onset if 7.13.0 moved the turnover rather than removed it. And a ~45 Mbps title (§7), with its audio confound, still places a point between 31 and 89 Mbps: at 7.8.1 it settles §7's arithmetic, and at 7.13.0 it says whether anything between the two rates still turns over.

  10. superuser404notfound commented on Sep 23, 2026

    @superuser404notfound
    OwnerAuthor

    Thank you, this settles more than it asked. Taking the readings as given: the read gate never held under a rebuffer hold (§1), the FIFO is empty at every pause and fills during it (§2), nothing is late (§3), and the spool budget's crossing is free at three rates on the hardware (§§4, 7, 8). The ~220 s clock is gone at 26 and 31 Mbps. That leaves the rate question, and one run at 7.13.0 that did not turn over.

    §8 cannot be read as the frontier search yet, and the reason is on our side

    The search only buys something if the coverage has many islands. I measured that today instead of assuming it, with a temporary counter in the producer (the instrument your §6 noted nothing reads), and the answer depends on the muxer, not on the engine.

    On HEVC the read-ahead keeps its video coverage from pts + duration. The reorder-aware presentation coverage is built for H.264 only (SoftwarePlaybackHost.swift:948, videoReorderDepth is 32 for H.264 and nil otherwise), so every other codec gets the plain SoftwarePacketCoverage, which merges touching ranges and deliberately tolerates no gap, not even one tick.

    My fixture fragments because of how FFmpeg muxed it. Its video packets carry duration=41 against PTS deltas of 41 and 42 ms, so every 42 ms step leaves a 1 ms hole:

    first 10 s of video: 240 frames, 169 gaps (0.704 per frame)
    engine counter over a 90 s software session, HTTP origin:
      n=2500 video(plain)=769  audio=1
      n=7500 video(plain)=2307 audio=1
    

    Same ratio from both sides. At 0.70 islands per frame and 23.976 fps, the 4096-range cap is reached after about 241 s of stored video. That is arithmetic, not a measurement. It is also what made the walk visible in the profile behind 3e9188bd, and it is why that commit's "cheap early, expensive later" described that fixture.

    A title muxed by mkvmerge or MakeMKV should not fragment at all. Those write DefaultDuration as 41708333 ns, and matroskadec turns that into a packet duration with av_rescale_q, which rounds to nearest: 42 ms. With 42 ms against 41/42 ms deltas every range touches its successor, the coverage stays one island, and a binary search over one range changes nothing. I have not verified your reference title; this is what the demuxer does with the value such muxers write.

    So whether §8 can be about the search comes down to one read on your reference, the Mac only, no device round:

    ffprobe -v error -select_streams v:0 -show_entries packet=pts,duration \
      -read_intervals "%+10" -of csv=p=0 REFERENCE.mkv | python3 -c "
    import sys
    p=sorted(tuple(map(int,l.split(','))) for l in sys.stdin if l.strip())
    g=sum(1 for (a,d),(b,_) in zip(p,p[1:]) if a+d<b)
    print(len(p),'frames',g,'gaps')"
    

    0 gaps means one island, the walk was never expensive on that title, and §8 has to be something else in those 48 commits or the box's state. Your write-up already names both, and the unmatched start (first after install against third in the hold) is the stronger candidate. Many gaps would make the search a real candidate, and arms A and B would need the same read before anything is concluded from them. They ran 644 and 785 s at 7.8.1 with the walk in place, so if they fragment too, the walk alone cannot be what turns a session over.

    Two things the counter found that stand regardless of your title

    Both only apply where the coverage fragments. They are real on any file muxed like my fixture, and neither explains your turnover.

    1. The cap freezes the coverage. Past 4096 ranges, insert returns false and nothing reads that result, so the coverage stops describing new packets. What reads the frontier afterwards sees nothing: cached-seek eligibility (SoftwarePacketReadAhead.swift:170, :233) and bufferedPosition (SoftwarePlaybackHost.swift:113).
    2. bufferedPosition on a fragmented HEVC session is the end of the current island, not the end of the buffer. That is the buf 0.41 to 0.51 s I reported further up, and I read it there as "the route simply runs on a short runway". That reading was wrong. The runway is the reservoir, 20 s at the producer qos -> utility line on every one of your sessions. The frontier stops at the next rounding hole.

    I will take both up separately, since they are coverage defects and not endurance ones.

    The fixture

    The file from yesterday was not kept, so there is nothing to publish as is. The recipe I used today is below. It does not give you the file you asked for: VideoToolbox's rate control undershoots on this source (-b:v 40M lands at 28.6 Mbps), it is not Dolby Vision, and it is FFmpeg-muxed, so it fragments exactly as described above. That last point makes it the wrong bench for your rig: it would add the variable your titles probably do not have.

    ffmpeg -f lavfi -i "testsrc2=size=3840x2160:rate=24000/1001,noise=alls=40:allf=t" \
      -f lavfi -i "sine=frequency=440:sample_rate=48000,pan=5.1|c0=c0|c1=c0|c2=c0|c3=c0|c4=c0|c5=c0" \
      -t 360 -map 0:v -map 1:a -c:v hevc_videotoolbox -b:v 40M -maxrate 40M -tag:v hvc1 \
      -pix_fmt p010le -profile:v main10 -g 48 -c:a ac3 -b:a 640k fixture.mkv
    

    For the rate question, one of your own titles near 45 Mbps still says more than this, TrueHD confound and all. If you run one, the gap read above on it and on arms A and B would tell us which of the three sessions carried a fragmented coverage.

    Your "what would firm it up" stands as written: a second 7.13.0 leg on the reference, held past 364 s and run third after the same two escape legs. Together with the gap read, it either separates the engine from the box's state or it does not.

  11. cmcpherson274 commented on Sep 23, 2026

    @cmcpherson274

    The gap read you asked for, on the reference and both arms. Mac-only, no device round.

    A property of the files, with no engine pin: ffprobe 8.1.2 (Homebrew, unpatched) over the Jellyfin static stream, 2026-09-23 12:22 EDT, with stderr empty on all three. Counted with your snippet unchanged, each saved CSV on stdin. Writing application and DefaultDuration are mkvinfo v100.0 on each file's first 2 MiB, 12:24 EDT.

    ffprobe -v error -headers $'Authorization: MediaBrowser …, Token="…"\r\n' \
      -select_streams v:0 -show_entries packet=pts,duration -read_intervals "%+10" \
      -of csv=p=0 "$BASE/Videos/$ID/stream?static=true" > "$ID.packets.csv" 2> "$ID.ffprobe.err"
    
    title item writing application DefaultDuration first ~10 s of v:0 (gaps per frame) packet duration · pts deltas
    reference (125 min, 89.1 Mbps) 6350f1ce… mkvmerge v82.0 41708333 ns (23.976 fps) 240 frames, 169 gaps (0.704) 41 on all 240 · 42 ×169, 41 ×70
    arm A (100 min, 31.3 Mbps) 3fdd8378… mkvmerge v88.0 41666666 ns (24.000 fps) 240 frames, 159 gaps (0.6625) 41 on all 240 · 42 ×159, 41 ×80
    arm B (130 min, 25.7 Mbps) 5f246460… mkvmerge v74.0.0 41708333 ns (23.976 fps) 239 frames, 169 gaps (0.707) 41 on all 239 · 42 ×169, 41 ×69

    All three are mkvmerge titles and all three fragment. The reference matches your fixture to the frame, so by your test §8 can still be about the search.

    The two 23.976 titles declare the 41708333 ns you named, and every packet still reads 41 ms. Where a block has no BlockDuration of its own, libavformat/matroskadec.c:4209 sets it to default_duration * laces / time_scale in uint64_t (:273, :397), so 41708333 / 1000000 truncates to 41, 1000000 ns being the 1 ms timestamp scale of these pts. It reaches pkt->duration at :4097 through :4216, with no av_rescale_q on the way and nothing that reads the writing application. Those lines are n8.1.2: the release this ffprobe is built from, and the FFmpeg that 7.8.1 and 7.13.0 ship through FFmpegBuild 3.4.0, whose one matroskadec patch adds a warning. The file is unchanged at n8.1.3. The timestamps round to nearest: all 719 pts are n × 41.708333 ms (41.666666 on arm A) rounded to the nearest ms. So each 42 ms step leaves a 1 ms hole, and each title's gap count equals its count of 42 ms deltas.

    Arms A and B fragment like the reference. At 7.8.1 (b89240af) they ran 644.1 s and 785.1 s with the walk in place: rate=1.00 on every tick, no audio lead exhausted, and no starvation line after the first 0.1 s (our §7). By your own test, "the walk alone cannot be what turns a session over". If the walk is part of the reference's turnover, it needs something the arms lacked, and they differ from the reference chiefly in rate (our §7). The rest of the 48 commits from 7.8.1 to 7.13.0 and the box's state remain candidates. This read separates none of them. The second 7.13.0 leg is the one you named to separate the engine from the box's state.

    Not in this post: the ~45 Mbps title and the second 7.13.0 leg. Neither has run, and both need Apple TV time. Our Apple TV time before its development signing expires (2026-09-24 06:22 EDT) goes first to the 7.15.1 device battery. The 7.13.0 (18a18aac) leg on the reference, held past 364 s and run third after the same two escape legs, has its build ready and waits behind it. No ~45 Mbps leg is scheduled. The 7.13.0 leg goes here, with its pin, once run.

  12. cmcpherson274 commented on Sep 24, 2026

    @cmcpherson274

    A short note at 7.15.1, to keep this thread current. It is not ask 4, and it adds nothing about §8's frontier walk.

    Ask 4 has not run. That is the second 7.13.0 (18a18aac) leg on the reference, held past 364 s, third after the same two escape legs. Its build is ready and its driver has only been dry-run; neither has touched the Apple TV. Our device time went to the 7.15.1 battery, and the leg will not run before the box's development signing expires (2026-09-24 06:22 EDT). Once the box is re-signed and back on the bench, the leg stays on our list with the same 7.13.0 build. It goes here with its pin when it runs, or we say here that we dropped it. No ~45 Mbps leg is scheduled.

    What 7.15.1 does say: session length at its own pin (Debug device build, two runs, 2026-09-23, not a reading about the frontier walk). Same recipe on the reference (6350f1ce…, 2160p Dolby Vision Profile 8.1, Matroska), same Apple TV: start at 600 s, the 75 s latch, our #461 escape to the software path at 60 s, our Dolby Audio Bitstream setting off, then 364 [SWDiag] ticks from [SWHost] session start.

    run (pin, session start EDT) place in its hold ticks at rate=1.00 rebuf=y clock lost to the wall audio lead exhausted reader, the nine 30 s windows after the first two
    run 1 (7.7.1 fa67d586, 2026-09-19 17:40) third, after the two escape legs 310 of 364 54 54.70 s of 363.01 s 19, first at 219.1 s 53.1–71.0 Mbps, mean 59.7
    run 3 (7.8.1 b89240af, 2026-09-21 19:22) third, same two 316 of 364 47 47.48 s of 363.01 s 17, first at 238.9 s 55.6–76.7, mean 62.4
    §8, as posted (7.13.0 18a18aac, 2026-09-22 19:46) first, after a fresh install 364 of 364 0 0.00 s 0 86.0–94.8, mean 90.9
    7.15.1 b93f9c4b, 2026-09-23 16:14 third, same two 364 of 364 0 0.01 s 0 87.2–93.8, mean 91.1
    7.15.1 b93f9c4b, 2026-09-23 17:25 first, after a fresh install 364 of 364 0 0.01 s 0 86.8–94.4, mean 91.0

    In both 7.15.1 sessions rebuf=n is on every tick, the software host again selected HardwareVideoDecoder (VT HEVC), and the read-ahead logged only its start-of-session consumer starved (+0.09 s, +0.06 s): no producer qos -> userInitiated, no later starvation line. There is no #561 line in any of the five slices. Each session is 364 s, so the reading is no starvation before ~364 s, not none at all.

    On your unmatched-start candidate, one 7.8.1 run. At 7.8.1, on a later build of our app (61e07564), a run of the recipe placed first after a fresh install, as the 7.13.0 leg was, first exhausted the audio lead at 235.9 s, against run 3's 238.9 s from the third place. A stall net of our own, new in that build, ended it at 269.0 s, so only its onset is the engine's. That is one run, on a different build of our app, and it says nothing about 7.13.0 from the third place, which is what ask 4 measures.

    What these runs cannot separate. The 7.15.1 runs carry 7.13.0's frontier search (3e9188bd) and 7.15.1's #613 fix (51eb95fb, PR #614), with everything else from 7.8.1 to 7.15.1, FFmpeg n8.1.3 (FFmpegBuild 3.5.0) among it, and our own app changes since runs 1 and 3 (build 1a1779c4, whose stall net armed on both runs and counted nothing). They cannot tell the search from #613/#614, or either from the rest. The 7.13.0 run read clean without #613/#614 and on FFmpegBuild 3.4.0; whether it was representative is ask 4's question. At b93f9c4b HEVC is on your successor-PTS coverage (SoftwarePlaybackHost.swift:14-24, used at :960), so by the code these sessions' video coverage does not split at the 1 ms holes the gap read counted, and neither the walk nor the search has islands to cross in them (we log no island count). That is why none of this bears on §8, and why ask 4 stays a 7.13.0 leg.

    One fact we had not said here. Every run above, at every pin, is a Debug build of our app (Debug-appletvos), and the two device build logs we still hold that compile AetherEngine (the 17:25 run's, and the 7.13.0 build ready for ask 4) both compile it at -Onone. The rows compare Debug with Debug. We have not measured what -Onone costs the software path.

    Bare :N are lines in that run's log; every count in Python. Run 1: session start :334, ticks :366–:2014, first audio lead exhausted :1311, reader :543–:1993. Run 3: :332, :362–:2051, :1404, :538–:2031; one tick at rate=0.00 reads rebuf=n (:1758). 7.13.0: :338, :367–:2073, reader :535–:2056. 7.15.1 16:14: :340, :369–:2118, decoder :342, starvation :357, reader :535–:2102, net armed :462. 7.15.1 17:25: :338, :367–:2117, decoder :340, starvation :355, reader :531–:2101, net armed :457, profile :96. 7.8.1 on 61e07564: session start :334, first audio lead exhausted :1390, the net's end :1569. The 17:25 and 61e07564 launches also carry JF_AUTO_RETRY=6, which acts only on an error card: the 17:25 slice has no ERROR line, and on 61e07564 it fired at :1598, after the net's end. Engine lines at b93f9c4b.

  13. superuser404notfound commented on Sep 24, 2026

    @superuser404notfound
    OwnerAuthor

    Thank you for both. The gap read corrects me, and the 7.15.1 runs answer the question ask 4 was for.

    The matroskadec correction is right

    I read matroskadec.c on FFmpeg's main branch, not on the tag we ship. The av_rescale_q I described is 642ae726ff ("rescale default duration derived block durations to stream timebase", 2026-07-21), which is on main only. At n8.1.2 and n8.1.3 the line is the truncating track->default_duration * laces / matroska->time_scale at :4209, exactly as you quoted. So mkvmerge titles fragment on every FFmpeg we have shipped, and my "should not fragment at all" was wrong for all three of your titles.

    What the two posts settle together

    Sorted by pin and by place in the hold:

    pin third after two escape legs first after a fresh install
    7.8.1 runs 1 and 3 turn over (219.1 s, 238.9 s) turns over (235.9 s, on 61e07564)
    7.13.0 not run (ask 4) clean to 364 s
    7.15.1 clean to 364 s clean to 364 s

    The place in the hold does not separate anything: 7.8.1 turns over from both places, 7.15.1 runs clean from both. I called the unmatched start the stronger candidate, and your two runs contradict it from both sides. What separates the sessions is the pin. The usual limits hold: one run per cell, sessions of 364 s, your app builds differ between the rows, and there is no thermal reading.

    What changed between 7.8.1 and 7.13.0 on this path

    I went through the 7.8.1..7.13.0 source diff for what runs in a VOD software session after load. FFmpegBuild is 3.4.0 on both. Of the commits:

    By elimination, the frontier search is what the 7.13.0 leg points at. That does not make the walk the cause on its own, and your gap read shows why. Arms A and B fragment at the same rate per frame (0.66 and 0.71). Their packet rates also match the reference's: 23.976 or 24 fps of video, and AC-3 or E-AC-3 at 31.25 packets/s. So the walk cost them what it cost the reference, second for second, and they ran 644 s and 785 s clean.

    The reading that fits all seven sessions: the walk is a cost that grows with the length of the session, a box with headroom absorbs it, and the 89 Mbps session is the one without headroom. A revert A/B would prove it, and nothing here does. It is also moot on 7.15.1: with the successor coverage HEVC has no islands, so there is nothing to walk and nothing to search.

    Ask 4 and the ~45 Mbps leg

    From my side, neither is needed any more. Ask 4 was there to separate the engine from the box's state, and the 7.15.1 third-place run does that at a later pin. A 7.13.0 leg now could only separate the search from the other 7.8.1..7.13.0 commits, and 7.15.1 has removed what the search sped up. Please drop both unless you want them for your own reasons. The device time is better spent elsewhere.

    -Onone

    Thank you for stating it, it matters. Every number in this thread, including all five rows of your table, is a Debug build with the engine at -Onone. The software path is where the per-packet Swift work sits: the frontier, the coverage, the stored-packet copies. That is the work unoptimised builds slow down the most. TestFlight and App Store builds compile the engine optimised. So the turnover is established at -Onone, and whether an optimised 7.8.1 build ever turned over on this title is unknown. For any future comparison of what the software path costs against the native one, which is still what this issue's title is about, an optimised build is the one to measure.

    Where this leaves the issue

    The turnover no longer reproduces on 7.15.1 at your reference's rate, from either place in the hold. The open question from the title, why the software route needs so much more of the box than the native route for the same bytes, is engine work on my side and does not need more device runs from you. I will leave the issue open for that, unless you would rather it be tracked separately.

  14. superuser404notfound commented on Sep 24, 2026

    @superuser404notfound
    OwnerAuthor

    One more round on my side, all on the Mac. None of it needs your device.

    -Onone is not what moved your sessions

    I measured one 4K HEVC + AC-3 5.1 fixture at 91.6 Mbit/s, the reference's rate, on 7.15.1:

    • Setup: M1 Air, aetherctl play --sw, a range origin at 1 Gbit/s with 20 ms latency.
    • Method: process CPU over seconds 20 to 110 of a 120 s session, three runs per arm, arms alternated.
    arm engine process, cores
    software route, Debug (-Onone) 0.227 / 0.230 (0.284 on one run under a load average of 5)
    software route, Release 0.210 / 0.210 / 0.219
    native route, Release 0.154 / 0.157 / 0.161
    • Debug against Release: about 8 %. Most of the software route's work is in FFmpeg and VideoToolbox, and -Onone does not touch those. So the Debug builds behind every row of your table cost little, and they do not explain the turnover at 7.7.1 and 7.8.1.
    • Out of process: VTDecoderXPCService costs about 0.035 cores on both routes, so the gap between the routes is entirely in the engine process.
    • This supersedes a figure I gave earlier in the thread. The software route is about 1.35x the native route in process on this title shape. It is not the 0.41 against 0.10 I quoted: that fixture decoded H.264 in libavcodec, which is not your path (the host opens VT for your HEVC).

    No run of any arm rebuffered, and aLead stayed at or above 3.98 s throughout.

    One cost that should not have been there, now fixed (#618)

    The profile of the Release software route had one clear outlier. It was the largest active frame outside the decoder: SoftwareStoredPacket.encoded(), the envelope every packet crosses into the read-ahead spool.

    arm engine process, cores
    7.15.1 0.220 / 0.223 / 0.222
    8710a245 0.205 / 0.207 / 0.208

    That is 6.8 % less, with no overlap between the arms. The encode subtree fell from 204 profile samples to 2. It closes about a quarter of the gap to the native route, not more.

    The rest of the software route's profile is mostly by design. The spool's own write and read are about 22 % of the active samples, and that spool is what serves cache-local seeks and scrub stills. The remainder is VT decode, render sync and audio. One more copy, in the source reader, is not specific to this route and is now tracked as #619.

    Where this leaves the issue

    • Your report: the turnover does not reproduce on 7.15.1 at your reference's rate, from either place in your hold.
    • The title's question: the software route needs about 1.35x the native route in process on the Mac, and less with perf(sw): the stored packet envelope is a header and the bytes, not a property list (AE#592) #618.
    • What is left for you: nothing more is needed from your side. From mine, the issue can be closed. If you see it differently, or if a later session at your reference's rate turns over again, please say so here and it stays open.
  15. superuser404notfound commented on Sep 24, 2026

    @superuser404notfound
    OwnerAuthor

    A short addendum, because it bears on the memory-pressure reading earlier in this thread.

    The source reader's copy I mentioned (#619) is fixed in #620, merged as e7b22047 and not yet in a release. On CPU it is in the noise, about -0.003 cores on both routes. On memory it is not. Peak footprint from /usr/bin/time -l, on the same 91.6 Mbit/s fixture and M1 Air as above, 45 s sessions, three runs per arm:

    route before after
    software 604 / 623 / 651 MB 193 / 196 / 197 MB
    native 828 / 889 / 911 MB 551 / 551 / 553 MB

    The old reader allocated a fresh 12 to 18 MB buffer on every 4 MB trim and grew it on every append, and much of that stayed resident. That is roughly 420 MB off the software route and 330 MB off the native one. These are Mac readings, not Apple TV ones, but on a 3.88 GB box that is the larger of the two changes this round. It needs nothing from your side. It will be in the next release.

  16. superuser404notfound commented on Sep 24, 2026

    @superuser404notfound
    OwnerAuthor

    Both changes from this round are released in 7.15.2: the packet envelope (6887a2b7, #618) and the read-window copy (a8506c04, #620). Nothing else is waiting on this thread from my side.

  17. cmcpherson274 commented on Sep 24, 2026

    @cmcpherson274

    Ask 4 ran on 2026-09-24, with one difference from how we described it: it is not held past 364 s. It kept the wait that runs 1 and 3 and §8 used, so like them it covers 364 s of software session. Here it is with its pin, as our last note promised. You said it is no longer needed; it asks nothing of you.

    The leg. 7.13.0 (18a18aac, FFmpegBuild 3.4.0), a Debug build of our app with the engine at -Onone, the same Apple TV, the reference on the same recipe as runs 1 and 3, session start 2026-09-24 13:45 EDT. It ran third after the same two escape legs, and the start matched run 3's: the P8.1 leg escaped to the software path, and the P5 leg's escape was refused as softwarePathCannotRepresentSource and it stayed on loopback, the same two arcs as in run 3's hold, with our 75 s latch releasing at 75.1 s and 75.0 s (run 3's hold: 75.2 s and 75.2 s).

    run (pin, place) ticks at rate=1.00 / rebuf=y audio lead exhausted 2 GiB crossed reader, the nine 30 s windows after the first two starvation after the first 0.1 s
    this leg (7.13.0, third) 364 of 364 / 0 0 136.8 s 85.9–92.9 Mbps, mean 90.9 0
    §8 (7.13.0, first) 364 of 364 / 0 0 136.3 s 86.0–94.8, mean 90.9 0
    run 3 (7.8.1, third) 316 of 364 / 47 17, first 238.9 s 160.4 s 55.6–76.7, mean 62.4 137, first 226.7 s
    run 1 (7.7.1, third) 310 of 364 / 54 19, first 219.1 s 161.4 s 53.1–71.0, mean 59.7 118, first 246.4 s

    This leg's reader in all eleven windows, in Mbps: 93.4, 90.3, 89.7, 92.0, 92.3, 92.7, 92.2, 91.1, 92.9, 89.0, 85.9. Its only starvation line is the start-of-session one (+0.05 s), the host selected HardwareVideoDecoder (VT HEVC), and there is no #561 line. That fills the empty cell in your table: at 7.13.0 the session ran clean to 364 s from both places in the hold.

    The islands. At 18a18aac HEVC takes the plain coverage (SoftwarePlaybackHost.swift:948) and the reference leaves a 1 ms hole at 169 of its first 240 frames (our gap read), so by the code and the file this session had islands and the search (3e9188bd) to cross them.

    What it cannot show.

    • How many islands there were, or whether the 4096 cap was reached: we log no island count, and the gap read covers the file's first ~10 s, not the stretch played.
    • The search apart from the other 7.8.1..7.13.0 commits, our differing app builds, or the day: nothing reverts 3e9188bd.
    • Anything past this session's 364.05 s: a turnover 7.13.0 only delayed would not show.
    • The box's state: each 7.13.0 row is one run, on 2026-09-22 and 2026-09-24.

    :N are this leg's log lines; counts in Python. Session start :336, ticks :368–:2087, decoder :338, starvation :353, reader :534–:2070. Escape legs' own logs: P8.1 :231, P5 :252, :271. In run 3's log one tick at rate=0.00 reads rebuf=n (:1758). Other rows: the logs our §8 and 02:51Z note cite.

    On closing: agreed. The 7.15.1 runs answer what ask 4 was for, this 7.13.0 leg adds nothing that argues against it, and we have no further reason of our own to hold the thread open. Thank you for the reads.

  18. superuser404notfound commented on Sep 24, 2026

    @superuser404notfound
    OwnerAuthor

    Thank you for running it anyway, and for the pin and the limits next to it.

    It fills the last cell the way the rest of the table pointed: 7.13.0 ran clean to 364 s from both places in the hold, with islands present by the code and the file, so the search was doing the crossing. That fits the reading from before (the walk before 3e9188bd grew with the session and this title had no headroom for it) without proving it, for the reasons you list: no revert, one run per cell, nothing past 364 s.

    The cost question from the title is answered as far as I can take it on the Mac (about 1.35x in process, less since #618 and #620 in 7.15.2), so I am closing this as agreed. If a session at the reference's rate turns over again on 7.15.2 or later, a new issue with the pin is the right place, and I will link it back here.

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