Skip to content

feat(swplayback): report the software path's read-ahead and display outcome (#303) - #304

Merged
superuser404notfound merged 1 commit into
mainfrom
feat/303-sw-readahead-telemetry
Aug 4, 2026
Merged

superuser404notfound merged 1 commit into
mainfrom
feat/303-sw-readahead-telemetry

Conversation

@superuser404notfound

Copy link
Copy Markdown
Owner

Closes #303.

Why

A software session left a field trace with no cushion figure in it, which is what made #295 hard to place: a ~100 ms blocked read reached the picture and no number said whether the buffer had 40 ms or 2 s.

Three signals look like they answer it and do not:

What

SampleBufferRenderer records the newest timestamp it has admitted, at admission into the reorder buffer so it sits past the #298 unschedulable gate and the post-seek skip, and clears it on flush so a backward seek cannot report the distance travelled as cushion. The frontier is the newest timestamp HELD, not the newest handed over, or a B-frame run would make the number breathe with the coding pattern.

SoftwareBufferFrontier holds the arithmetic as plain functions. The two inputs come from different objects (the renderer knows what it queued, the host knows where the synchronizer is) and the composition is the part worth pinning down.

clock.bufferedPosition on a VOD software session now carries the cushion. The #54 contract holds and the live frontier still wins where it is larger. This is a behaviour change on a public surface, in the direction of that surface's documented meaning.

The memprobe gains swAhead=, swDropped= and swDelay=. The latter two come from AVSampleBufferVideoRenderer.videoPerformanceMetrics, which counts frames dropped for missing their display deadline: exactly the class our own counters cannot see. Absent rather than zero on a native session.

Scope

Measurement only. No floor, no target depth, no change to the demux loop's back-pressure. Whether this path holds too little is unproven, and with the #295 mechanism removed it is unknown whether anything is left. Measure first, decide after.

Verification

aetherctl play --sw over a 70 s fixture:

swFrames=753 swAhead=0.26s swDropped=187/749 swDelay=0.00s ... frameAhead=0.00s

and the same run without --sw leaves the line as it was. Worth stating plainly: that drop count is an artefact of a headless layer in no view hierarchy (the #298 warning fires in the same run), not a statement about on-device cushion.

12 new tests, full suite green (1504 tests, 223 suites, plus the XCTest targets). The tests cover the frontier, the gate interaction, the cushion arithmetic and the log fragment. What they do not cover, and I am not claiming otherwise: AVVideoPerformanceMetrics needs a real renderer, so only the aetherctl run exercises it.

…utcome (#303)

A software session left a field trace with no cushion figure in it. frameAhead
is activeProducerShiftSeconds - playlistShiftSeconds, the #49 producer-shift
fold on the native path, and reads 0 here by construction; it was read in #295
as evidence that the path holds no read-ahead, which it cannot support either
way. bufferedSessionTime is fed from noteEdge, whose call sites are both gated
on isLive, so a VOD software session published max(currentTime, 0) and mirrored
its own playhead. The isReadyForMoreMediaData=false line is latched to one per
session and marks the first fill, not a sustained one.

SampleBufferRenderer records the newest timestamp it has admitted, at admission
into the reorder buffer so it is past the #298 unschedulable gate and the
post-seek skip, and clears it on flush so a backward seek cannot report the
distance travelled as cushion. SoftwareBufferFrontier holds the arithmetic
between that frontier and the clock as plain functions, since the two inputs
come from different objects and the composition is the part worth pinning.

clock.bufferedPosition on a VOD software session now carries the cushion. The
#54 contract holds (never trails the playhead) and the live frontier still wins
where it is larger.

The memprobe gains swAhead=, swDropped= and swDelay=, the latter two from
AVSampleBufferVideoRenderer's own metrics, which count frames dropped for
missing their display deadline: the class our own counters cannot see. Absent
rather than zero on a native session.

Measurement only. No floor and no target depth: whether this path holds too
little is unproven, and with #295 fixed it is unknown whether anything is left.

Verified with aetherctl play --sw over a 70 s fixture:
  swFrames=753 swAhead=0.26s swDropped=187/749 swDelay=0.00s
and the same run without --sw leaves the line as it was. The drop count there is
an artefact of a headless layer in no view hierarchy, not a statement about
on-device cushion.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01HX5zV3Fcf7Nzq4DYGdXvQE
@superuser404notfound
superuser404notfound merged commit 203c8d1 into main Aug 4, 2026
3 checks passed
@superuser404notfound
superuser404notfound deleted the feat/303-sw-readahead-telemetry branch August 4, 2026 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Software path: nothing measures the decoded read-ahead, so an IO hiccup arrives with no cushion figure in the log

1 participant