From 4940f21d48e17c63a1ceebf4f16f2e7fabac56a3 Mon Sep 17 00:00:00 2001 From: olly Date: Mon, 13 Sep 2021 15:50:14 +0100 Subject: [PATCH] Make position-out-of-range errors non-retryable PiperOrigin-RevId: 396354920 --- .../exoplayer2/upstream/DefaultLoadErrorHandlingPolicy.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultLoadErrorHandlingPolicy.java b/library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultLoadErrorHandlingPolicy.java index 8544a294a8..4f32344638 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultLoadErrorHandlingPolicy.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultLoadErrorHandlingPolicy.java @@ -101,8 +101,9 @@ public class DefaultLoadErrorHandlingPolicy implements LoadErrorHandlingPolicy { /** * Retries for any exception that is not a subclass of {@link ParserException}, {@link * FileNotFoundException}, {@link CleartextNotPermittedException} or {@link - * UnexpectedLoaderException}. The retry delay is calculated as {@code Math.min((errorCount - 1) * - * 1000, 5000)}. + * UnexpectedLoaderException}, and for which {@link + * DataSourceException#isCausedByPositionOutOfRange} returns {@code false}. The retry delay is + * calculated as {@code Math.min((errorCount - 1) * 1000, 5000)}. */ @Override public long getRetryDelayMsFor(LoadErrorInfo loadErrorInfo) { @@ -111,6 +112,7 @@ public class DefaultLoadErrorHandlingPolicy implements LoadErrorHandlingPolicy { || exception instanceof FileNotFoundException || exception instanceof CleartextNotPermittedException || exception instanceof UnexpectedLoaderException + || DataSourceException.isCausedByPositionOutOfRange(exception) ? C.TIME_UNSET : min((loadErrorInfo.errorCount - 1) * 1000, 5000); }