Manual rollback of b3f485d7d9

It's technically possible to output a seekable SeekMap with unknown duration. This can occur if the media defines seek points but doesn't define either the overall duration or the duration of the media from the last seek point to the end.

PiperOrigin-RevId: 285769121
This commit is contained in:
olly 2019-12-16 15:35:06 +00:00 committed by Oliver Woodman
parent 250a5deab5
commit 88be178e0f

View File

@ -69,16 +69,16 @@ public final class FakeExtractorOutput implements ExtractorOutput, Dumper.Dumpab
@Override
public void seekMap(SeekMap seekMap) {
if (seekMap.isSeekable()) {
if (seekMap.getDurationUs() == C.TIME_UNSET) {
throw new IllegalStateException("SeekMap cannot be seekable and have an unknown duration");
}
SeekMap.SeekPoints seekPoints = seekMap.getSeekPoints(0);
if (!seekPoints.first.equals(seekPoints.second)) {
throw new IllegalStateException("SeekMap defines two seek points for t=0");
}
seekPoints = seekMap.getSeekPoints(seekMap.getDurationUs());
if (!seekPoints.first.equals(seekPoints.second)) {
throw new IllegalStateException("SeekMap defines two seek points for t=durationUs");
long durationUs = seekMap.getDurationUs();
if (durationUs != C.TIME_UNSET) {
seekPoints = seekMap.getSeekPoints(durationUs);
if (!seekPoints.first.equals(seekPoints.second)) {
throw new IllegalStateException("SeekMap defines two seek points for t=durationUs");
}
}
}
this.seekMap = seekMap;