use of androidx.media3.exoplayer.source.LoadEventInfo in project media by androidx.
the class SingleSampleMediaPeriod method onLoadError.
@Override
public LoadErrorAction onLoadError(SourceLoadable loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) {
StatsDataSource dataSource = loadable.dataSource;
LoadEventInfo loadEventInfo = new LoadEventInfo(loadable.loadTaskId, loadable.dataSpec, dataSource.getLastOpenedUri(), dataSource.getLastResponseHeaders(), elapsedRealtimeMs, loadDurationMs, dataSource.getBytesRead());
MediaLoadData mediaLoadData = new MediaLoadData(C.DATA_TYPE_MEDIA, C.TRACK_TYPE_UNKNOWN, format, C.SELECTION_REASON_UNKNOWN, /* trackSelectionData= */
null, /* mediaStartTimeMs= */
0, Util.usToMs(durationUs));
long retryDelay = loadErrorHandlingPolicy.getRetryDelayMsFor(new LoadErrorInfo(loadEventInfo, mediaLoadData, error, errorCount));
boolean errorCanBePropagated = retryDelay == C.TIME_UNSET || errorCount >= loadErrorHandlingPolicy.getMinimumLoadableRetryCount(C.DATA_TYPE_MEDIA);
LoadErrorAction action;
if (treatLoadErrorsAsEndOfStream && errorCanBePropagated) {
Log.w(TAG, "Loading failed, treating as end-of-stream.", error);
loadingFinished = true;
action = Loader.DONT_RETRY;
} else {
action = retryDelay != C.TIME_UNSET ? Loader.createRetryAction(/* resetErrorCount= */
false, retryDelay) : Loader.DONT_RETRY_FATAL;
}
boolean wasCanceled = !action.isRetry();
eventDispatcher.loadError(loadEventInfo, C.DATA_TYPE_MEDIA, C.TRACK_TYPE_UNKNOWN, format, C.SELECTION_REASON_UNKNOWN, /* trackSelectionData= */
null, /* mediaStartTimeUs= */
0, durationUs, error, wasCanceled);
if (wasCanceled) {
loadErrorHandlingPolicy.onLoadTaskConcluded(loadable.loadTaskId);
}
return action;
}
use of androidx.media3.exoplayer.source.LoadEventInfo in project media by androidx.
the class ChunkSampleStream method onLoadCanceled.
@Override
public void onLoadCanceled(Chunk loadable, long elapsedRealtimeMs, long loadDurationMs, boolean released) {
loadingChunk = null;
canceledMediaChunk = null;
LoadEventInfo loadEventInfo = new LoadEventInfo(loadable.loadTaskId, loadable.dataSpec, loadable.getUri(), loadable.getResponseHeaders(), elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded());
loadErrorHandlingPolicy.onLoadTaskConcluded(loadable.loadTaskId);
mediaSourceEventDispatcher.loadCanceled(loadEventInfo, loadable.type, primaryTrackType, loadable.trackFormat, loadable.trackSelectionReason, loadable.trackSelectionData, loadable.startTimeUs, loadable.endTimeUs);
if (!released) {
if (isPendingReset()) {
resetSampleQueues();
} else if (isMediaChunk(loadable)) {
// TODO: Support splicing to keep data from canceled chunk. See [internal b/161130873].
discardUpstreamMediaChunksFromIndex(mediaChunks.size() - 1);
if (mediaChunks.isEmpty()) {
pendingResetPositionUs = lastSeekPositionUs;
}
}
callback.onContinueLoadingRequested(this);
}
}
use of androidx.media3.exoplayer.source.LoadEventInfo in project media by androidx.
the class ChunkSampleStream method onLoadCompleted.
// Loader.Callback implementation.
@Override
public void onLoadCompleted(Chunk loadable, long elapsedRealtimeMs, long loadDurationMs) {
loadingChunk = null;
chunkSource.onChunkLoadCompleted(loadable);
LoadEventInfo loadEventInfo = new LoadEventInfo(loadable.loadTaskId, loadable.dataSpec, loadable.getUri(), loadable.getResponseHeaders(), elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded());
loadErrorHandlingPolicy.onLoadTaskConcluded(loadable.loadTaskId);
mediaSourceEventDispatcher.loadCompleted(loadEventInfo, loadable.type, primaryTrackType, loadable.trackFormat, loadable.trackSelectionReason, loadable.trackSelectionData, loadable.startTimeUs, loadable.endTimeUs);
callback.onContinueLoadingRequested(this);
}
use of androidx.media3.exoplayer.source.LoadEventInfo in project media by androidx.
the class DashMediaSource method onUtcTimestampLoadCompleted.
/* package */
void onUtcTimestampLoadCompleted(ParsingLoadable<Long> loadable, long elapsedRealtimeMs, long loadDurationMs) {
LoadEventInfo loadEventInfo = new LoadEventInfo(loadable.loadTaskId, loadable.dataSpec, loadable.getUri(), loadable.getResponseHeaders(), elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded());
loadErrorHandlingPolicy.onLoadTaskConcluded(loadable.loadTaskId);
manifestEventDispatcher.loadCompleted(loadEventInfo, loadable.type);
onUtcTimestampResolved(loadable.getResult() - elapsedRealtimeMs);
}
use of androidx.media3.exoplayer.source.LoadEventInfo in project media by androidx.
the class DashMediaSource method onUtcTimestampLoadError.
/* package */
LoadErrorAction onUtcTimestampLoadError(ParsingLoadable<Long> loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error) {
manifestEventDispatcher.loadError(new LoadEventInfo(loadable.loadTaskId, loadable.dataSpec, loadable.getUri(), loadable.getResponseHeaders(), elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded()), loadable.type, error, /* wasCanceled= */
true);
loadErrorHandlingPolicy.onLoadTaskConcluded(loadable.loadTaskId);
onUtcTimestampResolutionError(error);
return Loader.DONT_RETRY;
}
Aggregations