fix: stack unpositioned subtitle cues so simultaneous subtitles do not overlap#1791
Open
mvanhorn wants to merge 1 commit into
Open
fix: stack unpositioned subtitle cues so simultaneous subtitles do not overlap#1791mvanhorn wants to merge 1 commit into
mvanhorn wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Simultaneous subtitle cues no longer render on top of each other. External subtitle formats frequently emit multiple active cues with no position (
line == Cue.DIMEN_UNSET); the Compose subtitle renderer drew each of them at the same default bottom position, so overlapping dialogue lines stacked onto one another illegibly. A newstackUnpositionedCues()extension assigns unpositioned cues consecutive bottom-anchored line numbers (-1, then upward, accounting for multi-line cue text), which is the same convention ExoPlayer's built-in view uses, andCuesStateapplies it wherever cues are read.Why this matters
The reporter in #1698 hit this with subtitles that show two speakers at once — the second cue overprinted the first, making both unreadable. The fix only touches cues with unset positions; explicitly positioned cues pass through untouched, so styled/positioned subtitle formats keep their author-intended layout.
Testing
Added
CueExtensionsTestcovering: single unpositioned cue gets line -1, two simultaneous cues stack (-1, -2), a multi-line first cue pushes the next cue further up, positioned cues are left unchanged, and empty/singleton lists pass through. The unit test runs under:feature:player:testDefaultDebugUnitTestin CI (no local JVM toolchain on this machine).Closes #1698