Commit Graph
2 Commits
Author SHA1 Message Date
obscuremindandClaude Opus 5 7292d12920 fix(hls): stop renumbering live playlists whose segments exceed 10 s
HlsSequence re-applied the off-air wall-clock floor (time()/10) on every
publish. The daemon's segment length follows seg_time (1-30 s) and keyframe
cuts stretch it further, so for segments over 10 s the daemon counter fell
behind the floor and each catch-up shifted every listed segment by one —
players replayed or skipped a segment several times a minute.

The floor now applies only where a player can have seen the off-air loop:
the first publish, a daemon counter that went backwards, a publish gap
longer than max(30 s, 3 target durations), or an explicit markOffAir(),
which OffAirHandler calls when it serves the off-air playlist for a known
stream. The target duration is read from the daemon playlist. The state
moved from STREAMS_PATH, where a stream restart's `rm -f <id>_*` erased it
(letting the next publish step back under what a connected player had
seen), to tmp/signals.

Also removes the dead HLSGenerator::generateHLS() (no callers since
Phase E) and fixes tokenizeDaemonPlaylist's stale "unencrypted only" doc.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-11 16:19:22 +01:00
Divarion_D 33f6124ed0 fix(hls): keep MEDIA-SEQUENCE monotonic across the off-air<->live transition
The off-air placeholder (OffAirHandler) numbers its loop floor(time()/10)
(~1.7e8) while the xc_fanout daemon restarts its own HLS counter from 0 per
stream. On an on-demand cold start a player saw the off-air sequence (~1.7e8)
then the live one (~1) — a ~10^8 BACKWARD jump, which HLS forbids, stalling
playback during warm-up.

Re-anchor the live sequence (in HLSGenerator::tokenizeDaemonPlaylist) to the
same wall-clock base via a persisted per-stream offset so it only ever
advances: it stays >= the off-air line and >= the last live window, while
still incrementing by the daemon's per-segment delta. The off-air handler is
left untouched (it is stream-agnostic). Adds HlsSequence with a pure,
unit-tested reconcile() step plus HlsSequenceTest.
2026-09-06 00:40:32 +03:00