Java 类com.google.android.exoplayer2.util.ConditionVariable 实例源码

项目:transistor    文件:CronetDataSource.java   
CronetDataSource(CronetEngine cronetEngine, Executor executor,
    Predicate<String> contentTypePredicate, TransferListener<? super CronetDataSource> listener,
    int connectTimeoutMs, int readTimeoutMs, boolean resetTimeoutOnRedirects, Clock clock,
    RequestProperties defaultRequestProperties, boolean handleSetCookieRequests) {
  this.cronetEngine = Assertions.checkNotNull(cronetEngine);
  this.executor = Assertions.checkNotNull(executor);
  this.contentTypePredicate = contentTypePredicate;
  this.listener = listener;
  this.connectTimeoutMs = connectTimeoutMs;
  this.readTimeoutMs = readTimeoutMs;
  this.resetTimeoutOnRedirects = resetTimeoutOnRedirects;
  this.clock = Assertions.checkNotNull(clock);
  this.defaultRequestProperties = defaultRequestProperties;
  this.handleSetCookieRequests = handleSetCookieRequests;
  requestProperties = new RequestProperties();
  operation = new ConditionVariable();
}
项目:Exoplayer2Radio    文件:ExtractorMediaPeriod.java   
/**
 * @param uri The {@link Uri} of the media stream.
 * @param dataSource The data source to read the media.
 * @param extractors The extractors to use to read the data source.
 * @param minLoadableRetryCount The minimum number of times to retry if a loading error occurs.
 * @param eventHandler A handler for events. May be null if delivery of events is not required.
 * @param eventListener A listener of events. May be null if delivery of events is not required.
 * @param sourceListener A listener to notify when the timeline has been loaded.
 * @param allocator An {@link Allocator} from which to obtain media buffer allocations.
 * @param customCacheKey A custom key that uniquely identifies the original stream. Used for cache
 *     indexing. May be null.
 */
public ExtractorMediaPeriod(Uri uri, DataSource dataSource, Extractor[] extractors,
    int minLoadableRetryCount, Handler eventHandler,
    ExtractorMediaSource.EventListener eventListener, MediaSource.Listener sourceListener,
    Allocator allocator, String customCacheKey) {
  this.uri = uri;
  this.dataSource = dataSource;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.eventHandler = eventHandler;
  this.eventListener = eventListener;
  this.sourceListener = sourceListener;
  this.allocator = allocator;
  this.customCacheKey = customCacheKey;
  loader = new Loader("Loader:ExtractorMediaPeriod");
  extractorHolder = new ExtractorHolder(extractors, this);
  loadCondition = new ConditionVariable();
  maybeFinishPrepareRunnable = new Runnable() {
    @Override
    public void run() {
      maybeFinishPrepare();
    }
  };
  onContinueLoadingRequestedRunnable = new Runnable() {
    @Override
    public void run() {
      if (!released) {
        callback.onContinueLoadingRequested(ExtractorMediaPeriod.this);
      }
    }
  };
  handler = new Handler();

  pendingResetPositionUs = C.TIME_UNSET;
  sampleQueues = new SparseArray<>();
  length = C.LENGTH_UNSET;
}
项目:Exoplayer2Radio    文件:ExtractorMediaPeriod.java   
public ExtractingLoadable(Uri uri, DataSource dataSource, ExtractorHolder extractorHolder,
    ConditionVariable loadCondition) {
  this.uri = Assertions.checkNotNull(uri);
  this.dataSource = Assertions.checkNotNull(dataSource);
  this.extractorHolder = Assertions.checkNotNull(extractorHolder);
  this.loadCondition = loadCondition;
  this.positionHolder = new PositionHolder();
  this.pendingExtractorSeek = true;
  this.length = C.LENGTH_UNSET;
}
项目:K-Sonic    文件:ExtractorMediaPeriod.java   
/**
 * @param uri The {@link Uri} of the media stream.
 * @param dataSource The data source to read the media.
 * @param extractors The extractors to use to read the data source.
 * @param minLoadableRetryCount The minimum number of times to retry if a loading error occurs.
 * @param eventHandler A handler for events. May be null if delivery of events is not required.
 * @param eventListener A listener of events. May be null if delivery of events is not required.
 * @param sourceListener A listener to notify when the timeline has been loaded.
 * @param allocator An {@link Allocator} from which to obtain media buffer allocations.
 * @param customCacheKey A custom key that uniquely identifies the original stream. Used for cache
 *     indexing. May be null.
 */
