Skip to content

Stylized ASS subs are not rendered properly #235

Description

@fivepandasna

What happened?

Heavily styled ASS subtitles do not render correctly with libass (applies to Sodalite). Some subtitle events are missing, causing parts of the subtitle track to disappear or render inconsistently.

Steps to reproduce

  1. Play a video with heavily styled ASS subtitles (I can provide a sample track if needed)
  2. Verify that some subtitle styles, layers, or dialogue events are missing or rendered incorrectly

AetherEngine version or commit SHA

5.20.7

Host app

Sodalite

Platform

iOS

OS version

iPadOS 26.5.2, iOS 26.5.2

Device / chip

iPhone 17, iPad mini gen 7

Playback path

Native AVPlayer

Source media (for playback bugs)

No response

Error codes / log lines

Anything else

I added logging to a custom player using AetherEngine and compared the processed events against the source ASS file. By the time playback had reached ~30.9s, processEvent had only been called 245 times, even though the ASS file contains 2,054 Dialogue events with start times less than or equal to the latest timestamp received by the player (~90.4s).

The number of processed events closely matches the number of unique timestamp ranges: there are only 268 unique (start, end) timestamp pairs in that same range. This suggests that multiple valid ASS dialogue entries sharing identical timestamps are being collapsed somewhere before AetherPlayerWrapper receives them.

While investigating, I found the following in SubtitlePacketStore.appendLocked:

let insertAt = entries.firstIndex { $0.ptsSeconds >= ptsSeconds } ?? entries.count
if insertAt < entries.count, entries[insertAt].ptsSeconds == ptsSeconds {
    bytes -= entries[insertAt].payload.count
    entries[insertAt] = entry        // overwrites existing entry
} else {
    entries.insert(entry, at: insertAt)
}

This appears to make ptsSeconds effectively unique, meaning subtitle packets with identical PTS values overwrite each other instead of being stored as separate entries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions