com.google.android.exoplayer2.upstream.Loader.LoadErrorAction Java Examples

The following examples show how to use com.google.android.exoplayer2.upstream.Loader.LoadErrorAction. 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 vote down vote up
@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: DashMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
LoadErrorAction onManifestLoadError(
    ParsingLoadable<DashManifest> loadable,
    long elapsedRealtimeMs,
    long loadDurationMs,
    IOException error) {
  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: DefaultHlsPlaylistTracker.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
@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 #4
Source File: DashMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
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: SsMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@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 #6
Source File: DefaultHlsPlaylistTracker.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@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 #7
Source File: SsMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@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 #8
Source File: DefaultHlsPlaylistTracker.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
@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: DashMediaSource.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
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 #10
Source File: DashMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
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 #11
Source File: DashMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
LoadErrorAction onManifestLoadError(
    ParsingLoadable<DashManifest> loadable,
    long elapsedRealtimeMs,
    long loadDurationMs,
    IOException error) {
  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 #12
Source File: DashMediaSource.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
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 #13
Source File: SsMediaSource.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
@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 #14
Source File: DefaultHlsPlaylistTracker.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@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 #15
Source File: SsMediaSource.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
@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 #16
Source File: DefaultHlsPlaylistTracker.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
@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 #17
Source File: DashMediaSource.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
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 #18
Source File: DashMediaSource.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
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 #19
Source File: DashMediaSource.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
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 #20
Source File: DashMediaSource.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
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 #21
Source File: SingleSampleMediaPeriod.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@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 #22
Source File: ProgressiveMediaPeriod.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@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 #23
Source File: DashMediaSource.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public LoadErrorAction onLoadError(
    ParsingLoadable<Long> loadable,
    long elapsedRealtimeMs,
    long loadDurationMs,
    IOException error,
    int errorCount) {
  return onUtcTimestampLoadError(loadable, elapsedRealtimeMs, loadDurationMs, error);
}
 
Example #24
Source File: DashMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public LoadErrorAction onLoadError(
    ParsingLoadable<DashManifest> loadable,
    long elapsedRealtimeMs,
    long loadDurationMs,
    IOException error,
    int errorCount) {
  return onManifestLoadError(loadable, elapsedRealtimeMs, loadDurationMs, error);
}
 
Example #25
Source File: DashMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public LoadErrorAction onLoadError(
    ParsingLoadable<Long> loadable,
    long elapsedRealtimeMs,
    long loadDurationMs,
    IOException error,
    int errorCount) {
  return onUtcTimestampLoadError(loadable, elapsedRealtimeMs, loadDurationMs, error);
}
 
Example #26
Source File: DashMediaSource.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public LoadErrorAction onLoadError(
    ParsingLoadable<DashManifest> loadable,
    long elapsedRealtimeMs,
    long loadDurationMs,
    IOException error,
    int errorCount) {
  return onManifestLoadError(loadable, elapsedRealtimeMs, loadDurationMs, error, errorCount);
}
 
Example #27
Source File: DashMediaSource.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public LoadErrorAction onLoadError(
    ParsingLoadable<DashManifest> loadable,
    long elapsedRealtimeMs,
    long loadDurationMs,
    IOException error,
    int errorCount) {
  return onManifestLoadError(loadable, elapsedRealtimeMs, loadDurationMs, error, errorCount);
}
 
Example #28
Source File: DashMediaSource.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public LoadErrorAction onLoadError(
    ParsingLoadable<Long> loadable,
    long elapsedRealtimeMs,
    long loadDurationMs,
    IOException error,
    int errorCount) {
  return onUtcTimestampLoadError(loadable, elapsedRealtimeMs, loadDurationMs, error);
}
 
Example #29
Source File: ProgressiveMediaPeriod.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@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 #30
Source File: ExtractorMediaPeriod.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@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;
}