@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; }
@Override public boolean onChunkLoadError(Chunk chunk, boolean cancelable, Exception e) { if (!cancelable) { return false; } // Workaround for missing segment at the end of the period if (!manifest.dynamic && chunk instanceof MediaChunk && e instanceof InvalidResponseCodeException && ((InvalidResponseCodeException) e).responseCode == 404) { RepresentationHolder representationHolder = representationHolders[trackSelection.indexOf(chunk.trackFormat)]; int segmentCount = representationHolder.getSegmentCount(); if (segmentCount != DashSegmentIndex.INDEX_UNBOUNDED && segmentCount != 0) { int lastAvailableSegmentNum = representationHolder.getFirstSegmentNum() + segmentCount - 1; if (((MediaChunk) chunk).getNextChunkIndex() > lastAvailableSegmentNum) { missingLastSegment = true; return true; } } } // Blacklist if appropriate. return ChunkedTrackBlacklistUtil.maybeBlacklistTrack(trackSelection, trackSelection.indexOf(chunk.trackFormat), e); }
@Override public boolean onChunkLoadError(Chunk chunk, boolean cancelable, Exception e) { if (!cancelable) { return false; } // Workaround for missing segment at the end of the period if (!manifest.dynamic && chunk instanceof MediaChunk && e instanceof InvalidResponseCodeException && ((InvalidResponseCodeException) e).responseCode == 404) { RepresentationHolder representationHolder = representationHolders[trackSelection.indexOf(chunk.trackFormat)]; int lastAvailableSegmentNum = representationHolder.getLastSegmentNum(); if (((MediaChunk) chunk).chunkIndex >= lastAvailableSegmentNum) { missingLastSegment = true; return true; } } // Blacklist if appropriate. return ChunkedTrackBlacklistUtil.maybeBlacklistTrack(trackSelection, trackSelection.indexOf(chunk.trackFormat), e); }
@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)) { shouldRetry = blacklistPlaylist(); } return shouldRetry ? Loader.RETRY : Loader.DONT_RETRY; }
/** * Blacklists the playlist. * * @return Whether the playlist is the primary, despite being blacklisted. */ private boolean blacklistPlaylist() { blacklistUntilMs = SystemClock.elapsedRealtime() + ChunkedTrackBlacklistUtil.DEFAULT_TRACK_BLACKLIST_MS; notifyPlaylistBlacklisting(playlistUrl, ChunkedTrackBlacklistUtil.DEFAULT_TRACK_BLACKLIST_MS); return primaryHlsUrl == playlistUrl && !maybeSelectNewPrimaryUrl(); }
@Override public boolean onChunkLoadError(Chunk chunk, boolean cancelable, Exception e) { return cancelable && ChunkedTrackBlacklistUtil.maybeBlacklistTrack(trackSelection, trackSelection.indexOf(chunk.trackFormat), e); }
/** * Called when the {@link HlsSampleStreamWrapper} encounters an error loading a chunk obtained * from this source. * * @param chunk The chunk whose load encountered the error. * @param cancelable Whether the load can be canceled. * @param error The error. * @return Whether the load should be canceled. */ public boolean onChunkLoadError(Chunk chunk, boolean cancelable, IOException error) { return cancelable && ChunkedTrackBlacklistUtil.maybeBlacklistTrack(trackSelection, trackSelection.indexOf(trackGroup.indexOf(chunk.trackFormat)), error); }
/** * Called when the {@link HlsSampleStreamWrapper} encounters an error loading a chunk obtained * from this source. * * @param chunk The chunk whose load encountered the error. * @param cancelable Whether the load can be canceled. * @param e The error. * @return Whether the load should be canceled. */ public boolean onChunkLoadError(Chunk chunk, boolean cancelable, IOException e) { return cancelable && ChunkedTrackBlacklistUtil.maybeBlacklistTrack(trackSelection, trackSelection.indexOf(trackGroup.indexOf(chunk.trackFormat)), e); }