Repository navigation
Description
What happened?
I load a short MKV through the native AVPlayer/HLS path with embedded ASS subtitles and
LoadOptions(preserveASSMarkup: true). The active primary subtitle track is an embedded ASS track
with many same-timestamp events.
Expected: the embedded subtitle side-reader should read far enough ahead that host-rendered ASS cues
are available before playback reaches them. For this 26.087 s file, the reader should effectively reach
the end of the subtitle stream quickly, or at least keep the published subtitleCues ahead of playback.
Actual: subtitle rendering appears to stop after the early sequence. The reader/feed is not completely
dead, but it falls far behind while publishing one cue/event at a time through subtitleCues. At playback
offset ~15.0 s, the host had only received/appended 1098 ASS events and the maximum cue end time visible
through subtitleCues was still 8.167 s, even though the source stream contains thousands of ASS packets
after 8.167 s.
This makes later subtitles unavailable to the host renderer until too late, so the on-screen result looks
like subtitles stop rendering.
Steps to reproduce
-
Use a host app that opts into raw ASS cue delivery:
let options = LoadOptions( ..., preserveASSMarkup: true ) try await engine.load(url: mkvURL, options: options)
-
Select the embedded ASS subtitle track titled
Dialogue(stream=4in the sample below). -
Render the published
engine.$subtitleCuesin a host ASS renderer, usingTrackInfo.assHeaderplus
each raw event line and itscue.startTime/cue.endTime. -
Start playback from 0.
-
Observe that subtitles render early, then later cues are missing/delayed because the published cue feed
is still processing the large5.207sevent cluster when playback has already advanced well past it.
Samples: https://litter.catbox.moe/ouz5gf.zip (Ex1.mkv)
AetherEngine version or commit SHA
3.12.0 / 0468901
Host app
Custom / my own integration
Platform
tvOS
OS version
tvOS 26.5
Device / chip
4K 3rd gen
Playback path
Native AVPlayer
Source media (for playback bugs)
No response
Error codes / log lines
Anything else
No response
Activity
Merge: batch embedded ASS cue publishing for packet-dense tracks (#56)
chore(release): 3.13.1 — embedded ASS feed batching (#56)
superuser404notfound commentedon Jun 22, 2026
Fixed in 3.13.1 (
f604746).Root cause: the embedded subtitle side reader published every decoded event through its own awaited
MainActor.runhop. On a packet-dense track those per-event hops serialize the demux loop against the host's on-MainActor ASS renderer, so demux throughput collapses to the MainActor scheduling rate and the publishedsubtitleCuesfall far behind the playhead. Your Ex1.mkv made this very concrete: theDialoguetrack stacks 1534 ASS events on a single 5.207 s timestamp (and 1735 on another), so the reader was doing ~1534 awaited hops just to clear that one cluster, which is exactly where it stalled.The reader now coalesces decoded events and flushes them to the MainActor in a single hop, gated two ways:
Flushing also happens before the read-ahead park and at end of stream; a track switch / seek / stop still drops the trailing batch via the existing cancellation guard. The native
tx3greader from 3.13.0 already wrote cues off-actor, so it was never affected.If you could retest with 3.13.1 on the same sample and confirm the later cues now stay ahead of the playhead, that would be much appreciated. Thanks for the very precise report and the reproduction files, the same-timestamp packet histogram is what pinned it down.
edde746 commentedon Jun 22, 2026
Seems to be fixed.