Commit ea42bfbf by tonihei Committed by Oliver Woodman

Don't retry UnexpectedLoaderExceptions.

These are thrown for non-IOException encountered during loading. Also, they
are thrown from an unexpected position and retrying is likely to fail anyway
because the Extractor is left in an unrecoverable state.

PiperOrigin-RevId: 237043948
parent ab5dae64
...@@ -18,6 +18,7 @@ package com.google.android.exoplayer2.upstream; ...@@ -18,6 +18,7 @@ package com.google.android.exoplayer2.upstream;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ParserException; import com.google.android.exoplayer2.ParserException;
import com.google.android.exoplayer2.upstream.HttpDataSource.InvalidResponseCodeException; import com.google.android.exoplayer2.upstream.HttpDataSource.InvalidResponseCodeException;
import com.google.android.exoplayer2.upstream.Loader.UnexpectedLoaderException;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
...@@ -77,14 +78,16 @@ public class DefaultLoadErrorHandlingPolicy implements LoadErrorHandlingPolicy { ...@@ -77,14 +78,16 @@ public class DefaultLoadErrorHandlingPolicy implements LoadErrorHandlingPolicy {
} }
/** /**
* Retries for any exception that is not a subclass of {@link ParserException} or {@link * Retries for any exception that is not a subclass of {@link ParserException}, {@link
* FileNotFoundException}. The retry delay is calculated as {@code Math.min((errorCount - 1) * * FileNotFoundException} or {@link UnexpectedLoaderException}. The retry delay is calculated as
* 1000, 5000)}. * {@code Math.min((errorCount - 1) * 1000, 5000)}.
*/ */
@Override @Override
public long getRetryDelayMsFor( public long getRetryDelayMsFor(
int dataType, long loadDurationMs, IOException exception, int errorCount) { int dataType, long loadDurationMs, IOException exception, int errorCount) {
return exception instanceof ParserException || exception instanceof FileNotFoundException return exception instanceof ParserException
|| exception instanceof FileNotFoundException
|| exception instanceof UnexpectedLoaderException
? C.TIME_UNSET ? C.TIME_UNSET
: Math.min((errorCount - 1) * 1000, 5000); : Math.min((errorCount - 1) * 1000, 5000);
} }
......
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