public ExtractorMediaPeriod(Uri uri, DataSource dataSource, Extractor[] extractors,
    int minLoadableRetryCount, Handler eventHandler,
    ExtractorMediaSource.EventListener eventListener, MediaSource.Listener sourceListener,
    Allocator allocator, String customCacheKey) {
  this.uri = uri;
  this.dataSource = dataSource;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.eventHandler = eventHandler;
  this.eventListener = eventListener;
  this.sourceListener = sourceListener;
  this.allocator = allocator;
  this.customCacheKey = customCacheKey;
  loader = new Loader("Loader:ExtractorMediaPeriod");
  extractorHolder = new ExtractorHolder(extractors, this);
  loadCondition = new ConditionVariable();
  maybeFinishPrepareRunnable = new Runnable() {
    @Override
    public void run() {
      maybeFinishPrepare();
    }
  };
  onContinueLoadingRequestedRunnable = new Runnable() {
    @Override
    public void run() {
      if (!released) {
        callback.onContinueLoadingRequested(ExtractorMediaPeriod.this);
      }
    }
  };
  handler = new Handler();

  pendingResetPositionUs = C.TIME_UNSET;
  sampleQueues = new SparseArray<>();
  length = C.LENGTH_UNSET;
}
项目:K-Sonic    文件:ExtractorMediaPeriod.java   
public ExtractingLoadable(Uri uri, DataSource dataSource, ExtractorHolder extractorHolder,
    ConditionVariable loadCondition) {
  this.uri = Assertions.checkNotNull(uri);
  this.dataSource = Assertions.checkNotNull(dataSource);
  this.extractorHolder = Assertions.checkNotNull(extractorHolder);
  this.loadCondition = loadCondition;
  this.positionHolder = new PositionHolder();
  this.pendingExtractorSeek = true;
  this.length = C.LENGTH_UNSET;
}
项目:videoPickPlayer    文件:ExtractorMediaPeriod.java   
/**
 * @param uri The {@link Uri} of the media stream.
 * @param dataSource The data source to read the media.
 * @param extractors The extractors to use to read the data source.
 * @param minLoadableRetryCount The minimum number of times to retry if a loading error occurs.
 * @param eventHandler A handler for events. May be null if delivery of events is not required.
 * @param eventListener A listener of events. May be null if delivery of events is not required.
 * @param sourceListener A listener to notify when the timeline has been loaded.
 * @param allocator An {@link Allocator} from which to obtain media buffer allocations.
 */
