com.google.android.exoplayer2.util.ConditionVariable Java Examples
The following examples show how to use
com.google.android.exoplayer2.util.ConditionVariable.
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: ProgressiveMediaPeriod.java From MediaSDK with Apache License 2.0 | 6 votes |
@SuppressWarnings("method.invocation.invalid") public ExtractingLoadable( Uri uri, DataSource dataSource, ExtractorHolder extractorHolder, ExtractorOutput extractorOutput, ConditionVariable loadCondition) { this.uri = uri; this.dataSource = new StatsDataSource(dataSource); this.extractorHolder = extractorHolder; this.extractorOutput = extractorOutput; this.loadCondition = loadCondition; this.positionHolder = new PositionHolder(); this.pendingExtractorSeek = true; this.length = C.LENGTH_UNSET; dataSpec = buildDataSpec(/* position= */ 0); }
Example #2
Source File: ProgressiveMediaPeriod.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@SuppressWarnings("method.invocation.invalid") public ExtractingLoadable( Uri uri, DataSource dataSource, ExtractorHolder extractorHolder, ExtractorOutput extractorOutput, ConditionVariable loadCondition) { this.uri = uri; this.dataSource = new StatsDataSource(dataSource); this.extractorHolder = extractorHolder; this.extractorOutput = extractorOutput; this.loadCondition = loadCondition; this.positionHolder = new PositionHolder(); this.pendingExtractorSeek = true; this.length = C.LENGTH_UNSET; dataSpec = buildDataSpec(/* position= */ 0); }
Example #3
Source File: ProgressiveMediaPeriod.java From Telegram with GNU General Public License v2.0 | 6 votes |
@SuppressWarnings("method.invocation.invalid") public ExtractingLoadable( Uri uri, DataSource dataSource, ExtractorHolder extractorHolder, ExtractorOutput extractorOutput, ConditionVariable loadCondition) { this.uri = uri; this.dataSource = new StatsDataSource(dataSource); this.extractorHolder = extractorHolder; this.extractorOutput = extractorOutput; this.loadCondition = loadCondition; this.positionHolder = new PositionHolder(); this.pendingExtractorSeek = true; this.length = C.LENGTH_UNSET; dataSpec = buildDataSpec(/* position= */ 0); }
Example #4
Source File: ExtractorMediaPeriod.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public ExtractingLoadable(Uri uri, DataSource dataSource, ExtractorHolder extractorHolder, ConditionVariable loadCondition) { this.uri = Assertions.checkNotNull(uri); this.dataSource = new StatsDataSource(dataSource); this.extractorHolder = Assertions.checkNotNull(extractorHolder); this.loadCondition = loadCondition; this.positionHolder = new PositionHolder(); this.pendingExtractorSeek = true; this.length = C.LENGTH_UNSET; dataSpec = new DataSpec(uri, positionHolder.position, C.LENGTH_UNSET, customCacheKey); }
Example #5
Source File: ExtractorMediaPeriod.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public ExtractingLoadable(Uri uri, DataSource dataSource, ExtractorHolder extractorHolder, ConditionVariable loadCondition) { this.uri = Assertions.checkNotNull(uri); this.dataSource = new StatsDataSource(dataSource); this.extractorHolder = Assertions.checkNotNull(extractorHolder); this.loadCondition = loadCondition; this.positionHolder = new PositionHolder(); this.pendingExtractorSeek = true; this.length = C.LENGTH_UNSET; dataSpec = new DataSpec(uri, positionHolder.position, C.LENGTH_UNSET, customCacheKey); }
Example #6
Source File: ExtractorMediaPeriod.java From K-Sonic with MIT License | 5 votes |
/** * @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; }
Example #7
Source File: ExtractorMediaPeriod.java From K-Sonic with MIT License | 5 votes |
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; }
Example #8
Source File: ProgressiveMediaPeriod.java From MediaSDK with Apache License 2.0 | 4 votes |
/** * @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 loadErrorHandlingPolicy The {@link LoadErrorHandlingPolicy}. * @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)}. */ // maybeFinishPrepare is not posted to the handler until initialization completes. @SuppressWarnings({ "nullness:argument.type.incompatible", "nullness:methodref.receiver.bound.invalid" }) public ProgressiveMediaPeriod( Uri uri, DataSource dataSource, Extractor[] extractors, DrmSessionManager<?> drmSessionManager, LoadErrorHandlingPolicy loadErrorHandlingPolicy, EventDispatcher eventDispatcher, Listener listener, Allocator allocator, @Nullable String customCacheKey, int continueLoadingCheckIntervalBytes) { this.uri = uri; this.dataSource = dataSource; this.drmSessionManager = drmSessionManager; this.loadErrorHandlingPolicy = loadErrorHandlingPolicy; this.eventDispatcher = eventDispatcher; this.listener = listener; this.allocator = allocator; this.customCacheKey = customCacheKey; this.continueLoadingCheckIntervalBytes = continueLoadingCheckIntervalBytes; loader = new Loader("Loader:ProgressiveMediaPeriod"); extractorHolder = new ExtractorHolder(extractors); loadCondition = new ConditionVariable(); maybeFinishPrepareRunnable = this::maybeFinishPrepare; onContinueLoadingRequestedRunnable = () -> { if (!released) { Assertions.checkNotNull(callback) .onContinueLoadingRequested(ProgressiveMediaPeriod.this); } }; handler = new Handler(); sampleQueueTrackIds = new TrackId[0]; sampleQueues = new SampleQueue[0]; pendingResetPositionUs = C.TIME_UNSET; length = C.LENGTH_UNSET; durationUs = C.TIME_UNSET; dataType = C.DATA_TYPE_MEDIA; eventDispatcher.mediaPeriodCreated(); }
Example #9
Source File: ExtractorMediaPeriod.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
/** * @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; durationUs = C.TIME_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; eventDispatcher.mediaPeriodCreated(); }
Example #10
Source File: ExtractorMediaPeriod.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
/** * @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; durationUs = C.TIME_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; eventDispatcher.mediaPeriodCreated(); }
Example #11
Source File: ProgressiveMediaPeriod.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
/** * @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 loadErrorHandlingPolicy The {@link LoadErrorHandlingPolicy}. * @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)}. */ // maybeFinishPrepare is not posted to the handler until initialization completes. @SuppressWarnings({ "nullness:argument.type.incompatible", "nullness:methodref.receiver.bound.invalid" }) public ProgressiveMediaPeriod( Uri uri, DataSource dataSource, Extractor[] extractors, LoadErrorHandlingPolicy loadErrorHandlingPolicy, EventDispatcher eventDispatcher, Listener listener, Allocator allocator, @Nullable String customCacheKey, int continueLoadingCheckIntervalBytes) { this.uri = uri; this.dataSource = dataSource; this.loadErrorHandlingPolicy = loadErrorHandlingPolicy; this.eventDispatcher = eventDispatcher; this.listener = listener; this.allocator = allocator; this.customCacheKey = customCacheKey; this.continueLoadingCheckIntervalBytes = continueLoadingCheckIntervalBytes; loader = new Loader("Loader:ProgressiveMediaPeriod"); extractorHolder = new ExtractorHolder(extractors); loadCondition = new ConditionVariable(); maybeFinishPrepareRunnable = this::maybeFinishPrepare; onContinueLoadingRequestedRunnable = () -> { if (!released) { Assertions.checkNotNull(callback) .onContinueLoadingRequested(ProgressiveMediaPeriod.this); } }; handler = new Handler(); sampleQueueTrackIds = new TrackId[0]; sampleQueues = new SampleQueue[0]; pendingResetPositionUs = C.TIME_UNSET; length = C.LENGTH_UNSET; durationUs = C.TIME_UNSET; dataType = C.DATA_TYPE_MEDIA; eventDispatcher.mediaPeriodCreated(); }
Example #12
Source File: ProgressiveMediaPeriod.java From Telegram with GNU General Public License v2.0 | 4 votes |
/** * @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 loadErrorHandlingPolicy The {@link LoadErrorHandlingPolicy}. * @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)}. */ // maybeFinishPrepare is not posted to the handler until initialization completes. @SuppressWarnings({ "nullness:argument.type.incompatible", "nullness:methodref.receiver.bound.invalid" }) public ProgressiveMediaPeriod( Uri uri, DataSource dataSource, Extractor[] extractors, LoadErrorHandlingPolicy loadErrorHandlingPolicy, EventDispatcher eventDispatcher, Listener listener, Allocator allocator, @Nullable String customCacheKey, int continueLoadingCheckIntervalBytes) { this.uri = uri; this.dataSource = dataSource; this.loadErrorHandlingPolicy = loadErrorHandlingPolicy; this.eventDispatcher = eventDispatcher; this.listener = listener; this.allocator = allocator; this.customCacheKey = customCacheKey; this.continueLoadingCheckIntervalBytes = continueLoadingCheckIntervalBytes; loader = new Loader("Loader:ProgressiveMediaPeriod"); extractorHolder = new ExtractorHolder(extractors); loadCondition = new ConditionVariable(); maybeFinishPrepareRunnable = this::maybeFinishPrepare; onContinueLoadingRequestedRunnable = () -> { if (!released) { Assertions.checkNotNull(callback) .onContinueLoadingRequested(ProgressiveMediaPeriod.this); } }; handler = new Handler(); sampleQueueTrackIds = new TrackId[0]; sampleQueues = new SampleQueue[0]; pendingResetPositionUs = C.TIME_UNSET; length = C.LENGTH_UNSET; durationUs = C.TIME_UNSET; dataType = C.DATA_TYPE_MEDIA; eventDispatcher.mediaPeriodCreated(); }