com.google.android.exoplayer2.util.PriorityTaskManager Java Examples

The following examples show how to use com.google.android.exoplayer2.util.PriorityTaskManager. 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: SimpleExoPlayer.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
/**
 * Sets a {@link PriorityTaskManager}, or null to clear a previously set priority task manager.
 *
 * <p>The priority {@link C#PRIORITY_PLAYBACK} will be set while the player is loading.
 *
 * @param priorityTaskManager The {@link PriorityTaskManager}, or null to clear a previously set
 *     priority task manager.
 */
public void setPriorityTaskManager(@Nullable PriorityTaskManager priorityTaskManager) {
  verifyApplicationThread();
  if (Util.areEqual(this.priorityTaskManager, priorityTaskManager)) {
    return;
  }
  if (isPriorityTaskManagerRegistered) {
    Assertions.checkNotNull(this.priorityTaskManager).remove(C.PRIORITY_PLAYBACK);
  }
  if (priorityTaskManager != null && isLoading()) {
    priorityTaskManager.add(C.PRIORITY_PLAYBACK);
    isPriorityTaskManagerRegistered = true;
  } else {
    isPriorityTaskManagerRegistered = false;
  }
  this.priorityTaskManager = priorityTaskManager;
}
 
Example #2
Source File: SimpleExoPlayer.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Sets a {@link PriorityTaskManager}, or null to clear a previously set priority task manager.
 *
 * <p>The priority {@link C#PRIORITY_PLAYBACK} will be set while the player is loading.
 *
 * @param priorityTaskManager The {@link PriorityTaskManager}, or null to clear a previously set
 *     priority task manager.
 */
public void setPriorityTaskManager(@Nullable PriorityTaskManager priorityTaskManager) {
  verifyApplicationThread();
  if (Util.areEqual(this.priorityTaskManager, priorityTaskManager)) {
    return;
  }
  if (isPriorityTaskManagerRegistered) {
    Assertions.checkNotNull(this.priorityTaskManager).remove(C.PRIORITY_PLAYBACK);
  }
  if (priorityTaskManager != null && isLoading()) {
    priorityTaskManager.add(C.PRIORITY_PLAYBACK);
    isPriorityTaskManagerRegistered = true;
  } else {
    isPriorityTaskManagerRegistered = false;
  }
  this.priorityTaskManager = priorityTaskManager;
}
 
Example #3
Source File: SimpleExoPlayer.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Sets a {@link PriorityTaskManager}, or null to clear a previously set priority task manager.
 *
 * <p>The priority {@link C#PRIORITY_PLAYBACK} will be set while the player is loading.
 *
 * @param priorityTaskManager The {@link PriorityTaskManager}, or null to clear a previously set
 *     priority task manager.
 */
public void setPriorityTaskManager(@Nullable PriorityTaskManager priorityTaskManager) {
  verifyApplicationThread();
  if (Util.areEqual(this.priorityTaskManager, priorityTaskManager)) {
    return;
  }
  if (isPriorityTaskManagerRegistered) {
    Assertions.checkNotNull(this.priorityTaskManager).remove(C.PRIORITY_PLAYBACK);
  }
  if (priorityTaskManager != null && isLoading()) {
    priorityTaskManager.add(C.PRIORITY_PLAYBACK);
    isPriorityTaskManagerRegistered = true;
  } else {
    isPriorityTaskManagerRegistered = false;
  }
  this.priorityTaskManager = priorityTaskManager;
}
 
Example #4
Source File: PriorityDataSource.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param upstream The upstream {@link DataSource}.
 * @param priorityTaskManager The priority manager to which the task is registered.
 * @param priority The priority of the task.
 */
public PriorityDataSource(DataSource upstream, PriorityTaskManager priorityTaskManager,
    int priority) {
  this.upstream = Assertions.checkNotNull(upstream);
  this.priorityTaskManager = Assertions.checkNotNull(priorityTaskManager);
  this.priority = priority;
}
 
Example #5
Source File: PriorityDataSourceFactory.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param upstreamFactory A {@link DataSource.Factory} to be used to create an upstream {@link
 *     DataSource} for {@link PriorityDataSource}.
 * @param priorityTaskManager The priority manager to which PriorityDataSource task is registered.
 * @param priority The priority of PriorityDataSource task.
 */
public PriorityDataSourceFactory(Factory upstreamFactory, PriorityTaskManager priorityTaskManager,
    int priority) {
  this.upstreamFactory = upstreamFactory;
  this.priorityTaskManager = priorityTaskManager;
  this.priority = priority;
}
 
Example #6
Source File: PriorityDataSource.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param upstream The upstream {@link DataSource}.
 * @param priorityTaskManager The priority manager to which the task is registered.
 * @param priority The priority of the task.
 */
public PriorityDataSource(DataSource upstream, PriorityTaskManager priorityTaskManager,
    int priority) {
  this.upstream = Assertions.checkNotNull(upstream);
  this.priorityTaskManager = Assertions.checkNotNull(priorityTaskManager);
  this.priority = priority;
}
 
Example #7
Source File: DownloaderConstructorHelper.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param cache Cache instance to be used to store downloaded data.
 * @param upstreamFactory A {@link DataSource.Factory} for creating {@link DataSource}s for
 *     downloading data.
 * @param cacheReadDataSourceFactory A {@link DataSource.Factory} for creating {@link DataSource}s
 *     for reading data from the cache. If null then a {@link FileDataSourceFactory} will be used.
 * @param cacheWriteDataSinkFactory A {@link DataSink.Factory} for creating {@link DataSource}s
 *     for writing data to the cache. If null then a {@link CacheDataSinkFactory} will be used.
 * @param priorityTaskManager A {@link PriorityTaskManager} to use when downloading. If non-null,
 *     downloaders will register as tasks with priority {@link C#PRIORITY_DOWNLOAD} whilst
 *     downloading.
 */
public DownloaderConstructorHelper(
    Cache cache,
    DataSource.Factory upstreamFactory,
    @Nullable DataSource.Factory cacheReadDataSourceFactory,
    @Nullable DataSink.Factory cacheWriteDataSinkFactory,
    @Nullable PriorityTaskManager priorityTaskManager) {
  this(
      cache,
      upstreamFactory,
      cacheReadDataSourceFactory,
      cacheWriteDataSinkFactory,
      priorityTaskManager,
      /* cacheKeyFactory= */ null);
}
 
Example #8
Source File: PriorityDataSourceFactory.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param upstreamFactory A {@link DataSource.Factory} to be used to create an upstream {@link
 *     DataSource} for {@link PriorityDataSource}.
 * @param priorityTaskManager The priority manager to which PriorityDataSource task is registered.
 * @param priority The priority of PriorityDataSource task.
 */
public PriorityDataSourceFactory(Factory upstreamFactory, PriorityTaskManager priorityTaskManager,
    int priority) {
  this.upstreamFactory = upstreamFactory;
  this.priorityTaskManager = priorityTaskManager;
  this.priority = priority;
}
 
Example #9
Source File: PriorityDataSource.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param upstream The upstream {@link DataSource}.
 * @param priorityTaskManager The priority manager to which the task is registered.
 * @param priority The priority of the task.
 */
public PriorityDataSource(DataSource upstream, PriorityTaskManager priorityTaskManager,
    int priority) {
  this.upstream = Assertions.checkNotNull(upstream);
  this.priorityTaskManager = Assertions.checkNotNull(priorityTaskManager);
  this.priority = priority;
}
 
Example #10
Source File: DownloaderConstructorHelper.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param cache Cache instance to be used to store downloaded data.
 * @param upstreamFactory A {@link DataSource.Factory} for creating {@link DataSource}s for
 *     downloading data.
 * @param cacheReadDataSourceFactory A {@link DataSource.Factory} for creating {@link DataSource}s
 *     for reading data from the cache. If null then a {@link FileDataSourceFactory} will be used.
 * @param cacheWriteDataSinkFactory A {@link DataSink.Factory} for creating {@link DataSource}s
 *     for writing data to the cache. If null then a {@link CacheDataSinkFactory} will be used.
 * @param priorityTaskManager A {@link PriorityTaskManager} to use when downloading. If non-null,
 *     downloaders will register as tasks with priority {@link C#PRIORITY_DOWNLOAD} whilst
 *     downloading.
 */
public DownloaderConstructorHelper(
    Cache cache,
    DataSource.Factory upstreamFactory,
    @Nullable DataSource.Factory cacheReadDataSourceFactory,
    @Nullable DataSink.Factory cacheWriteDataSinkFactory,
    @Nullable PriorityTaskManager priorityTaskManager) {
  this(
      cache,
      upstreamFactory,
      cacheReadDataSourceFactory,
      cacheWriteDataSinkFactory,
      priorityTaskManager,
      /* cacheKeyFactory= */ null);
}
 
Example #11
Source File: PriorityDataSourceFactory.java    From K-Sonic with MIT License 5 votes vote down vote up
/**
 * @param upstreamFactory A {@link DataSource.Factory} to be used to create an upstream {@link
 *     DataSource} for {@link PriorityDataSource}.
 * @param priorityTaskManager The priority manager to which PriorityDataSource task is registered.
 * @param priority The priority of PriorityDataSource task.
 */
public PriorityDataSourceFactory(Factory upstreamFactory, PriorityTaskManager priorityTaskManager,
    int priority) {
  this.upstreamFactory = upstreamFactory;
  this.priorityTaskManager = priorityTaskManager;
  this.priority = priority;
}
 
Example #12
Source File: PriorityDataSource.java    From K-Sonic with MIT License 5 votes vote down vote up
/**
 * @param upstream The upstream {@link DataSource}.
 * @param priorityTaskManager The priority manager to which the task is registered.
 * @param priority The priority of the task.
 */
public PriorityDataSource(DataSource upstream, PriorityTaskManager priorityTaskManager,
    int priority) {
  this.upstream = Assertions.checkNotNull(upstream);
  this.priorityTaskManager = Assertions.checkNotNull(priorityTaskManager);
  this.priority = priority;
}
 
Example #13
Source File: PriorityDataSourceFactory.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param upstreamFactory A {@link DataSource.Factory} to be used to create an upstream {@link
 *     DataSource} for {@link PriorityDataSource}.
 * @param priorityTaskManager The priority manager to which PriorityDataSource task is registered.
 * @param priority The priority of PriorityDataSource task.
 */
public PriorityDataSourceFactory(Factory upstreamFactory, PriorityTaskManager priorityTaskManager,
    int priority) {
  this.upstreamFactory = upstreamFactory;
  this.priorityTaskManager = priorityTaskManager;
  this.priority = priority;
}
 
Example #14
Source File: DownloaderConstructorHelper.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/**
 * @param cache Cache instance to be used to store downloaded data.
 * @param upstreamFactory A {@link DataSource.Factory} for creating {@link DataSource}s for
 *     downloading data.
 * @param cacheReadDataSourceFactory A {@link DataSource.Factory} for creating {@link DataSource}s
 *     for reading data from the cache. If null then a {@link FileDataSource.Factory} will be
 *     used.
 * @param cacheWriteDataSinkFactory A {@link DataSink.Factory} for creating {@link DataSource}s
 *     for writing data to the cache. If null then a {@link CacheDataSinkFactory} will be used.
 * @param priorityTaskManager A {@link PriorityTaskManager} to use when downloading. If non-null,
 *     downloaders will register as tasks with priority {@link C#PRIORITY_DOWNLOAD} whilst
 *     downloading.
 */
public DownloaderConstructorHelper(
    Cache cache,
    DataSource.Factory upstreamFactory,
    @Nullable DataSource.Factory cacheReadDataSourceFactory,
    @Nullable DataSink.Factory cacheWriteDataSinkFactory,
    @Nullable PriorityTaskManager priorityTaskManager) {
  this(
      cache,
      upstreamFactory,
      cacheReadDataSourceFactory,
      cacheWriteDataSinkFactory,
      priorityTaskManager,
      /* cacheKeyFactory= */ null);
}
 
Example #15
Source File: DownloaderConstructorHelper.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param cache Cache instance to be used to store downloaded data.
 * @param upstreamDataSourceFactory A {@link Factory} for downloading data.
 * @param cacheReadDataSourceFactory A {@link Factory} for reading data from the cache. If null
 *     then standard {@link FileDataSource} instances will be used.
 * @param cacheWriteDataSinkFactory A {@link DataSink.Factory} for writing data to the cache. If
 *     null then standard {@link CacheDataSink} instances will be used.
 * @param priorityTaskManager A {@link PriorityTaskManager} to use when downloading. If non-null,
 *     downloaders will register as tasks with priority {@link C#PRIORITY_DOWNLOAD} whilst
 *     downloading.
 */
public DownloaderConstructorHelper(
    Cache cache,
    Factory upstreamDataSourceFactory,
    @Nullable Factory cacheReadDataSourceFactory,
    @Nullable DataSink.Factory cacheWriteDataSinkFactory,
    @Nullable PriorityTaskManager priorityTaskManager) {
  Assertions.checkNotNull(upstreamDataSourceFactory);
  this.cache = cache;
  this.upstreamDataSourceFactory = upstreamDataSourceFactory;
  this.cacheReadDataSourceFactory = cacheReadDataSourceFactory;
  this.cacheWriteDataSinkFactory = cacheWriteDataSinkFactory;
  this.priorityTaskManager = priorityTaskManager;
}
 
Example #16
Source File: DefaultLoadControl.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/** @deprecated Use {@link Builder} instead. */
@Deprecated
public DefaultLoadControl(
    DefaultAllocator allocator,
    int minBufferMs,
    int maxBufferMs,
    int bufferForPlaybackMs,
    int bufferForPlaybackAfterRebufferMs,
    int targetBufferBytes,
    boolean prioritizeTimeOverSizeThresholds,
    PriorityTaskManager priorityTaskManager) {
  assertGreaterOrEqual(bufferForPlaybackMs, 0, "bufferForPlaybackMs", "0");
  assertGreaterOrEqual(
      bufferForPlaybackAfterRebufferMs, 0, "bufferForPlaybackAfterRebufferMs", "0");
  assertGreaterOrEqual(minBufferMs, bufferForPlaybackMs, "minBufferMs", "bufferForPlaybackMs");
  assertGreaterOrEqual(
      minBufferMs,
      bufferForPlaybackAfterRebufferMs,
      "minBufferMs",
      "bufferForPlaybackAfterRebufferMs");
  assertGreaterOrEqual(maxBufferMs, minBufferMs, "maxBufferMs", "minBufferMs");

  this.allocator = allocator;
  minBufferUs = minBufferMs * 1000L;
  maxBufferUs = maxBufferMs * 1000L;
  bufferForPlaybackUs = bufferForPlaybackMs * 1000L;
  bufferForPlaybackAfterRebufferUs = bufferForPlaybackAfterRebufferMs * 1000L;
  targetBufferBytesOverwrite = targetBufferBytes;
  this.prioritizeTimeOverSizeThresholds = prioritizeTimeOverSizeThresholds;
  this.priorityTaskManager = priorityTaskManager;
}
 
Example #17
Source File: PriorityDataSource.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/**
 * @param upstream The upstream {@link DataSource}.
 * @param priorityTaskManager The priority manager to which the task is registered.
 * @param priority The priority of the task.
 */
public PriorityDataSource(DataSource upstream, PriorityTaskManager priorityTaskManager,
    int priority) {
  this.upstream = Assertions.checkNotNull(upstream);
  this.priorityTaskManager = Assertions.checkNotNull(priorityTaskManager);
  this.priority = priority;
}
 
Example #18
Source File: PriorityDataSourceFactory.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/**
 * @param upstreamFactory A {@link Factory} to be used to create an upstream {@link
 *     DataSource} for {@link PriorityDataSource}.
 * @param priorityTaskManager The priority manager to which PriorityDataSource task is registered.
 * @param priority The priority of PriorityDataSource task.
 */
public PriorityDataSourceFactory(Factory upstreamFactory, PriorityTaskManager priorityTaskManager,
    int priority) {
  this.upstreamFactory = upstreamFactory;
  this.priorityTaskManager = priorityTaskManager;
  this.priority = priority;
}
 
Example #19
Source File: PriorityDataSourceFactory.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param upstreamFactory A {@link DataSource.Factory} to be used to create an upstream {@link
 *     DataSource} for {@link PriorityDataSource}.
 * @param priorityTaskManager The priority manager to which PriorityDataSource task is registered.
 * @param priority The priority of PriorityDataSource task.
 */
public PriorityDataSourceFactory(Factory upstreamFactory, PriorityTaskManager priorityTaskManager,
    int priority) {
  this.upstreamFactory = upstreamFactory;
  this.priorityTaskManager = priorityTaskManager;
  this.priority = priority;
}
 
Example #20
Source File: PriorityDataSource.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param upstream The upstream {@link DataSource}.
 * @param priorityTaskManager The priority manager to which the task is registered.
 * @param priority The priority of the task.
 */
public PriorityDataSource(DataSource upstream, PriorityTaskManager priorityTaskManager,
    int priority) {
  this.upstream = Assertions.checkNotNull(upstream);
  this.priorityTaskManager = Assertions.checkNotNull(priorityTaskManager);
  this.priority = priority;
}
 
Example #21
Source File: DownloaderConstructorHelper.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param cache Cache instance to be used to store downloaded data.
 * @param upstreamDataSourceFactory A {@link Factory} for downloading data.
 * @param cacheReadDataSourceFactory A {@link Factory} for reading data from the cache. If null
 *     then standard {@link FileDataSource} instances will be used.
 * @param cacheWriteDataSinkFactory A {@link DataSink.Factory} for writing data to the cache. If
 *     null then standard {@link CacheDataSink} instances will be used.
 * @param priorityTaskManager A {@link PriorityTaskManager} to use when downloading. If non-null,
 *     downloaders will register as tasks with priority {@link C#PRIORITY_DOWNLOAD} whilst
 *     downloading.
 */
public DownloaderConstructorHelper(
    Cache cache,
    Factory upstreamDataSourceFactory,
    @Nullable Factory cacheReadDataSourceFactory,
    @Nullable DataSink.Factory cacheWriteDataSinkFactory,
    @Nullable PriorityTaskManager priorityTaskManager) {
  Assertions.checkNotNull(upstreamDataSourceFactory);
  this.cache = cache;
  this.upstreamDataSourceFactory = upstreamDataSourceFactory;
  this.cacheReadDataSourceFactory = cacheReadDataSourceFactory;
  this.cacheWriteDataSinkFactory = cacheWriteDataSinkFactory;
  this.priorityTaskManager = priorityTaskManager;
}
 
Example #22
Source File: DefaultLoadControl.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/** @deprecated Use {@link Builder} instead. */
@Deprecated
public DefaultLoadControl(
    DefaultAllocator allocator,
    int minBufferMs,
    int maxBufferMs,
    int bufferForPlaybackMs,
    int bufferForPlaybackAfterRebufferMs,
    int targetBufferBytes,
    boolean prioritizeTimeOverSizeThresholds,
    PriorityTaskManager priorityTaskManager) {
  assertGreaterOrEqual(bufferForPlaybackMs, 0, "bufferForPlaybackMs", "0");
  assertGreaterOrEqual(
      bufferForPlaybackAfterRebufferMs, 0, "bufferForPlaybackAfterRebufferMs", "0");
  assertGreaterOrEqual(minBufferMs, bufferForPlaybackMs, "minBufferMs", "bufferForPlaybackMs");
  assertGreaterOrEqual(
      minBufferMs,
      bufferForPlaybackAfterRebufferMs,
      "minBufferMs",
      "bufferForPlaybackAfterRebufferMs");
  assertGreaterOrEqual(maxBufferMs, minBufferMs, "maxBufferMs", "minBufferMs");

  this.allocator = allocator;
  minBufferUs = minBufferMs * 1000L;
  maxBufferUs = maxBufferMs * 1000L;
  bufferForPlaybackUs = bufferForPlaybackMs * 1000L;
  bufferForPlaybackAfterRebufferUs = bufferForPlaybackAfterRebufferMs * 1000L;
  targetBufferBytesOverwrite = targetBufferBytes;
  this.prioritizeTimeOverSizeThresholds = prioritizeTimeOverSizeThresholds;
  this.priorityTaskManager = priorityTaskManager;
}
 
Example #23
Source File: DownloaderConstructorHelper.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
/** Returns a {@link PriorityTaskManager} instance. */
public PriorityTaskManager getPriorityTaskManager() {
  // Return a dummy PriorityTaskManager if none is provided. Create a new PriorityTaskManager
  // each time so clients don't affect each other over the dummy PriorityTaskManager instance.
  return priorityTaskManager != null ? priorityTaskManager : new PriorityTaskManager();
}
 
Example #24
Source File: DownloaderConstructorHelper.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
/** Returns a {@link PriorityTaskManager} instance. */
public PriorityTaskManager getPriorityTaskManager() {
  // Return a dummy PriorityTaskManager if none is provided. Create a new PriorityTaskManager
  // each time so clients don't affect each other over the dummy PriorityTaskManager instance.
  return priorityTaskManager != null ? priorityTaskManager : new PriorityTaskManager();
}
 
Example #25
Source File: DownloaderConstructorHelper.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
/** Returns a {@link PriorityTaskManager} instance. */
public PriorityTaskManager getPriorityTaskManager() {
  // Return a dummy PriorityTaskManager if none is provided. Create a new PriorityTaskManager
  // each time so clients don't affect each other over the dummy PriorityTaskManager instance.
  return priorityTaskManager != null ? priorityTaskManager : new PriorityTaskManager();
}
 
Example #26
Source File: DefaultLoadControl.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
/** Sets the {@link PriorityTaskManager} to use. */
public Builder setPriorityTaskManager(PriorityTaskManager priorityTaskManager) {
  this.priorityTaskManager = priorityTaskManager;
  return this;
}
 
Example #27
Source File: DownloaderConstructorHelper.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
/** Returns a {@link PriorityTaskManager} instance. */
public PriorityTaskManager getPriorityTaskManager() {
  // Return a dummy PriorityTaskManager if none is provided. Create a new PriorityTaskManager
  // each time so clients don't affect each other over the dummy PriorityTaskManager instance.
  return priorityTaskManager != null ? priorityTaskManager : new PriorityTaskManager();
}
 
Example #28
Source File: DownloaderConstructorHelper.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
/** Returns a {@link PriorityTaskManager} instance. */
public PriorityTaskManager getPriorityTaskManager() {
  // Return a dummy PriorityTaskManager if none is provided. Create a new PriorityTaskManager
  // each time so clients don't affect each other over the dummy PriorityTaskManager instance.
  return priorityTaskManager != null ? priorityTaskManager : new PriorityTaskManager();
}
 
Example #29
Source File: DefaultLoadControl.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
/** Sets the {@link PriorityTaskManager} to use. */
public Builder setPriorityTaskManager(PriorityTaskManager priorityTaskManager) {
  this.priorityTaskManager = priorityTaskManager;
  return this;
}
 
Example #30
Source File: ExoPlayerErrorMapperTest.java    From no-player with Apache License 2.0 4 votes vote down vote up
@Parameterized.Parameters(name = "{0} with detail {1} is mapped from {2}")
public static Collection<Object[]> parameters() {
    return Arrays.asList(
            new Object[]{SOURCE, SAMPLE_QUEUE_MAPPING_ERROR, createSource(new SampleQueueMappingException("mimetype-sample"))},
            new Object[]{SOURCE, READING_LOCAL_FILE_ERROR, createSource(new FileDataSource.FileDataSourceException(new IOException()))},
            new Object[]{SOURCE, UNEXPECTED_LOADING_ERROR, createSource(new Loader.UnexpectedLoaderException(new Throwable()))},
            new Object[]{SOURCE, LIVE_STALE_MANIFEST_AND_NEW_MANIFEST_COULD_NOT_LOAD_ERROR, createSource(new DashManifestStaleException())},
            new Object[]{SOURCE, DOWNLOAD_ERROR, createSource(new DownloadException("download-exception"))},
            new Object[]{SOURCE, AD_LOAD_ERROR_THEN_WILL_SKIP, createSource(AdsMediaSource.AdLoadException.createForAd(new Exception()))},
            new Object[]{SOURCE, AD_GROUP_LOAD_ERROR_THEN_WILL_SKIP, createSource(AdsMediaSource.AdLoadException.createForAdGroup(new Exception(), 0))},
            new Object[]{SOURCE, ALL_ADS_LOAD_ERROR_THEN_WILL_SKIP, createSource(AdsMediaSource.AdLoadException.createForAllAds(new Exception()))},
            new Object[]{SOURCE, ADS_LOAD_UNEXPECTED_ERROR_THEN_WILL_SKIP, createSource(AdsMediaSource.AdLoadException.createForUnexpected(new RuntimeException()))},
            new Object[]{SOURCE, MERGING_MEDIA_SOURCE_CANNOT_MERGE_ITS_SOURCES, createSource(new MergingMediaSource.IllegalMergeException(MergingMediaSource.IllegalMergeException.REASON_PERIOD_COUNT_MISMATCH))},
            new Object[]{SOURCE, CLIPPING_MEDIA_SOURCE_CANNOT_CLIP_WRAPPED_SOURCE_INVALID_PERIOD_COUNT, createSource(new ClippingMediaSource.IllegalClippingException(ClippingMediaSource.IllegalClippingException.REASON_INVALID_PERIOD_COUNT))},
            new Object[]{SOURCE, CLIPPING_MEDIA_SOURCE_CANNOT_CLIP_WRAPPED_SOURCE_NOT_SEEKABLE_TO_START, createSource(new ClippingMediaSource.IllegalClippingException(ClippingMediaSource.IllegalClippingException.REASON_NOT_SEEKABLE_TO_START))},
            new Object[]{SOURCE, CLIPPING_MEDIA_SOURCE_CANNOT_CLIP_WRAPPED_SOURCE_INVALID_PERIOD_COUNT, createSource(new ClippingMediaSource.IllegalClippingException(ClippingMediaSource.IllegalClippingException.REASON_INVALID_PERIOD_COUNT))},
            new Object[]{SOURCE, TASK_CANNOT_PROCEED_PRIORITY_TOO_LOW, createSource(new PriorityTaskManager.PriorityTooLowException(1, 2))},
            new Object[]{SOURCE, PARSING_MEDIA_DATA_OR_METADATA_ERROR, createSource(new ParserException())},
            new Object[]{SOURCE, CACHE_WRITING_DATA_ERROR, createSource(new Cache.CacheException("cache-exception"))},
            new Object[]{SOURCE, READ_LOCAL_ASSET_ERROR, createSource(new AssetDataSource.AssetDataSourceException(new IOException()))},
            new Object[]{SOURCE, DATA_POSITION_OUT_OF_RANGE_ERROR, createSource(new DataSourceException(DataSourceException.POSITION_OUT_OF_RANGE))},

            new Object[]{CONNECTIVITY, HTTP_CANNOT_OPEN_ERROR, createSource(new HttpDataSource.HttpDataSourceException(new DataSpec(Uri.EMPTY, 0), HttpDataSource.HttpDataSourceException.TYPE_OPEN))},
            new Object[]{CONNECTIVITY, HTTP_CANNOT_READ_ERROR, createSource(new HttpDataSource.HttpDataSourceException(new DataSpec(Uri.EMPTY, 0), HttpDataSource.HttpDataSourceException.TYPE_READ))},
            new Object[]{CONNECTIVITY, HTTP_CANNOT_CLOSE_ERROR, createSource(new HttpDataSource.HttpDataSourceException(new DataSpec(Uri.EMPTY, 0), HttpDataSource.HttpDataSourceException.TYPE_CLOSE))},
            new Object[]{CONNECTIVITY, READ_CONTENT_URI_ERROR, createSource(new ContentDataSource.ContentDataSourceException(new IOException()))},
            new Object[]{CONNECTIVITY, READ_FROM_UDP_ERROR, createSource(new UdpDataSource.UdpDataSourceException(new IOException()))},

            new Object[]{RENDERER_DECODER, AUDIO_SINK_CONFIGURATION_ERROR, createRenderer(new AudioSink.ConfigurationException("configuration-exception"))},
            new Object[]{RENDERER_DECODER, AUDIO_SINK_INITIALISATION_ERROR, createRenderer(new AudioSink.InitializationException(0, 0, 0, 0))},
            new Object[]{RENDERER_DECODER, AUDIO_SINK_WRITE_ERROR, createRenderer(new AudioSink.WriteException(0))},
            new Object[]{RENDERER_DECODER, AUDIO_UNHANDLED_FORMAT_ERROR, createRenderer(new AudioProcessor.UnhandledFormatException(0, 0, 0))},
            new Object[]{RENDERER_DECODER, AUDIO_DECODER_ERROR, createRenderer(new AudioDecoderException("audio-decoder-exception"))},
            new Object[]{RENDERER_DECODER, INITIALISATION_ERROR, createRenderer(new MediaCodecRenderer.DecoderInitializationException(Format.createSampleFormat("id", "sample-mimety[e", 0), new Throwable(), true, 0))},
            new Object[]{RENDERER_DECODER, DECODING_SUBTITLE_ERROR, createRenderer(new SubtitleDecoderException("metadata-decoder-exception"))},

            new Object[]{DRM, UNSUPPORTED_DRM_SCHEME_ERROR, createRenderer(new UnsupportedDrmException(UnsupportedDrmException.REASON_UNSUPPORTED_SCHEME))},
            new Object[]{DRM, DRM_INSTANTIATION_ERROR, createRenderer(new UnsupportedDrmException(UnsupportedDrmException.REASON_INSTANTIATION_ERROR))},
            new Object[]{DRM, DRM_SESSION_ERROR, createRenderer(new DrmSession.DrmSessionException(new Throwable()))},
            new Object[]{DRM, DRM_KEYS_EXPIRED_ERROR, createRenderer(new KeysExpiredException())},
            new Object[]{DRM, MEDIA_REQUIRES_DRM_SESSION_MANAGER_ERROR, createRenderer(new IllegalStateException())},

            new Object[]{CONTENT_DECRYPTION, FAIL_DECRYPT_DATA_DUE_NON_PLATFORM_COMPONENT_ERROR, createRenderer(new DecryptionException(0, "decryption-exception"))},

            new Object[]{UNEXPECTED, MULTIPLE_RENDERER_MEDIA_CLOCK_ENABLED_ERROR, ExoPlaybackExceptionFactory.createForUnexpected(new IllegalStateException("Multiple renderer media clocks enabled."))},
            new Object[]{PlayerErrorType.UNKNOWN, DetailErrorType.UNKNOWN, ExoPlaybackExceptionFactory.createForUnexpected(new IllegalStateException("Any other exception"))}
            // DefaultAudioSink.InvalidAudioTrackTimestampException is private, cannot create
            // EGLSurfaceTexture.GlException is private, cannot create
            // PlaylistStuckException constructor is private, cannot create
            // PlaylistResetException constructor is private, cannot create
            // MediaCodecUtil.DecoderQueryException constructor is private, cannot create
            // DefaultDrmSessionManager.MissingSchemeDataException constructor is private, cannot create
            // Crypto Exceptions cannot be instantiated, it throws a RuntimeException("Stub!")
    );
}