public ExtractorMediaPeriod(Uri uri, DataSource dataSource, Extractor[] extractors,
    int minLoadableRetryCount, Handler eventHandler,
    ExtractorMediaSource.EventListener eventListener, MediaSource.Listener sourceListener,
    Allocator allocator) {
  this.uri = uri;
  this.dataSource = dataSource;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.eventHandler = eventHandler;
  this.eventListener = eventListener;
  this.sourceListener = sourceListener;
  this.allocator = allocator;
  loader = new Loader("Loader:ExtractorMediaPeriod");
  extractorHolder = new ExtractorHolder(extractors, this);
  loadCondition = new ConditionVariable();
  maybeFinishPrepareRunnable = new Runnable() {
    @Override
    public void run() {
      maybeFinishPrepare();
    }
  };
  onContinueLoadingRequestedRunnable = new Runnable() {
    @Override
    public void run() {
      if (!released) {
        callback.onContinueLoadingRequested(ExtractorMediaPeriod.this);
      }
    }
  };
  handler = new Handler();

  pendingResetPositionUs = C.TIME_UNSET;
  sampleQueues = new SparseArray<>();
  length = C.LENGTH_UNSET;
}
项目:videoPickPlayer    文件:ExtractorMediaPeriod.java   
public ExtractingLoadable(Uri uri, DataSource dataSource, ExtractorHolder extractorHolder,
    ConditionVariable loadCondition) {
  this.uri = Assertions.checkNotNull(uri);
  this.dataSource = Assertions.checkNotNull(dataSource);
  this.extractorHolder = Assertions.checkNotNull(extractorHolder);
  this.loadCondition = loadCondition;
  this.positionHolder = new PositionHolder();
  this.pendingExtractorSeek = true;
  this.length = C.LENGTH_UNSET;
}
项目:transistor    文件:CronetDataSource.java   
private static int getStatus(UrlRequest request) throws InterruptedException {
  final ConditionVariable conditionVariable = new ConditionVariable();
  final int[] statusHolder = new int[1];
  request.getStatus(new UrlRequest.StatusListener() {
    @Override
    public void onStatus(int status) {
      statusHolder[0] = status;
      conditionVariable.open();
    }
  });
  conditionVariable.block();
  return statusHolder[0];
}
项目:transistor    文件:ExtractorMediaPeriod.java   
public ExtractingLoadable(Uri uri, DataSource dataSource, ExtractorHolder extractorHolder,
    ConditionVariable loadCondition) {
  this.uri = Assertions.checkNotNull(uri);
  this.dataSource = Assertions.checkNotNull(dataSource);
  this.extractorHolder = Assertions.checkNotNull(extractorHolder);
  this.loadCondition = loadCondition;
  this.positionHolder = new PositionHolder();
  this.pendingExtractorSeek = true;
  this.length = C.LENGTH_UNSET;
}
项目:transistor    文件:ExtractorMediaPeriod.java   
/**
 * @param uri The {@link Uri} of the media stream.
 * @param dataSource The data source to read the media.
 * @param extractors The extractors to use to read the data source.
 * @param minLoadableRetryCount The minimum number of times to retry if a loading error occurs.
 * @param eventDispatcher A dispatcher to notify of events.
 * @param listener A listener to notify when information about the period changes.
 * @param allocator An {@link Allocator} from which to obtain media buffer allocations.
 * @param customCacheKey A custom key that uniquely identifies the original stream. Used for cache
 *     indexing. May be null.
 * @param continueLoadingCheckIntervalBytes The number of bytes that should be loaded between each
 *     invocation of {@link Callback#onContinueLoadingRequested(SequenceableLoader)}.
 */
public ExtractorMediaPeriod(
    Uri uri,
    DataSource dataSource,
    Extractor[] extractors,
    int minLoadableRetryCount,
    EventDispatcher eventDispatcher,
    Listener listener,
    Allocator allocator,
    @Nullable String customCacheKey,
    int continueLoadingCheckIntervalBytes) {
  this.uri = uri;
  this.dataSource = dataSource;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.eventDispatcher = eventDispatcher;
  this.listener = listener;
  this.allocator = allocator;
  this.customCacheKey = customCacheKey;
  this.continueLoadingCheckIntervalBytes = continueLoadingCheckIntervalBytes;
  loader = new Loader("Loader:ExtractorMediaPeriod");
  extractorHolder = new ExtractorHolder(extractors, this);
  loadCondition = new ConditionVariable();
  maybeFinishPrepareRunnable = new Runnable() {
    @Override
    public void run() {
      maybeFinishPrepare();
    }
  };
  onContinueLoadingRequestedRunnable = new Runnable() {
    @Override
    public void run() {
      if (!released) {
        callback.onContinueLoadingRequested(ExtractorMediaPeriod.this);
      }
    }
  };
  handler = new Handler();
  sampleQueueTrackIds = new int[0];
  sampleQueues = new SampleQueue[0];
  pendingResetPositionUs = C.TIME_UNSET;
  length = C.LENGTH_UNSET;
  // Assume on-demand for MIN_RETRY_COUNT_DEFAULT_FOR_MEDIA, until prepared.
  actualMinLoadableRetryCount =
      minLoadableRetryCount == ExtractorMediaSource.MIN_RETRY_COUNT_DEFAULT_FOR_MEDIA
      ? ExtractorMediaSource.DEFAULT_MIN_LOADABLE_RETRY_COUNT_ON_DEMAND
      : minLoadableRetryCount;
}