Repository navigation
Description
Environment. AetherEngine 5.18.4, Apple TV 4K 3rd gen, loopback-HLS native path. Source is a 4K HEVC Dolby Vision Profile 8.1 MKV, ~48 minutes, EAC3 audio, two embedded SubRip tracks, direct-played over LAN from a Plex server. Subtitles enabled on the second text track shortly after load.
Symptom. After the first scrub that forces a producer restart, no further subtitle cues are applied. The overlay keeps displaying cues harvested before the seek, so on screen the subtitles read as badly out of sync — lines appearing long after the dialogue they belong to. It is not permanent: after several more scrubs the cues eventually re-anchor and subtitles return to correct sync.
Repro. Play a long 4K DV title with an embedded SRT track selected, then scrub once into the middle. Subtitles desync immediately. Continue scrubbing and they recover.
Trace. Using your own applySubtitleEvent diagnostic, which we mirror to a collector. Cues flow normally from load:
05:35:30.408 applySubtitleEvent #1 cueStart=1751.001s cueEnd=1753.754s engine.currentTime=1754.544s
...
05:35:31.939 applySubtitleEvent #20 cueStart=1795.087s cueEnd=1796.879s engine.currentTime=1758.735s
05:36:13.725 userSeekRequested commitScrub target=1752.45
05:36:17.277 producer restarted at idx=367 (seek=1472.72s [absolute source-PTS], restart took 7ms)
After that restart there is not one further applySubtitleEvent for the remaining ~13 minutes of the session. The cue store empties and stays empty — subCues from successive memprobes: 27 → 40 → 44 → 44 → 9, then frozen at 9 for 900+ seconds.
Packets are still being fetched. A later scrub in the same session runs the prefetch normally and harvests, and still nothing is applied:
05:38:47.086 forward prefetch started: streams=[2, 3] startAt=2821.13s lead=60.0s
05:38:47.421 forward prefetch exited (cancelled=false) harvested=24
So the cues are being read and stored; they are never handed to the overlay. That is what makes the on-screen result a desync rather than a blank — the previously-applied cues are still scheduled against a timeline the playhead has left.
A contrast, which I want to present carefully rather than as a bisect. On 5.18.2, the same file and a comparable seek recovered immediately:
03:42:42.545 seg709: out-of-range fetch (cache.range=0..11 highWater=11 attempt=1/3), restarting producer
03:42:42.553 producer restarted at idx=709 (seek=2843.72s)
03:42:43.301 applySubtitleEvent #16 cueStart=2844.261s engine.currentTime=2841.197s <- re-anchored
I have not bisected this and I do not think you should read it as a 5.18.4 regression. Neither change between 5.18.2 and 5.18.4 plausibly reaches subtitles: 5.18.3's hvcC canonicalization is provably inert for this asset (its init.mp4 is an identical 1360 B on both versions and the canonicalize path never logs), and 5.18.4's surface rebind is view-only. The two runs also differ in seek history — the 5.18.2 run was a single scrub from a fresh cache (cache.range=0..11), while both failing runs had earlier seeks behind them, one of them backward. So seek pattern and version are confounded here and I would not want to send you after the wrong one. I am happy to pin back to 5.18.2 and re-run the exact failing sequence if that would help.
It resembles the packet-store starvation in #125, which was about a backward seek into cache-resident content, except that this reproduces on a forward scrub as well and does eventually recover.
Happy to add instrumentation anywhere in the drain path and re-run.
Activity
dlev02 commentedon Jul 22, 2026
I think I've noticed this in my testing too (loopback-HLS native path, direct played MKVs with embedded SRT). Subtitles read desynced after a scrub, then come back after scrubbing around more. Just wanted to chime in with two things I spotted while poking at it.
First, the
applySubtitleEventdiagnostic is capped at 20 lines per session (subtitleCueDiagnosticCount < 20, and it only resets in the load path, not on seek). Your last pre-seek line is exactly #20, so the log going silent after the restart is just the cap, whether or not applies are still happening. Your 5.18.2 run was at #16, still under the cap. The memprobes (subCues frozen at 9) are the real signal here, and the 5.18.2 vs 5.18.4 contrast might be nothing more than the cap plus seek history.Second, your trace has a ~280s split at the restart. commitScrub targeted 1752.45s but the producer restarted at idx=367 / seek=1472.72s absolute source-PTS, and 1472.72/367 is about 4.01s per segment, so idx 367 really does sit around 1472s on the segment plan. The drainer is just a window join (
store.entries(from: sourceTime - backscan, through: sourceTime + lead)against source-PTS-keyed packets), so if the playhead and the store drift apart by ~280s the drain window stays empty forever. Packets keep harvesting (your harvested=24) but nothing gets applied, while the already-retained pre-seek cues keep rendering. That gives you desync instead of blank, and it recovers when a later scrub recomputes the mapping. My guess would be the seam shift feedingsourceTimegoing stale or not getting updated on the scrub-commit restart path, maybe related to the earlier backward cache-resident seek (the #125 shape).rrgomes commentedon Jul 22, 2026
Correction to my report: its central piece of evidence does not hold, and dlev02 is right on both counts. I checked both against the engine source and my own capture.
applySubtitleEventlogging is gated onsubtitleCueDiagnosticCount < 20(AetherEngine+Subtitles.swift:541), and the counter resets only insideload(...)(AetherEngine.swift:1830), never on seek. My two runs landed on opposite sides of that boundary by accident:idx=709, seek=2843.72s) andapplySubtitleEvent #16fired 0.75 s later atcueStart=2844.261s, correctly re-anchored. Under the cap, so visible. It then ran out at DV P5 colr override hardcodes limited range — make it fill-the-gap only #20.The 5.18.2 against 5.18.4 table in my report is therefore an artifact of the cap and not a behavioural difference. Please disregard it. I should have established what bounded that log line before building a version comparison on its absence.
What still stands is the user-visible symptom, subtitles desyncing after the first producer-restarting scrub and re-syncing after further scrubs, and
subCuesfrozen at 9 across four 30 s memprobes, which as dlev02 says is the signal actually carrying information. His window-join reading looks considerably stronger than mine.One caveat on my capture: it came from the same session as #169, where the segment producer was provably dead, with
avioFetchedMB,packetsWritten,pktTotalandcacheCountall frozen across the wedge. Per your note there, a dead producer taps no packets, so frozensubCuesin that particular trace is most likely the producer death rather than a separate subtitle defect. The later retest, where subtitles desynced on the first scrub and recovered with more scrubbing, was on a session that kept playing and is the better basis if an independent bug exists. I will recapture on 5.19.1 after retesting #169 and either give you a clean trace or close this as a duplicate.superuser404notfound commentedon Jul 23, 2026
Thanks both. I agree with the correction: the
applySubtitleEventsilence is explained entirely by the 20-event diagnostic cap, and the frozensubCuessample came from the same session whose producer was dead under #169. That capture cannot establish a separate subtitle-drain failure.#169 has now been fixed in 5.20.1 (
0138d38). Its final round corrected the restart gate from DTS-vs-PTS to PTS, added bounded recovery when the gate starves to EOF, and made the readiness path consult producer liveness. For this session shape, that should restore the producer packet tap as well as tail production.I traced the current overlay path again. The drainer joins the retained packet store against
sourceTime, resets its decoder and window after a seek jump, and reanchors the forward prefetcher. I do not see a code-proven independent failure in the evidence here, but the later user-visible repro means this should stay open until a clean run separates it from #169.Retest ask: 5.20.1, same failing seek sequence, with the #169 near-end workaround removed. If subtitle lag survives while producer counters and playback continue advancing, please capture:
#65 VOD shift publishedvideo gate openwithactual,anchorPts,target,desired, andshiftcurrentTime,sourceTime, and the raw AVPlayer rendered time at the same sample pointsThat will tell us whether the remaining defect is a VOD epoch-shift mismatch at the drainer window or a packet-store/cursor issue. Until that run, I am treating #196 as pending the 5.20.1 clean retest, not as fixed or duplicate.
rrgomes commentedon Jul 23, 2026
Retested on 5.20.1 alongside #169. Since the #169 tail still fails (the forward producer never emits the final segment — details there), I can't yet give you the clean run that separates #196 from it. For what it's worth the desync was still visible on the first restart-forcing scrub — applied cues lagged the clock by ~4-5 s (e.g.
applySubtitleEventcueStart=2833–2860 s applied atengine.currentTime=2841.1 s) — but that's the downstream symptom you'd expect while the producer tap can't feed the tail, so it doesn't establish an independent defect. I'll run your full capture list (#65 VOD shift/video gate open/ memprobe / prefetch / currentTime-vs-sourceTime-vs-rendered) as soon as #169 lets a session reach and produce the tail. Keeping it open and pending that run, as you suggested.superuser404notfound commentedon Jul 24, 2026
5.20.4 is now available and fixes the remaining #169 straight-playthrough failure: the structurally unproducible final plan slot is folded into its predecessor, so the producer can carry the complete tail without AVPlayer waiting at the impossible seg718/719 seam.
That makes 5.20.4 the first clean retest point for this issue. Please rerun the same restart-forcing scrub sequence with the near-end workaround removed.
If subtitle lag still appears while playback and producer counters continue advancing, please capture the previously listed
#65 VOD shift published,video gate open, memprobe, prefetch,currentTime,sourceTime, and raw rendered-time samples around the first bad scrub. That should finally separate a subtitle epoch/window mismatch from the #169 producer failure.I am leaving #196 open for that device result.
rrgomes commentedon Jul 24, 2026
Did not reproduce on 5.20.4. Same title (4K DV P8.1, embedded SRT), same repro shape: one mid-file scrub that restarts the producer (
producer restarted at idx=657). Subtitles stayed in sync for the rest of the title, through the tail, to end of media — confirmed on screen.subCuescorroborates. It climbed steadily across the scrub instead of collapsing:(It levels at 52 only because the pump had already read to EOF by then, so there were no further cues to harvest.) The failing capture collapsed to
subCues=9across the seek and stayed there for 900+ s.Your read in #169 looks right: the cues were fed by a packet tap on a producer that had died, so they starved for the same reason the segments did. Duplicate root cause, recovered with the #169 fix. Fine to close from our side.
A separate resume-into-tail run on the same build was also clean.
superuser404notfound commentedon Jul 24, 2026
Thank you for the clean 5.20.4 retest and the subCues evidence. This confirms the subtitle starvation shared the producer-death root cause from #169 rather than representing an independent subtitle-path defect. Closing as verified with the #169 fix.