Commit 1aad0f8e by tonihei Committed by Oliver Woodman

Don't throw in ProgressiveMediaPeriod.onLoadCompleted.

We may currently throw if the load completes before we finished preparation.
Don't throw and instead check for this condition in maybeThrowPrepareError.

PiperOrigin-RevId: 237237000
parent 851134ec
......@@ -21,6 +21,7 @@ import androidx.annotation.Nullable;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.FormatHolder;
import com.google.android.exoplayer2.ParserException;
import com.google.android.exoplayer2.SeekParameters;
import com.google.android.exoplayer2.decoder.DecoderInputBuffer;
import com.google.android.exoplayer2.extractor.DefaultExtractorInput;
......@@ -218,6 +219,9 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
@Override
public void maybeThrowPrepareError() throws IOException {
maybeThrowError();
if (loadingFinished && !prepared) {
throw new ParserException("Loading finished before preparation is complete.");
}
}
@Override
......@@ -512,12 +516,12 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
@Override
public void onLoadCompleted(ExtractingLoadable loadable, long elapsedRealtimeMs,
long loadDurationMs) {
if (durationUs == C.TIME_UNSET) {
SeekMap seekMap = Assertions.checkNotNull(this.seekMap);
if (durationUs == C.TIME_UNSET && seekMap != null) {
boolean isSeekable = seekMap.isSeekable();
long largestQueuedTimestampUs = getLargestQueuedTimestampUs();
durationUs = largestQueuedTimestampUs == Long.MIN_VALUE ? 0
: largestQueuedTimestampUs + DEFAULT_LAST_SAMPLE_DURATION_US;
listener.onSourceInfoRefreshed(durationUs, seekMap.isSeekable());
listener.onSourceInfoRefreshed(durationUs, isSeekable);
}
eventDispatcher.loadCompleted(
loadable.dataSpec,
......
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