mirror of
https://github.com/samsonjs/media.git
synced 2026-03-26 09:35:47 +00:00
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:
parent
214c62c35e
commit
4eb06373b1
1 changed files with 6 additions and 6 deletions
|
|
@ -71,16 +71,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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue