Commit 4eb06373 by olly Committed by Oliver Woodman

Manual rollback of…

Manual rollback of https://github.com/google/ExoPlayer/commit/b3f485d7d9c08e39574b72a949166ee4834c3b24

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
parent 214c62c3
...@@ -71,18 +71,18 @@ public final class FakeExtractorOutput implements ExtractorOutput, Dumper.Dumpab ...@@ -71,18 +71,18 @@ public final class FakeExtractorOutput implements ExtractorOutput, Dumper.Dumpab
@Override @Override
public void seekMap(SeekMap seekMap) { public void seekMap(SeekMap seekMap) {
if (seekMap.isSeekable()) { 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); SeekMap.SeekPoints seekPoints = seekMap.getSeekPoints(0);
if (!seekPoints.first.equals(seekPoints.second)) { if (!seekPoints.first.equals(seekPoints.second)) {
throw new IllegalStateException("SeekMap defines two seek points for t=0"); throw new IllegalStateException("SeekMap defines two seek points for t=0");
} }
seekPoints = seekMap.getSeekPoints(seekMap.getDurationUs()); long durationUs = seekMap.getDurationUs();
if (durationUs != C.TIME_UNSET) {
seekPoints = seekMap.getSeekPoints(durationUs);
if (!seekPoints.first.equals(seekPoints.second)) { if (!seekPoints.first.equals(seekPoints.second)) {
throw new IllegalStateException("SeekMap defines two seek points for t=durationUs"); throw new IllegalStateException("SeekMap defines two seek points for t=durationUs");
} }
} }
}
this.seekMap = seekMap; this.seekMap = seekMap;
} }
......
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