You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tested with version 1.5.0, but this is a very long standing bug.
Devices that reproduce the issue
The bug is device-independent.
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Not tested
Reproduction steps
I have had a small patch for exoplayer/media3 which adds support for Vobsub subtitles. Evene though there I create CuesWithTiming objects with a durationUs of 5 seconds, the subtitles were never removed from display. I finally found the time to dig deeper and find the bug. Look at discardCuesBeforeTimeUs() in ReplacingCuesResolver.java:
public void discardCuesBeforeTimeUs(long timeUs) {
int indexToDiscardTo = getIndexOfCuesStartingAfter(timeUs);
if (indexToDiscardTo > 0) {
cuesWithTimingList.subList(0, indexToDiscardTo).clear();
}
}
Since getIndexOfCuesStartingAfter() only looks at startTimeUs (as the name implies), this will also remove cues whose endTimeUs has not been reached yet, so that reaching that time will not trigger removing the subtitle.
To fix this, I admit, I was lazy:
public void discardCuesBeforeTimeUs(long timeUs) {
int indexToDiscardTo = getIndexOfCuesStartingAfter(timeUs);
if (indexToDiscardTo > 1) {
cuesWithTimingList.subList(0, indexToDiscardTo - 1).clear();
}
}
A more thorough implementation would check whether the endTimeUs of that cue is in the past or not, but since getPreviousCueChangeTimeUs() and getNextCueChangeTimeUs() check the times correctly, being lazy works in this case.
It may well be that this bug is never triggered for the types of subtitles supported by media3 out of the box, but that code is still wrong.
The method previously discarded the cue that was active at `timeUs`,
meaning it had started before but had not ended by `timeUs`.
Issue: #1939
#cherrypick
PiperOrigin-RevId: 702707611
The method previously discarded the cue that was active at `timeUs`,
meaning it had started before but had not ended by `timeUs`.
Issue: #1939
PiperOrigin-RevId: 702707611
(cherry picked from commit e927d7b)
Version
Media3 1.5.0
More version details
Tested with version 1.5.0, but this is a very long standing bug.
Devices that reproduce the issue
The bug is device-independent.
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Not tested
Reproduction steps
I have had a small patch for exoplayer/media3 which adds support for Vobsub subtitles. Evene though there I create CuesWithTiming objects with a durationUs of 5 seconds, the subtitles were never removed from display. I finally found the time to dig deeper and find the bug. Look at discardCuesBeforeTimeUs() in ReplacingCuesResolver.java:
Since
getIndexOfCuesStartingAfter()
only looks atstartTimeUs
(as the name implies), this will also remove cues whoseendTimeUs
has not been reached yet, so that reaching that time will not trigger removing the subtitle.To fix this, I admit, I was lazy:
A more thorough implementation would check whether the
endTimeUs
of that cue is in the past or not, but sincegetPreviousCueChangeTimeUs()
andgetNextCueChangeTimeUs()
check the times correctly, being lazy works in this case.It may well be that this bug is never triggered for the types of subtitles supported by media3 out of the box, but that code is still wrong.
Expected result
See the description above.
Actual result
See the description above.
Media
None available
Bug Report
adb bugreport
to android-media-github@google.com after filing this issue.The text was updated successfully, but these errors were encountered: