Java Code Examples for com.google.android.exoplayer2.upstream.Loader#DONT_RETRY_FATAL
The following examples show how to use
com.google.android.exoplayer2.upstream.Loader#DONT_RETRY_FATAL .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SsMediaSource.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override public LoadErrorAction onLoadError( ParsingLoadable<SsManifest> loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) { 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( loadable.dataSpec, loadable.getUri(), loadable.getResponseHeaders(), loadable.type, elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded(), error, !loadErrorAction.isRetry()); return loadErrorAction; }
Example 2
Source File: SsMediaSource.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override public LoadErrorAction onLoadError( ParsingLoadable<SsManifest> loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) { boolean isFatal = error instanceof ParserException; manifestEventDispatcher.loadError( loadable.dataSpec, loadable.getUri(), loadable.type, elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded(), error, isFatal); return isFatal ? Loader.DONT_RETRY_FATAL : Loader.RETRY; }
Example 3
Source File: DashMediaSource.java From Telegram with GNU General Public License v2.0 | 6 votes |
LoadErrorAction onManifestLoadError( ParsingLoadable<DashManifest> loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) { 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( loadable.dataSpec, loadable.getUri(), loadable.getResponseHeaders(), loadable.type, elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded(), error, !loadErrorAction.isRetry()); return loadErrorAction; }
Example 4
Source File: DefaultHlsPlaylistTracker.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override public LoadErrorAction onLoadError( ParsingLoadable<HlsPlaylist> loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) { long retryDelayMs = playlistLoadErrorHandlingPolicy.getRetryDelayMsFor( loadable, loadDurationMs, error, errorCount); boolean isFatal = retryDelayMs == C.TIME_UNSET; eventDispatcher.loadError( loadable.dataSpec, loadable.getUri(), C.DATA_TYPE_MANIFEST, elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded(), error, isFatal); return isFatal ? Loader.DONT_RETRY_FATAL : Loader.createRetryAction(/* resetErrorCount= */ false, retryDelayMs); }
Example 5
Source File: DefaultHlsPlaylistTracker.java From MediaSDK with Apache License 2.0 | 6 votes |
@Override public LoadErrorAction onLoadError( ParsingLoadable<HlsPlaylist> loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) { long retryDelayMs = loadErrorHandlingPolicy.getRetryDelayMsFor( loadable.type, loadDurationMs, error, errorCount); boolean isFatal = retryDelayMs == C.TIME_UNSET; eventDispatcher.loadError( loadable.dataSpec, loadable.getUri(), loadable.getResponseHeaders(), C.DATA_TYPE_MANIFEST, elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded(), error, isFatal); return isFatal ? Loader.DONT_RETRY_FATAL : Loader.createRetryAction(/* resetErrorCount= */ false, retryDelayMs); }
Example 6
Source File: DashMediaSource.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
LoadErrorAction onManifestLoadError( ParsingLoadable<DashManifest> loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) { 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( loadable.dataSpec, loadable.getUri(), loadable.getResponseHeaders(), loadable.type, elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded(), error, !loadErrorAction.isRetry()); return loadErrorAction; }
Example 7
Source File: SsMediaSource.java From MediaSDK with Apache License 2.0 | 6 votes |
@Override public LoadErrorAction onLoadError( ParsingLoadable<SsManifest> loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) { 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( loadable.dataSpec, loadable.getUri(), loadable.getResponseHeaders(), loadable.type, elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded(), error, !loadErrorAction.isRetry()); return loadErrorAction; }
Example 8
Source File: DefaultHlsPlaylistTracker.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@Override public LoadErrorAction onLoadError( ParsingLoadable<HlsPlaylist> loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) { long retryDelayMs = loadErrorHandlingPolicy.getRetryDelayMsFor( loadable.type, loadDurationMs, error, errorCount); boolean isFatal = retryDelayMs == C.TIME_UNSET; eventDispatcher.loadError( loadable.dataSpec, loadable.getUri(), loadable.getResponseHeaders(), C.DATA_TYPE_MANIFEST, elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded(), error, isFatal); return isFatal ? Loader.DONT_RETRY_FATAL : Loader.createRetryAction(/* resetErrorCount= */ false, retryDelayMs); }
Example 9
Source File: ProgressiveMediaPeriod.java From MediaSDK with Apache License 2.0 | 5 votes |
@Override public LoadErrorAction onLoadError( ExtractingLoadable loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) { copyLengthFromLoader(loadable); LoadErrorAction loadErrorAction; long retryDelayMs = loadErrorHandlingPolicy.getRetryDelayMsFor(dataType, loadDurationMs, error, errorCount); if (retryDelayMs == C.TIME_UNSET) { loadErrorAction = Loader.DONT_RETRY_FATAL; } else /* the load should be retried */ { int extractedSamplesCount = getExtractedSamplesCount(); boolean madeProgress = extractedSamplesCount > extractedSamplesCountAtStartOfLoad; loadErrorAction = configureRetry(loadable, extractedSamplesCount) ? Loader.createRetryAction(/* resetErrorCount= */ madeProgress, retryDelayMs) : Loader.DONT_RETRY; } eventDispatcher.loadError( loadable.dataSpec, loadable.dataSource.getLastOpenedUri(), loadable.dataSource.getLastResponseHeaders(), C.DATA_TYPE_MEDIA, C.TRACK_TYPE_UNKNOWN, /* trackFormat= */ null, C.SELECTION_REASON_UNKNOWN, /* trackSelectionData= */ null, /* mediaStartTimeUs= */ loadable.seekTimeUs, durationUs, elapsedRealtimeMs, loadDurationMs, loadable.dataSource.getBytesRead(), error, !loadErrorAction.isRetry()); return loadErrorAction; }
Example 10
Source File: ExtractorMediaPeriod.java From K-Sonic with MIT License | 5 votes |
@Override public int onLoadError(ExtractingLoadable loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error) { copyLengthFromLoader(loadable); notifyLoadError(error); if (isLoadableExceptionFatal(error)) { return Loader.DONT_RETRY_FATAL; } int extractedSamplesCount = getExtractedSamplesCount(); boolean madeProgress = extractedSamplesCount > extractedSamplesCountAtStartOfLoad; configureRetry(loadable); // May reset the sample queues. extractedSamplesCountAtStartOfLoad = getExtractedSamplesCount(); return madeProgress ? Loader.RETRY_RESET_ERROR_COUNT : Loader.RETRY; }
Example 11
Source File: ProgressiveMediaPeriod.java From Telegram with GNU General Public License v2.0 | 5 votes |
@Override public LoadErrorAction onLoadError( ExtractingLoadable loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) { copyLengthFromLoader(loadable); LoadErrorAction loadErrorAction; long retryDelayMs = loadErrorHandlingPolicy.getRetryDelayMsFor(dataType, loadDurationMs, error, errorCount); if (retryDelayMs == C.TIME_UNSET) { loadErrorAction = Loader.DONT_RETRY_FATAL; } else /* the load should be retried */ { int extractedSamplesCount = getExtractedSamplesCount(); boolean madeProgress = extractedSamplesCount > extractedSamplesCountAtStartOfLoad; loadErrorAction = configureRetry(loadable, extractedSamplesCount) ? Loader.createRetryAction(/* resetErrorCount= */ madeProgress, retryDelayMs) : Loader.DONT_RETRY; } eventDispatcher.loadError( loadable.dataSpec, loadable.dataSource.getLastOpenedUri(), loadable.dataSource.getLastResponseHeaders(), C.DATA_TYPE_MEDIA, C.TRACK_TYPE_UNKNOWN, /* trackFormat= */ null, C.SELECTION_REASON_UNKNOWN, /* trackSelectionData= */ null, /* mediaStartTimeUs= */ loadable.seekTimeUs, durationUs, elapsedRealtimeMs, loadDurationMs, loadable.dataSource.getBytesRead(), error, !loadErrorAction.isRetry()); return loadErrorAction; }
Example 12
Source File: ProgressiveMediaPeriod.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Override public LoadErrorAction onLoadError( ExtractingLoadable loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) { copyLengthFromLoader(loadable); LoadErrorAction loadErrorAction; long retryDelayMs = loadErrorHandlingPolicy.getRetryDelayMsFor(dataType, loadDurationMs, error, errorCount); if (retryDelayMs == C.TIME_UNSET) { loadErrorAction = Loader.DONT_RETRY_FATAL; } else /* the load should be retried */ { int extractedSamplesCount = getExtractedSamplesCount(); boolean madeProgress = extractedSamplesCount > extractedSamplesCountAtStartOfLoad; loadErrorAction = configureRetry(loadable, extractedSamplesCount) ? Loader.createRetryAction(/* resetErrorCount= */ madeProgress, retryDelayMs) : Loader.DONT_RETRY; } eventDispatcher.loadError( loadable.dataSpec, loadable.dataSource.getLastOpenedUri(), loadable.dataSource.getLastResponseHeaders(), C.DATA_TYPE_MEDIA, C.TRACK_TYPE_UNKNOWN, /* trackFormat= */ null, C.SELECTION_REASON_UNKNOWN, /* trackSelectionData= */ null, /* mediaStartTimeUs= */ loadable.seekTimeUs, durationUs, elapsedRealtimeMs, loadDurationMs, loadable.dataSource.getBytesRead(), error, !loadErrorAction.isRetry()); return loadErrorAction; }
Example 13
Source File: ExtractorMediaPeriod.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public LoadErrorAction onLoadError( ExtractingLoadable loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) { copyLengthFromLoader(loadable); LoadErrorAction retryAction; if (isLoadableExceptionFatal(error)) { retryAction = Loader.DONT_RETRY_FATAL; } else { int extractedSamplesCount = getExtractedSamplesCount(); boolean madeProgress = extractedSamplesCount > extractedSamplesCountAtStartOfLoad; retryAction = configureRetry(loadable, extractedSamplesCount) ? (madeProgress ? Loader.RETRY_RESET_ERROR_COUNT : Loader.RETRY) : Loader.DONT_RETRY; } boolean wasCanceled = retryAction == Loader.DONT_RETRY || retryAction == Loader.DONT_RETRY_FATAL; eventDispatcher.loadError( loadable.dataSpec, loadable.dataSource.getLastOpenedUri(), C.DATA_TYPE_MEDIA, C.TRACK_TYPE_UNKNOWN, /* trackFormat= */ null, C.SELECTION_REASON_UNKNOWN, /* trackSelectionData= */ null, /* mediaStartTimeUs= */ loadable.seekTimeUs, durationUs, elapsedRealtimeMs, loadDurationMs, loadable.dataSource.getBytesRead(), error, wasCanceled); return retryAction; }
Example 14
Source File: DefaultHlsPlaylistTracker.java From Telegram with GNU General Public License v2.0 | 4 votes |
@Override public LoadErrorAction onLoadError( ParsingLoadable<HlsPlaylist> loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) { LoadErrorAction loadErrorAction; long blacklistDurationMs = loadErrorHandlingPolicy.getBlacklistDurationMsFor( loadable.type, loadDurationMs, error, errorCount); boolean shouldBlacklist = blacklistDurationMs != C.TIME_UNSET; boolean blacklistingFailed = notifyPlaylistError(playlistUrl, blacklistDurationMs) || !shouldBlacklist; if (shouldBlacklist) { blacklistingFailed |= blacklistPlaylist(blacklistDurationMs); } if (blacklistingFailed) { long retryDelay = loadErrorHandlingPolicy.getRetryDelayMsFor( loadable.type, loadDurationMs, error, errorCount); loadErrorAction = retryDelay != C.TIME_UNSET ? Loader.createRetryAction(false, retryDelay) : Loader.DONT_RETRY_FATAL; } else { loadErrorAction = Loader.DONT_RETRY; } eventDispatcher.loadError( loadable.dataSpec, loadable.getUri(), loadable.getResponseHeaders(), C.DATA_TYPE_MANIFEST, elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded(), error, /* wasCanceled= */ !loadErrorAction.isRetry()); return loadErrorAction; }
Example 15
Source File: SingleSampleMediaPeriod.java From MediaSDK with Apache License 2.0 | 4 votes |
@Override public LoadErrorAction onLoadError( SourceLoadable loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) { long retryDelay = loadErrorHandlingPolicy.getRetryDelayMsFor( C.DATA_TYPE_MEDIA, loadDurationMs, error, errorCount); boolean errorCanBePropagated = retryDelay == C.TIME_UNSET || errorCount >= loadErrorHandlingPolicy.getMinimumLoadableRetryCount(C.DATA_TYPE_MEDIA); LoadErrorAction action; if (treatLoadErrorsAsEndOfStream && errorCanBePropagated) { loadingFinished = true; action = Loader.DONT_RETRY; } else { action = retryDelay != C.TIME_UNSET ? Loader.createRetryAction(/* resetErrorCount= */ false, retryDelay) : Loader.DONT_RETRY_FATAL; } eventDispatcher.loadError( loadable.dataSpec, loadable.dataSource.getLastOpenedUri(), loadable.dataSource.getLastResponseHeaders(), C.DATA_TYPE_MEDIA, C.TRACK_TYPE_UNKNOWN, format, C.SELECTION_REASON_UNKNOWN, /* trackSelectionData= */ null, /* mediaStartTimeUs= */ 0, durationUs, elapsedRealtimeMs, loadDurationMs, loadable.dataSource.getBytesRead(), error, /* wasCanceled= */ !action.isRetry()); return action; }
Example 16
Source File: DefaultHlsPlaylistTracker.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
@Override public LoadErrorAction onLoadError( ParsingLoadable<HlsPlaylist> loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) { LoadErrorAction loadErrorAction; long blacklistDurationMs = loadErrorHandlingPolicy.getBlacklistDurationMsFor( loadable.type, loadDurationMs, error, errorCount); boolean shouldBlacklist = blacklistDurationMs != C.TIME_UNSET; boolean blacklistingFailed = notifyPlaylistError(playlistUrl, blacklistDurationMs) || !shouldBlacklist; if (shouldBlacklist) { blacklistingFailed |= blacklistPlaylist(blacklistDurationMs); } if (blacklistingFailed) { long retryDelay = loadErrorHandlingPolicy.getRetryDelayMsFor( loadable.type, loadDurationMs, error, errorCount); loadErrorAction = retryDelay != C.TIME_UNSET ? Loader.createRetryAction(false, retryDelay) : Loader.DONT_RETRY_FATAL; } else { loadErrorAction = Loader.DONT_RETRY; } eventDispatcher.loadError( loadable.dataSpec, loadable.getUri(), loadable.getResponseHeaders(), C.DATA_TYPE_MANIFEST, elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded(), error, /* wasCanceled= */ !loadErrorAction.isRetry()); return loadErrorAction; }
Example 17
Source File: HlsSampleStreamWrapper.java From Telegram with GNU General Public License v2.0 | 4 votes |
@Override public LoadErrorAction onLoadError( Chunk loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) { long bytesLoaded = loadable.bytesLoaded(); boolean isMediaChunk = isMediaChunk(loadable); boolean blacklistSucceeded = false; LoadErrorAction loadErrorAction; long blacklistDurationMs = loadErrorHandlingPolicy.getBlacklistDurationMsFor( loadable.type, loadDurationMs, error, errorCount); if (blacklistDurationMs != C.TIME_UNSET) { blacklistSucceeded = chunkSource.maybeBlacklistTrack(loadable, blacklistDurationMs); } if (blacklistSucceeded) { if (isMediaChunk && bytesLoaded == 0) { HlsMediaChunk removed = mediaChunks.remove(mediaChunks.size() - 1); Assertions.checkState(removed == loadable); if (mediaChunks.isEmpty()) { pendingResetPositionUs = lastSeekPositionUs; } } loadErrorAction = Loader.DONT_RETRY; } else /* did not blacklist */ { long retryDelayMs = loadErrorHandlingPolicy.getRetryDelayMsFor( loadable.type, loadDurationMs, error, errorCount); loadErrorAction = retryDelayMs != C.TIME_UNSET ? Loader.createRetryAction(/* resetErrorCount= */ false, retryDelayMs) : Loader.DONT_RETRY_FATAL; } eventDispatcher.loadError( loadable.dataSpec, loadable.getUri(), loadable.getResponseHeaders(), loadable.type, trackType, loadable.trackFormat, loadable.trackSelectionReason, loadable.trackSelectionData, loadable.startTimeUs, loadable.endTimeUs, elapsedRealtimeMs, loadDurationMs, bytesLoaded, error, /* wasCanceled= */ !loadErrorAction.isRetry()); if (blacklistSucceeded) { if (!prepared) { continueLoading(lastSeekPositionUs); } else { callback.onContinueLoadingRequested(this); } } return loadErrorAction; }
Example 18
Source File: ChunkSampleStream.java From MediaSDK with Apache License 2.0 | 4 votes |
@Override public LoadErrorAction onLoadError( Chunk loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) { long bytesLoaded = loadable.bytesLoaded(); boolean isMediaChunk = isMediaChunk(loadable); int lastChunkIndex = mediaChunks.size() - 1; boolean cancelable = bytesLoaded == 0 || !isMediaChunk || !haveReadFromMediaChunk(lastChunkIndex); long blacklistDurationMs = cancelable ? loadErrorHandlingPolicy.getBlacklistDurationMsFor( loadable.type, loadDurationMs, error, errorCount) : C.TIME_UNSET; LoadErrorAction loadErrorAction = null; if (chunkSource.onChunkLoadError(loadable, cancelable, error, blacklistDurationMs)) { if (cancelable) { loadErrorAction = Loader.DONT_RETRY; if (isMediaChunk) { BaseMediaChunk removed = discardUpstreamMediaChunksFromIndex(lastChunkIndex); Assertions.checkState(removed == loadable); if (mediaChunks.isEmpty()) { pendingResetPositionUs = lastSeekPositionUs; } } } else { Log.w(TAG, "Ignoring attempt to cancel non-cancelable load."); } } if (loadErrorAction == null) { // The load was not cancelled. Either the load must be retried or the error propagated. long retryDelayMs = loadErrorHandlingPolicy.getRetryDelayMsFor( loadable.type, loadDurationMs, error, errorCount); loadErrorAction = retryDelayMs != C.TIME_UNSET ? Loader.createRetryAction(/* resetErrorCount= */ false, retryDelayMs) : Loader.DONT_RETRY_FATAL; } boolean canceled = !loadErrorAction.isRetry(); eventDispatcher.loadError( loadable.dataSpec, loadable.getUri(), loadable.getResponseHeaders(), loadable.type, primaryTrackType, loadable.trackFormat, loadable.trackSelectionReason, loadable.trackSelectionData, loadable.startTimeUs, loadable.endTimeUs, elapsedRealtimeMs, loadDurationMs, bytesLoaded, error, canceled); if (canceled) { callback.onContinueLoadingRequested(this); } return loadErrorAction; }
Example 19
Source File: HlsSampleStreamWrapper.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
@Override public LoadErrorAction onLoadError( Chunk loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) { long bytesLoaded = loadable.bytesLoaded(); boolean isMediaChunk = isMediaChunk(loadable); boolean blacklistSucceeded = false; LoadErrorAction loadErrorAction; if (!isMediaChunk || bytesLoaded == 0) { long blacklistDurationMs = chunkLoadErrorHandlingPolicy.getBlacklistDurationMsFor( loadable, loadDurationMs, error, errorCount); if (blacklistDurationMs != C.TIME_UNSET) { blacklistSucceeded = chunkSource.maybeBlacklistTrack(loadable, blacklistDurationMs); } } if (blacklistSucceeded) { if (isMediaChunk) { HlsMediaChunk removed = mediaChunks.remove(mediaChunks.size() - 1); Assertions.checkState(removed == loadable); if (mediaChunks.isEmpty()) { pendingResetPositionUs = lastSeekPositionUs; } } loadErrorAction = Loader.DONT_RETRY; } else /* did not blacklist */ { long retryDelayMs = chunkLoadErrorHandlingPolicy.getRetryDelayMsFor( loadable, loadDurationMs, error, errorCount); loadErrorAction = retryDelayMs != C.TIME_UNSET ? Loader.createRetryAction(/* resetErrorCount= */ false, retryDelayMs) : Loader.DONT_RETRY_FATAL; } eventDispatcher.loadError( loadable.dataSpec, loadable.getUri(), loadable.type, trackType, loadable.trackFormat, loadable.trackSelectionReason, loadable.trackSelectionData, loadable.startTimeUs, loadable.endTimeUs, elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded(), error, /* wasCanceled= */ !loadErrorAction.isRetry()); if (blacklistSucceeded) { if (!prepared) { continueLoading(lastSeekPositionUs); } else { callback.onContinueLoadingRequested(this); } } return loadErrorAction; }
Example 20
Source File: HlsSampleStreamWrapper.java From MediaSDK with Apache License 2.0 | 4 votes |
@Override public LoadErrorAction onLoadError( Chunk loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) { long bytesLoaded = loadable.bytesLoaded(); boolean isMediaChunk = isMediaChunk(loadable); boolean blacklistSucceeded = false; LoadErrorAction loadErrorAction; long blacklistDurationMs = loadErrorHandlingPolicy.getBlacklistDurationMsFor( loadable.type, loadDurationMs, error, errorCount); if (blacklistDurationMs != C.TIME_UNSET) { blacklistSucceeded = chunkSource.maybeBlacklistTrack(loadable, blacklistDurationMs); } if (blacklistSucceeded) { if (isMediaChunk && bytesLoaded == 0) { HlsMediaChunk removed = mediaChunks.remove(mediaChunks.size() - 1); Assertions.checkState(removed == loadable); if (mediaChunks.isEmpty()) { pendingResetPositionUs = lastSeekPositionUs; } } loadErrorAction = Loader.DONT_RETRY; } else /* did not blacklist */ { long retryDelayMs = loadErrorHandlingPolicy.getRetryDelayMsFor( loadable.type, loadDurationMs, error, errorCount); loadErrorAction = retryDelayMs != C.TIME_UNSET ? Loader.createRetryAction(/* resetErrorCount= */ false, retryDelayMs) : Loader.DONT_RETRY_FATAL; } eventDispatcher.loadError( loadable.dataSpec, loadable.getUri(), loadable.getResponseHeaders(), loadable.type, trackType, loadable.trackFormat, loadable.trackSelectionReason, loadable.trackSelectionData, loadable.startTimeUs, loadable.endTimeUs, elapsedRealtimeMs, loadDurationMs, bytesLoaded, error, /* wasCanceled= */ !loadErrorAction.isRetry()); if (blacklistSucceeded) { if (!prepared) { continueLoading(lastSeekPositionUs); } else { callback.onContinueLoadingRequested(this); } } return loadErrorAction; }