Java Code Examples for com.google.android.exoplayer2.upstream.Loader#DONT_RETRY
The following examples show how to use
com.google.android.exoplayer2.upstream.Loader#DONT_RETRY .
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: HlsPlaylistTracker.java From K-Sonic with MIT License | 6 votes |
@Override public int onLoadError(ParsingLoadable<HlsPlaylist> loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error) { boolean isFatal = error instanceof ParserException; eventDispatcher.loadError(loadable.dataSpec, C.DATA_TYPE_MANIFEST, elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded(), error, isFatal); if (isFatal) { return Loader.DONT_RETRY_FATAL; } boolean shouldRetry = true; if (ChunkedTrackBlacklistUtil.shouldBlacklist(error)) { blacklistUntilMs = SystemClock.elapsedRealtime() + ChunkedTrackBlacklistUtil.DEFAULT_TRACK_BLACKLIST_MS; notifyPlaylistBlacklisting(playlistUrl, ChunkedTrackBlacklistUtil.DEFAULT_TRACK_BLACKLIST_MS); shouldRetry = primaryHlsUrl == playlistUrl && !maybeSelectNewPrimaryUrl(); } return shouldRetry ? Loader.RETRY : Loader.DONT_RETRY; }
Example 2
Source File: DashMediaSource.java From Telegram with GNU General Public License v2.0 | 6 votes |
LoadErrorAction onUtcTimestampLoadError( ParsingLoadable<Long> loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error) { manifestEventDispatcher.loadError( loadable.dataSpec, loadable.getUri(), loadable.getResponseHeaders(), loadable.type, elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded(), error, true); onUtcTimestampResolutionError(error); return Loader.DONT_RETRY; }
Example 3
Source File: DashMediaSource.java From MediaSDK with Apache License 2.0 | 6 votes |
LoadErrorAction onUtcTimestampLoadError( ParsingLoadable<Long> loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error) { manifestEventDispatcher.loadError( loadable.dataSpec, loadable.getUri(), loadable.getResponseHeaders(), loadable.type, elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded(), error, true); onUtcTimestampResolutionError(error); return Loader.DONT_RETRY; }
Example 4
Source File: DashMediaSource.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
LoadErrorAction onUtcTimestampLoadError( ParsingLoadable<Long> loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error) { manifestEventDispatcher.loadError( loadable.dataSpec, loadable.getUri(), loadable.type, elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded(), error, true); onUtcTimestampResolutionError(error); return Loader.DONT_RETRY; }
Example 5
Source File: DashMediaSource.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
LoadErrorAction onUtcTimestampLoadError( ParsingLoadable<Long> loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error) { manifestEventDispatcher.loadError( loadable.dataSpec, loadable.getUri(), loadable.getResponseHeaders(), loadable.type, elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded(), error, true); onUtcTimestampResolutionError(error); return Loader.DONT_RETRY; }
Example 6
Source File: DashMediaSource.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
LoadErrorAction onUtcTimestampLoadError( ParsingLoadable<Long> loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error) { manifestEventDispatcher.loadError( loadable.dataSpec, loadable.getUri(), loadable.type, elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded(), error, true); onUtcTimestampResolutionError(error); return Loader.DONT_RETRY; }
Example 7
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 8
Source File: SingleSampleMediaPeriod.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public LoadErrorAction onLoadError( SourceLoadable loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) { boolean cancel = treatLoadErrorsAsEndOfStream && errorCount >= minLoadableRetryCount; eventDispatcher.loadError( loadable.dataSpec, loadable.dataSource.getLastOpenedUri(), 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= */ cancel); if (cancel) { loadingFinished = true; return Loader.DONT_RETRY; } return Loader.RETRY; }
Example 9
Source File: ChunkSampleStream.java From K-Sonic with MIT License | 5 votes |
@Override public int onLoadError(Chunk loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error) { long bytesLoaded = loadable.bytesLoaded(); boolean isMediaChunk = isMediaChunk(loadable); boolean cancelable = !isMediaChunk || bytesLoaded == 0 || mediaChunks.size() > 1; boolean canceled = false; if (chunkSource.onChunkLoadError(loadable, cancelable, error)) { canceled = true; if (isMediaChunk) { BaseMediaChunk removed = mediaChunks.removeLast(); Assertions.checkState(removed == loadable); primarySampleQueue.discardUpstreamSamples(removed.getFirstSampleIndex(0)); for (int i = 0; i < embeddedSampleQueues.length; i++) { embeddedSampleQueues[i].discardUpstreamSamples(removed.getFirstSampleIndex(i + 1)); } if (mediaChunks.isEmpty()) { pendingResetPositionUs = lastSeekPositionUs; } } } eventDispatcher.loadError(loadable.dataSpec, loadable.type, primaryTrackType, loadable.trackFormat, loadable.trackSelectionReason, loadable.trackSelectionData, loadable.startTimeUs, loadable.endTimeUs, elapsedRealtimeMs, loadDurationMs, bytesLoaded, error, canceled); if (canceled) { callback.onContinueLoadingRequested(this); return Loader.DONT_RETRY; } else { return Loader.RETRY; } }
Example 10
Source File: SingleSampleMediaPeriod.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public LoadErrorAction onLoadError( SourceLoadable loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) { boolean cancel = treatLoadErrorsAsEndOfStream && errorCount >= minLoadableRetryCount; eventDispatcher.loadError( loadable.dataSpec, loadable.dataSource.getLastOpenedUri(), 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= */ cancel); if (cancel) { loadingFinished = true; return Loader.DONT_RETRY; } return Loader.RETRY; }
Example 11
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 12
Source File: ChunkSampleStream.java From Telegram-FOSS 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); 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 13
Source File: ChunkSampleStream.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); int lastChunkIndex = mediaChunks.size() - 1; boolean cancelable = bytesLoaded == 0 || !isMediaChunk || !haveReadFromMediaChunk(lastChunkIndex); boolean canceled = false; if (chunkSource.onChunkLoadError(loadable, cancelable, error)) { if (!cancelable) { Log.w(TAG, "Ignoring attempt to cancel non-cancelable load."); } else { canceled = true; if (isMediaChunk) { BaseMediaChunk removed = discardUpstreamMediaChunksFromIndex(lastChunkIndex); Assertions.checkState(removed == loadable); if (mediaChunks.isEmpty()) { pendingResetPositionUs = lastSeekPositionUs; } } } } eventDispatcher.loadError( loadable.dataSpec, loadable.getUri(), loadable.type, primaryTrackType, loadable.trackFormat, loadable.trackSelectionReason, loadable.trackSelectionData, loadable.startTimeUs, loadable.endTimeUs, elapsedRealtimeMs, loadDurationMs, bytesLoaded, error, canceled); if (canceled) { callback.onContinueLoadingRequested(this); return Loader.DONT_RETRY; } else { return Loader.RETRY; } }
Example 14
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 15
Source File: DefaultHlsPlaylistTracker.java From TelePlus-Android 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 = playlistLoadErrorHandlingPolicy.getBlacklistDurationMsFor( loadable, loadDurationMs, error, errorCount); boolean shouldBlacklist = blacklistDurationMs != C.TIME_UNSET; boolean blacklistingFailed = notifyPlaylistError(playlistUrl, shouldBlacklist) || !shouldBlacklist; if (shouldBlacklist) { blacklistingFailed |= blacklistPlaylist(); } if (blacklistingFailed) { long retryDelay = playlistLoadErrorHandlingPolicy.getRetryDelayMsFor( loadable, 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(), C.DATA_TYPE_MANIFEST, elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded(), error, /* wasCanceled= */ !loadErrorAction.isRetry()); return loadErrorAction; }
Example 16
Source File: ChunkSampleStream.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); 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 17
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 18
Source File: SingleSampleMediaPeriod.java From Telegram with GNU General Public License v2.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 19
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 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; }