Repository navigation
Description
Environment
- AetherEngine 6.25.1, native loopback-HLS route,
LoadOptions.sequentialOrigin = true,declaredDurationSecondsset (IPTV catch-up/timeshift.ts, forward-only, readable from byte 0 only) - Apple TV 4K, tvOS 26.6; source: Xtream
/timeshift/.../YYYY-MM-DD:HH-MM/chan.ts(H.264 720p50 + AC-3, field-coded, open-GOP)
Symptom
Playback runs cleanly for ~4 minutes, then the served EVENT playlist stops growing, AVPlayer drains its forward buffer, stalls, and the session dies terminally. A client-side retry of the same archive dies again ~2 s after start.
Root cause
IPTV timeshift archives are chunked recordings; each chunk restarts near PTS 0. libavformat's 33-bit wrap correction turns the backward step at a chunk seam into a forward leap of +2^33. Device fingerprint from the retry session:
[mp4 @ 0x15eb6e700] [error] Application provided duration: 8226410192 in stream 0 is invalid
363524400 + 8226410192 = 8589934592 = 2^33 exactly — the seam packet's item-axis DTS leaps ~91 404 s forward.
HLSSegmentProducer has no discontinuity handling for non-live sessions: both the timeline rebase and the raw-PTS discontinuity detector are gated on isLive (HLSSegmentProducer.swift:2310, :2877), and the monotonic gate only repairs ≤0.5 s backward glitches. The leap therefore reaches VODSegmentCutter.index(pts:isKeyframe:) unmodified, whose monotonic while-loop walks the segment index to the tail clamp:
[HLSSegmentProducer] #358 plan indices 2...313 folded into seg-314 (no IRAP reached their boundary)
From there the session is structurally dead:
- The backpressure park target is derived from the head (
head − bufferAheadSegments), and release requires the consumer to fetch that index (SegmentCache.awaitFetchHighWater). After the fold, head sits at the plan tail, but the EVENT playlist skips zero-duration folded entries — the release index can never be advertised. Permanent park, frozen playlist:
[HLSSegmentProducer] #65 backpressure PARK (advance) head=374 target=364 cacheTarget=54 highStored=61 cached=62 parked=12s (no playback progress)
[NativeAVPlayerHost] #2 errorLog code=-12888 ... 'Playlist File unchanged for longer than 1.5 * target duration'
- AVPlayer drains the listed window and stalls; the Presented frame drifts ~6 s ahead of currentTime/sourceTime after a rapid bidirectional seek burst (loopback-HLS native path) — frameAhead/producerShift/hostShift all report 0 #65 fast-path breaker exits the pump and the host re-anchors on the AVPlayer position — which a sequential origin categorically refuses:
[HLSSegmentProducer] #65 backpressure WEDGE BROKEN (advance) head=374 target=364 cacheTarget=60 parked=49s (fast path: fetch target + rendered clock both frozen); exiting pump for host re-anchor on AVPlayer position
[HLSVideoEngine] #65 backpressure wedge: re-anchoring producer to 243.68s -> seg60 (AVPlayer position) (attempt 1/5)
[HLSVideoEngine] restart at idx=60 refused: a sequential origin can only be read from byte 0, so the reposition would mislabel content; surfacing source failure
Precedent inside the engine
SoftwarePlaybackHost already folds exactly these seams, unconditionally, for isLive || !sourceSeekable — its comment cites an IPTV timeshift archive whose wrap became +92 726 s (SoftwarePlaybackHost.swift:1731-1737). The producer path lacks the equivalent, so the two hosts behave differently for identical load options.
Proposed fix
Extend the existing live timeline rebase (video :2310 and audio :2379 gates) to sequential-origin VOD (sequentialOriginPinsProducerToZero), reusing the live thresholds. The cutter is fed post-shift item-axis DTS, so after a rebase it keeps walking the same plan boundaries sequentially — no cutter, ledger, or playlist change needed, and EXTINF stays real. No EXT-X-DISCONTINUITY is wanted: the archive seam is content-continuous and the output timeline stays continuous after the rebase.
PR follows.
Activity
fix(video): rebase the timeline across an archive chunk seam on a seq…
test(video): pin the 2^33 wrap rebase math to the device trace (#368)
Merge pull request #371 from tschuegy/fix/368-sequential-chunk-seam-r…
fix(engine): a sequential origin publishes the item axis, not a wrapp…
Merge fix/368-followup: a sequential origin publishes the item axis (#…
superuser404notfound commentedon Aug 13, 2026
#371 is merged (0e3dd02), plus a follow-up on main (a17a8b4) so the rebase does not move the published playhead: the clock folded
item + shift - originagainst an origin latched at session start, so the wrap reached the scrubber (measured 250 s -> 63378 s on an hour-long archive). Details on the PR.Reopened and staying open until the device retest confirms it on the two SRF archives. No release cut yet, since the #369 and #370 PRs belong in the same one.
Merge pull request #372 from tschuegy/fix/369-wrap-escape-containment
superuser404notfound commentedon Aug 14, 2026
Released in 6.25.2, together with #369 and #370, and both consumers are pinned to it. The release carries the merged PR plus the follow-up that moved the published clock onto the item axis, since the rebase itself put the whole wrap on the scrubber (250 s to 63378 s on the one-hour archive). Leaving this open for a device retest against the new pin.
tschuegy commentedon Aug 14, 2026
Fixed by #371, released in 6.25.2 (plus the follow-up publishing the item axis instead of a wrapped source PTS). Device-verified on Apple TV 4K, tvOS 26.6, against the SRF timeshift archive that produced the original trace: the chunk seam now logs
video timeline rebase (sequential)and playback continues through it — no fold to the plan tail, no frozen playlist, no 4-minute stall, and the retry path is never entered.fix(engine): a source that renumbers its clock from zero is a restart…