mirror of
https://github.com/androidx/media.git
synced 2025-05-06 23:20:42 +08:00
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
This commit is contained in:
parent
851134ec16
commit
1aad0f8e22
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user