Java Code Examples for com.google.android.exoplayer2.source.chunk.Chunk#bytesLoaded()
The following examples show how to use
com.google.android.exoplayer2.source.chunk.Chunk#bytesLoaded() .
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: HlsSampleStreamWrapper.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; boolean canceled = false; if (chunkSource.onChunkLoadError(loadable, cancelable, error)) { if (isMediaChunk) { HlsMediaChunk removed = mediaChunks.removeLast(); Assertions.checkState(removed == loadable); if (mediaChunks.isEmpty()) { pendingResetPositionUs = lastSeekPositionUs; } } canceled = true; } eventDispatcher.loadError(loadable.dataSpec, loadable.type, trackType, loadable.trackFormat, loadable.trackSelectionReason, loadable.trackSelectionData, loadable.startTimeUs, loadable.endTimeUs, elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded(), error, canceled); if (canceled) { if (!prepared) { continueLoading(lastSeekPositionUs); } else { callback.onContinueLoadingRequested(this); } return Loader.DONT_RETRY; } else { return Loader.RETRY; } }
Example 2
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; }
Example 3
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 4
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 5
Source File: HlsSampleStreamWrapper.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); 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 6
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; }