Formatting and javadoc
This commit is contained in:
parent
2f6d8bf5ba
commit
15a6906877
@ -173,7 +173,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
* @param continueLoadingCheckIntervalBytes The number of bytes that should be loaded between each
|
||||
* invocation of {@link Callback#onContinueLoadingRequested(SequenceableLoader)}.
|
||||
* @param singleSampleDurationUs The duration of media with a single sample in microseconds.
|
||||
* @param downloadExecutor An {@link Executor} for supplying the loader's thread.
|
||||
* @param downloadExecutor An optional externally provided {@link Executor} for loading and
|
||||
* extracting media.
|
||||
*/
|
||||
// maybeFinishPrepare is not posted to the handler until initialization completes.
|
||||
@SuppressWarnings({"nullness:argument", "nullness:methodref.receiver.bound"})
|
||||
@ -201,8 +202,10 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
this.allocator = allocator;
|
||||
this.customCacheKey = customCacheKey;
|
||||
this.continueLoadingCheckIntervalBytes = continueLoadingCheckIntervalBytes;
|
||||
loader = downloadExecutor != null ?
|
||||
new Loader(downloadExecutor) : new Loader("ProgressiveMediaPeriod");
|
||||
loader =
|
||||
downloadExecutor != null
|
||||
? new Loader(downloadExecutor)
|
||||
: new Loader("ProgressiveMediaPeriod");
|
||||
this.progressiveMediaExtractor = progressiveMediaExtractor;
|
||||
this.singleSampleDurationUs = singleSampleDurationUs;
|
||||
loadCondition = new ConditionVariable();
|
||||
|
@ -157,7 +157,6 @@ public final class ProgressiveMediaSource extends BaseMediaSource
|
||||
this.drmSessionManagerProvider = drmSessionManagerProvider;
|
||||
this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
|
||||
this.continueLoadingCheckIntervalBytes = continueLoadingCheckIntervalBytes;
|
||||
this.downloadExecutor = () -> null;
|
||||
}
|
||||
|
||||
@CanIgnoreReturnValue
|
||||
@ -202,11 +201,10 @@ public final class ProgressiveMediaSource extends BaseMediaSource
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a supplier that can return an {@link Executor} that is used for loading the media. This
|
||||
* is useful if the loading thread needs to be externally managed.
|
||||
* Sets a supplier for an {@link Executor} that is used for loading the media.
|
||||
*
|
||||
* @param downloadExecutor a {@link Supplier<Executor>} that provides an externally managed
|
||||
* {@link Executor} for downloading and extraction.
|
||||
* @param downloadExecutor A {@link Supplier<Executor>} that provides an externally managed
|
||||
* {@link Executor} for downloading and extraction.
|
||||
* @return This factory, for convenience.
|
||||
*/
|
||||
@CanIgnoreReturnValue
|
||||
|
@ -120,46 +120,8 @@ public class ChunkSampleStream<T extends ChunkSource>
|
||||
* events.
|
||||
* @param canReportInitialDiscontinuity Whether the stream can report an initial discontinuity if
|
||||
* the first chunk can't start at the beginning and needs to preroll data.
|
||||
|
||||
*/
|
||||
public ChunkSampleStream(
|
||||
@C.TrackType int primaryTrackType,
|
||||
@Nullable int[] embeddedTrackTypes,
|
||||
@Nullable Format[] embeddedTrackFormats,
|
||||
T chunkSource,
|
||||
Callback<ChunkSampleStream<T>> callback,
|
||||
Allocator allocator,
|
||||
long positionUs,
|
||||
DrmSessionManager drmSessionManager,
|
||||
DrmSessionEventListener.EventDispatcher drmEventDispatcher,
|
||||
LoadErrorHandlingPolicy loadErrorHandlingPolicy,
|
||||
MediaSourceEventListener.EventDispatcher mediaSourceEventDispatcher,
|
||||
boolean canReportInitialDiscontinuity) {
|
||||
this(primaryTrackType, embeddedTrackTypes, embeddedTrackFormats, chunkSource, callback,
|
||||
allocator, positionUs, drmSessionManager, drmEventDispatcher, loadErrorHandlingPolicy,
|
||||
mediaSourceEventDispatcher, canReportInitialDiscontinuity, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an instance.
|
||||
*
|
||||
* @param primaryTrackType The {@link C.TrackType type} of the primary track.
|
||||
* @param embeddedTrackTypes The types of any embedded tracks, or null.
|
||||
* @param embeddedTrackFormats The formats of the embedded tracks, or null.
|
||||
* @param chunkSource A {@link ChunkSource} from which chunks to load are obtained.
|
||||
* @param callback An {@link Callback} for the stream.
|
||||
* @param allocator An {@link Allocator} from which allocations can be obtained.
|
||||
* @param positionUs The position from which to start loading media.
|
||||
* @param drmSessionManager The {@link DrmSessionManager} to obtain {@link DrmSession DrmSessions}
|
||||
* from.
|
||||
* @param drmEventDispatcher A dispatcher to notify of {@link DrmSessionEventListener} events.
|
||||
* @param loadErrorHandlingPolicy The {@link LoadErrorHandlingPolicy}.
|
||||
* @param mediaSourceEventDispatcher A dispatcher to notify of {@link MediaSourceEventListener}
|
||||
* events.
|
||||
* @param canReportInitialDiscontinuity Whether the stream can report an initial discontinuity if
|
||||
* the first chunk can't start at the beginning and needs to preroll data.
|
||||
* @param downloadExecutor An {@link Executor} for supplying the loader's thread. If null,
|
||||
* a default single thread executor is used.
|
||||
* @param downloadExecutor An optional externally provided {@link Executor} for loading and
|
||||
* extracting media.
|
||||
*/
|
||||
public ChunkSampleStream(
|
||||
@C.TrackType int primaryTrackType,
|
||||
@ -183,8 +145,8 @@ public class ChunkSampleStream<T extends ChunkSource>
|
||||
this.mediaSourceEventDispatcher = mediaSourceEventDispatcher;
|
||||
this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
|
||||
this.canReportInitialDiscontinuity = canReportInitialDiscontinuity;
|
||||
loader = downloadExecutor != null ?
|
||||
new Loader(downloadExecutor) : new Loader("ChunkSampleStream");
|
||||
loader =
|
||||
downloadExecutor != null ? new Loader(downloadExecutor) : new Loader("ChunkSampleStream");
|
||||
nextChunkHolder = new ChunkHolder();
|
||||
mediaChunks = new ArrayList<>();
|
||||
readOnlyMediaChunks = Collections.unmodifiableList(mediaChunks);
|
||||
|
@ -86,13 +86,12 @@ public final class ProgressiveMediaPeriodTest {
|
||||
private static void testExtractorsUpdatesSourceInfoBeforeOnPreparedCallback(
|
||||
ProgressiveMediaExtractor extractor, long imageDurationUs) throws TimeoutException {
|
||||
testExtractorsUpdatesSourceInfoBeforeOnPreparedCallback(
|
||||
extractor, imageDurationUs, null);
|
||||
extractor, imageDurationUs, /* executor= */ null);
|
||||
}
|
||||
|
||||
private static void testExtractorsUpdatesSourceInfoBeforeOnPreparedCallback(
|
||||
ProgressiveMediaExtractor extractor,
|
||||
long imageDurationUs,
|
||||
@Nullable Executor executor) throws TimeoutException {
|
||||
ProgressiveMediaExtractor extractor, long imageDurationUs, @Nullable Executor executor)
|
||||
throws TimeoutException {
|
||||
AtomicBoolean sourceInfoRefreshCalled = new AtomicBoolean(false);
|
||||
ProgressiveMediaPeriod.Listener sourceInfoRefreshListener =
|
||||
(durationUs, isSeekable, isLive) -> sourceInfoRefreshCalled.set(true);
|
||||
@ -137,7 +136,7 @@ public final class ProgressiveMediaPeriodTest {
|
||||
assertThat(sourceInfoRefreshCalledBeforeOnPrepared.get()).isTrue();
|
||||
}
|
||||
|
||||
private class ExecutionTrackingThread extends Thread {
|
||||
private static final class ExecutionTrackingThread extends Thread {
|
||||
private final AtomicBoolean hasRun;
|
||||
|
||||
public ExecutionTrackingThread(Runnable runnable, AtomicBoolean hasRun) {
|
||||
|
@ -837,7 +837,8 @@ import java.util.regex.Pattern;
|
||||
drmEventDispatcher,
|
||||
loadErrorHandlingPolicy,
|
||||
mediaSourceEventDispatcher,
|
||||
canReportInitialDiscontinuity);
|
||||
canReportInitialDiscontinuity,
|
||||
/* downloadExecutor= */ null);
|
||||
synchronized (this) {
|
||||
// The map is also accessed on the loading thread so synchronize access.
|
||||
trackEmsgHandlerBySampleStream.put(stream, trackPlayerEmsgHandler);
|
||||
|
@ -265,7 +265,8 @@ import java.util.List;
|
||||
drmEventDispatcher,
|
||||
loadErrorHandlingPolicy,
|
||||
mediaSourceEventDispatcher,
|
||||
/* canReportInitialDiscontinuity= */ false);
|
||||
/* canReportInitialDiscontinuity= */ false,
|
||||
/* downloadExecutor= */ null);
|
||||
}
|
||||
|
||||
private static TrackGroupArray buildTrackGroups(
|
||||
|
@ -188,7 +188,8 @@ public class FakeAdaptiveMediaPeriod
|
||||
new DrmSessionEventListener.EventDispatcher(),
|
||||
new DefaultLoadErrorHandlingPolicy(/* minimumLoadableRetryCount= */ 3),
|
||||
mediaSourceEventDispatcher,
|
||||
/* canReportInitialDiscontinuity= */ false);
|
||||
/* canReportInitialDiscontinuity= */ false,
|
||||
/* downloadExecutor= */ null);
|
||||
streams[i] = sampleStream;
|
||||
sampleStreams.add(sampleStream);
|
||||
streamResetFlags[i] = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user