Add an additional sanity check to FakeExtractorOutput

PiperOrigin-RevId: 285422885
This commit is contained in:
olly 2019-12-13 18:16:59 +00:00 committed by Oliver Woodman
parent b7b3a15855
commit b3f485d7d9

View file

@ -20,6 +20,7 @@ import static com.google.common.truth.Truth.assertWithMessage;
import android.content.Context;
import android.util.SparseArray;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.extractor.ExtractorOutput;
import com.google.android.exoplayer2.extractor.SeekMap;
import java.io.File;
@ -69,6 +70,9 @@ public final class FakeExtractorOutput implements ExtractorOutput, Dumper.Dumpab
@Override
public void seekMap(SeekMap seekMap) {
if (seekMap.isSeekable() && seekMap.getDurationUs() == C.TIME_UNSET) {
throw new IllegalStateException("SeekMap cannot be seekable and have an unknown duration");
}
this.seekMap = seekMap;
}