Skip to content

fix(swplayback): the clock parks at end of media instead of free-running past it (#374) - #387

Merged
superuser404notfound merged 2 commits into
mainfrom
fix/sw-clock-parks-at-end-of-media
Aug 17, 2026
Merged

superuser404notfound merged 2 commits into
mainfrom
fix/sw-clock-parks-at-end-of-media

Conversation

@superuser404notfound

Copy link
Copy Markdown
Owner

What

.ended stopped the demux loops and published the state, but left the master synchronizer at rate 1. A finished software session then published a position that grew without bound; the native path parks on its last sample.

Measured on a 12 s fixture, aetherctl play with and without --sw:

path .ended at published position 8 s later
native t=12 cur=11.97 (unchanged from t=12 on)
software, before t=12 cur=20.13 dur=12.0, still climbing
software, after t=12 cur=11.99 (unchanged from t=12 on)

The second symptom is the one that cost a round of issue traffic: the 1 Hz [SWDiag] line kept reporting an aLead falling at exactly 1.00 per second, which is what a frozen audio PTS against a running clock looks like, and which reads as a live defect rather than as a session that finished. Both a downstream host (#374) and this repo treated it as a suspected deinterlacer clock defect before the whole line was read.

How

  • The clock parks on the last sample at end of media, from both demux loops' onEnd.
  • The park is deferred by the audio still queued ahead of the playhead: parking the synchronizer stops its renderers too, so an immediate park would cut the tail. Clamped at 5 s, because the anchor is a stream value and a broken PTS must not buy an unbounded runway on a session that is already over. On the normal VOD shape the deferral is zero, the drain that precedes end of media has already walked the clock to the last video frame.
  • pausedByHost stays false: the viewer did not pause this, the source ran out.
  • [SWDiag] gains eof=y once the producer is done, and falls silent on the tick that shows the clock parked, instead of repeating itself at 1 Hz for as long as the host holds the engine.
  • docs/api.md § .ended is terminal now states that the clock stops with it, and names the builds where the software path did not.

Verification

  • swift test: 1890 tests in 274 suites pass.
  • New SoftwareEndOfMediaClockTests (4 cases) covers the deferral policy: consumed tail, queued tail, unusable PTS, clamp.
  • aetherctl play --sw A/B against the native arm on the same fixture, table above.

🤖 Generated with Claude Code

https://claude.ai/code/session_01E5UztmCZtNYPQpzdmSdmWG

Vincent Herbst and others added 2 commits August 17, 2026 06:15
…ing past it (#374)

`.ended` stopped the demux loops and published the state, but left the master
synchronizer at rate 1. A finished software session then published a position
that grew without bound: 20.13 s on a 12.0 s source after 20 s, where a native
session on the same file parks on 11.97 s and stays there. The 1 Hz [SWDiag]
line kept reporting an aLead falling at exactly 1.00 per second, which is the
shape of a session drifting rather than of one that finished, and two readers
spent a round on it as a suspected deinterlacer clock defect.

The clock now parks on the last sample. The park is deferred by the audio still
queued ahead of the playhead (clamped, so a broken PTS cannot buy an unbounded
runway on a session that is already over), because parking the synchronizer
stops its renderers too and an immediate park would cut the tail. The
diagnostic line names the exhaustion with eof=y and falls silent on the tick
that shows the clock parked on it.

Measured with aetherctl play on a 12 s fixture, software path against native.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01E5UztmCZtNYPQpzdmSdmWG
…iven against a real origin (#374)

`live` has carried the flag since AE#195, but for its own raw-TS fixture, which
has no upstream playlist. The served #EXT-X-TARGETDURATION is floored by the
UPSTREAM's observed arrival cadence (LiveCadencePolicy), and that floor is what
sizes the holdback the first serve waits for, so fastZap against an origin of
one's own, the shape a downstream player ships, could not be driven at all.

Measured on the same 1 s-GOP seed, --preroll 0 --realtime: raw TS with no
playlist serves at 1.325 s on TARGETDURATION 1 (holdback 3 s, full cushion);
the same content behind an hlsfixture origin cutting 2 s segments serves on
TARGETDURATION 2 (holdback 6 s) although the engine re-cut it at 1 s.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01E5UztmCZtNYPQpzdmSdmWG
@superuser404notfound
superuser404notfound merged commit 2cca394 into main Aug 17, 2026
4 checks passed
@superuser404notfound
superuser404notfound deleted the fix/sw-clock-parks-at-end-of-media branch August 17, 2026 04:28
@superuser404notfound superuser404notfound mentioned this pull request Aug 17, 2026
2 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant