mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Remove WebvttSubtitle from null-checking blacklist
PiperOrigin-RevId: 277916113
This commit is contained in:
parent
5b80b4b523
commit
5407c31726
1 changed files with 7 additions and 13 deletions
|
|
@ -23,7 +23,6 @@ import com.google.android.exoplayer2.util.Assertions;
|
||||||
import com.google.android.exoplayer2.util.Util;
|
import com.google.android.exoplayer2.util.Util;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -73,15 +72,12 @@ import java.util.List;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Cue> getCues(long timeUs) {
|
public List<Cue> getCues(long timeUs) {
|
||||||
ArrayList<Cue> list = null;
|
List<Cue> list = new ArrayList<>();
|
||||||
WebvttCue firstNormalCue = null;
|
WebvttCue firstNormalCue = null;
|
||||||
SpannableStringBuilder normalCueTextBuilder = null;
|
SpannableStringBuilder normalCueTextBuilder = null;
|
||||||
|
|
||||||
for (int i = 0; i < numCues; i++) {
|
for (int i = 0; i < numCues; i++) {
|
||||||
if ((cueTimesUs[i * 2] <= timeUs) && (timeUs < cueTimesUs[i * 2 + 1])) {
|
if ((cueTimesUs[i * 2] <= timeUs) && (timeUs < cueTimesUs[i * 2 + 1])) {
|
||||||
if (list == null) {
|
|
||||||
list = new ArrayList<>();
|
|
||||||
}
|
|
||||||
WebvttCue cue = cues.get(i);
|
WebvttCue cue = cues.get(i);
|
||||||
// TODO(ibaker): Replace this with a closer implementation of the WebVTT spec (keeping
|
// TODO(ibaker): Replace this with a closer implementation of the WebVTT spec (keeping
|
||||||
// individual cues, but tweaking their `line` value):
|
// individual cues, but tweaking their `line` value):
|
||||||
|
|
@ -94,9 +90,12 @@ import java.util.List;
|
||||||
firstNormalCue = cue;
|
firstNormalCue = cue;
|
||||||
} else if (normalCueTextBuilder == null) {
|
} else if (normalCueTextBuilder == null) {
|
||||||
normalCueTextBuilder = new SpannableStringBuilder();
|
normalCueTextBuilder = new SpannableStringBuilder();
|
||||||
normalCueTextBuilder.append(firstNormalCue.text).append("\n").append(cue.text);
|
normalCueTextBuilder
|
||||||
|
.append(Assertions.checkNotNull(firstNormalCue.text))
|
||||||
|
.append("\n")
|
||||||
|
.append(Assertions.checkNotNull(cue.text));
|
||||||
} else {
|
} else {
|
||||||
normalCueTextBuilder.append("\n").append(cue.text);
|
normalCueTextBuilder.append("\n").append(Assertions.checkNotNull(cue.text));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
list.add(cue);
|
list.add(cue);
|
||||||
|
|
@ -110,12 +109,7 @@ import java.util.List;
|
||||||
// there was only a single normal cue, so just add it to the list
|
// there was only a single normal cue, so just add it to the list
|
||||||
list.add(firstNormalCue);
|
list.add(firstNormalCue);
|
||||||
}
|
}
|
||||||
|
return list;
|
||||||
if (list != null) {
|
|
||||||
return list;
|
|
||||||
} else {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue