-
Notifications
You must be signed in to change notification settings - Fork 522
Fix cue render order for ass/ssa. #2137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@icbaker Could you take a look? Thanks! |
libraries/exoplayer/src/main/java/androidx/media3/exoplayer/text/MergingCuesResolver.java
Outdated
Show resolved
Hide resolved
libraries/common/src/main/java/androidx/media3/common/text/Cue.java
Outdated
Show resolved
Hide resolved
libraries/common/src/main/java/androidx/media3/common/text/Cue.java
Outdated
Show resolved
Hide resolved
try { | ||
return Integer.parseInt(intString.trim()); | ||
} catch (Exception exception) { | ||
return C.LENGTH_UNSET; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should default to 0
here for layer
, same as Cue
That probably means you need to either return null
here, or take a default value as a parameter, or don't define this general purpose function and just in-line it for the layer case.
I'd suggest in-lining
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parseInt is a general method, and I will set layer to 0 when the result is unset in line 333.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parseInt
may be trying to be a general method, but LENGTH_UNSET
(-1) is not a generally safe 'invalid' value for all possible integer fields (i.e. there may be some integer fields where we expect to read -1 from the file). In fact, tbh it's not clear to me that -1 (or any negative number) is an invalid value for layer
. The SSA "spec" I'm reading says:
Layer (any integer)
Which could reasonably be interpreted to include negative numbers.
So please either in-line this method (my preference) or return null
when the parsing fails.
libraries/ui/src/main/java/androidx/media3/ui/SubtitlePainter.java
Outdated
Show resolved
Hide resolved
libraries/extractor/src/main/java/androidx/media3/extractor/text/CuesWithTiming.java
Outdated
Show resolved
Hide resolved
@icbaker hello, please make a review for the new commit, and hope this pr can merge to 1.6.0 final release. |
Please can you add some tests for this? I suggest:
For (2) I suggest you craft an SSA test file that has cues overlapping in time with different layer values, to demonstrate why the re-ordering has to be done 'outside' |
This should fix #2124