Commit b95b0aad by ood_tsen

clean the list while forward seek.

parent fd2ebc76
......@@ -54,10 +54,18 @@ public class TextParser implements SubtitleParser {
SubtitleData cue = new SubtitleData(startTimeUs, text);
while (subtitleList.size() > MAX_SUBTITLE_COUNT) {
subtitleList.remove(0);
}
//try to resize the list.
if (subtitleList.size() > 0) {
long lastTimeUs = subtitleList.get(subtitleList.size() - 1).startTimePosUs;
if (startTimeUs < lastTimeUs) {
//when forward seek
subtitleList.clear();
}
while (subtitleList.size() > MAX_SUBTITLE_COUNT) {
subtitleList.remove(0);
}
}
subtitleList.add(cue);
Collections.sort(subtitleList, new Comparator<SubtitleData>() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment