Add check for retryDelayMs==C.TIME_UNSET in DASH and SS manifest onLoadError.

If the returned retry delay is unset, we should use a DONT_RETRY_FATAL action
instead and dispatch the event with the "canceled" flag.

PiperOrigin-RevId: 243251554
This commit is contained in:
tonihei 2019-04-12 14:13:26 +01:00 committed by Oliver Woodman
parent a588717b46
commit c1e25f7768
2 changed files with 18 additions and 17 deletions

View File

@ -814,7 +814,13 @@ public final class DashMediaSource extends BaseMediaSource {
long loadDurationMs, long loadDurationMs,
IOException error, IOException error,
int errorCount) { int errorCount) {
boolean isFatal = error instanceof ParserException; long retryDelayMs =
loadErrorHandlingPolicy.getRetryDelayMsFor(
C.DATA_TYPE_MANIFEST, loadDurationMs, error, errorCount);
LoadErrorAction loadErrorAction =
retryDelayMs == C.TIME_UNSET
? Loader.DONT_RETRY_FATAL
: Loader.createRetryAction(/* resetErrorCount= */ false, retryDelayMs);
manifestEventDispatcher.loadError( manifestEventDispatcher.loadError(
loadable.dataSpec, loadable.dataSpec,
loadable.getUri(), loadable.getUri(),
@ -824,13 +830,8 @@ public final class DashMediaSource extends BaseMediaSource {
loadDurationMs, loadDurationMs,
loadable.bytesLoaded(), loadable.bytesLoaded(),
error, error,
isFatal); !loadErrorAction.isRetry());
return isFatal return loadErrorAction;
? Loader.DONT_RETRY_FATAL
: Loader.createRetryAction(
/* resetErrorCount= */ false,
loadErrorHandlingPolicy.getRetryDelayMsFor(
C.DATA_TYPE_MANIFEST, loadDurationMs, error, errorCount));
} }
/* package */ void onUtcTimestampLoadCompleted(ParsingLoadable<Long> loadable, /* package */ void onUtcTimestampLoadCompleted(ParsingLoadable<Long> loadable,

View File

@ -21,7 +21,6 @@ import android.os.SystemClock;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayerLibraryInfo; import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
import com.google.android.exoplayer2.ParserException;
import com.google.android.exoplayer2.Timeline; import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.offline.FilteringManifestParser; import com.google.android.exoplayer2.offline.FilteringManifestParser;
import com.google.android.exoplayer2.offline.StreamKey; import com.google.android.exoplayer2.offline.StreamKey;
@ -628,7 +627,13 @@ public final class SsMediaSource extends BaseMediaSource
long loadDurationMs, long loadDurationMs,
IOException error, IOException error,
int errorCount) { int errorCount) {
boolean isFatal = error instanceof ParserException; long retryDelayMs =
loadErrorHandlingPolicy.getRetryDelayMsFor(
C.DATA_TYPE_MANIFEST, loadDurationMs, error, errorCount);
LoadErrorAction loadErrorAction =
retryDelayMs == C.TIME_UNSET
? Loader.DONT_RETRY_FATAL
: Loader.createRetryAction(/* resetErrorCount= */ false, retryDelayMs);
manifestEventDispatcher.loadError( manifestEventDispatcher.loadError(
loadable.dataSpec, loadable.dataSpec,
loadable.getUri(), loadable.getUri(),
@ -638,13 +643,8 @@ public final class SsMediaSource extends BaseMediaSource
loadDurationMs, loadDurationMs,
loadable.bytesLoaded(), loadable.bytesLoaded(),
error, error,
isFatal); !loadErrorAction.isRetry());
return isFatal return loadErrorAction;
? Loader.DONT_RETRY_FATAL
: Loader.createRetryAction(
/* resetErrorCount= */ false,
loadErrorHandlingPolicy.getRetryDelayMsFor(
C.DATA_TYPE_MANIFEST, loadDurationMs, error, errorCount));
} }
// Internal methods // Internal methods