Skip to content

Commit 15a6906

Browse files
committed
Formatting and javadoc
1 parent 2f6d8bf commit 15a6906

File tree

7 files changed

+23
-58
lines changed

7 files changed

+23
-58
lines changed

libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/ProgressiveMediaPeriod.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ interface Listener {
173173
* @param continueLoadingCheckIntervalBytes The number of bytes that should be loaded between each
174174
* invocation of {@link Callback#onContinueLoadingRequested(SequenceableLoader)}.
175175
* @param singleSampleDurationUs The duration of media with a single sample in microseconds.
176-
* @param downloadExecutor An {@link Executor} for supplying the loader's thread.
176+
* @param downloadExecutor An optional externally provided {@link Executor} for loading and
177+
* extracting media.
177178
*/
178179
// maybeFinishPrepare is not posted to the handler until initialization completes.
179180
@SuppressWarnings({"nullness:argument", "nullness:methodref.receiver.bound"})
@@ -201,8 +202,10 @@ public ProgressiveMediaPeriod(
201202
this.allocator = allocator;
202203
this.customCacheKey = customCacheKey;
203204
this.continueLoadingCheckIntervalBytes = continueLoadingCheckIntervalBytes;
204-
loader = downloadExecutor != null ?
205-
new Loader(downloadExecutor) : new Loader("ProgressiveMediaPeriod");
205+
loader =
206+
downloadExecutor != null
207+
? new Loader(downloadExecutor)
208+
: new Loader("ProgressiveMediaPeriod");
206209
this.progressiveMediaExtractor = progressiveMediaExtractor;
207210
this.singleSampleDurationUs = singleSampleDurationUs;
208211
loadCondition = new ConditionVariable();

libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/ProgressiveMediaSource.java

+3-5
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ public Factory(
157157
this.drmSessionManagerProvider = drmSessionManagerProvider;
158158
this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
159159
this.continueLoadingCheckIntervalBytes = continueLoadingCheckIntervalBytes;
160-
this.downloadExecutor = () -> null;
161160
}
162161

163162
@CanIgnoreReturnValue
@@ -202,11 +201,10 @@ public Factory setDrmSessionManagerProvider(
202201
}
203202

204203
/**
205-
* Sets a supplier that can return an {@link Executor} that is used for loading the media. This
206-
* is useful if the loading thread needs to be externally managed.
204+
* Sets a supplier for an {@link Executor} that is used for loading the media.
207205
*
208-
* @param downloadExecutor a {@link Supplier<Executor>} that provides an externally managed
209-
* {@link Executor} for downloading and extraction.
206+
* @param downloadExecutor A {@link Supplier<Executor>} that provides an externally managed
207+
* {@link Executor} for downloading and extraction.
210208
* @return This factory, for convenience.
211209
*/
212210
@CanIgnoreReturnValue

libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/chunk/ChunkSampleStream.java

+4-42
Original file line numberDiff line numberDiff line change
@@ -120,46 +120,8 @@ public interface ReleaseCallback<T extends ChunkSource> {
120120
* events.
121121
* @param canReportInitialDiscontinuity Whether the stream can report an initial discontinuity if
122122
* the first chunk can't start at the beginning and needs to preroll data.
123-
124-
*/
125-
public ChunkSampleStream(
126-
@C.TrackType int primaryTrackType,
127-
@Nullable int[] embeddedTrackTypes,
128-
@Nullable Format[] embeddedTrackFormats,
129-
T chunkSource,
130-
Callback<ChunkSampleStream<T>> callback,
131-
Allocator allocator,
132-
long positionUs,
133-
DrmSessionManager drmSessionManager,
134-
DrmSessionEventListener.EventDispatcher drmEventDispatcher,
135-
LoadErrorHandlingPolicy loadErrorHandlingPolicy,
136-
MediaSourceEventListener.EventDispatcher mediaSourceEventDispatcher,
137-
boolean canReportInitialDiscontinuity) {
138-
this(primaryTrackType, embeddedTrackTypes, embeddedTrackFormats, chunkSource, callback,
139-
allocator, positionUs, drmSessionManager, drmEventDispatcher, loadErrorHandlingPolicy,
140-
mediaSourceEventDispatcher, canReportInitialDiscontinuity, null);
141-
}
142-
143-
/**
144-
* Constructs an instance.
145-
*
146-
* @param primaryTrackType The {@link C.TrackType type} of the primary track.
147-
* @param embeddedTrackTypes The types of any embedded tracks, or null.
148-
* @param embeddedTrackFormats The formats of the embedded tracks, or null.
149-
* @param chunkSource A {@link ChunkSource} from which chunks to load are obtained.
150-
* @param callback An {@link Callback} for the stream.
151-
* @param allocator An {@link Allocator} from which allocations can be obtained.
152-
* @param positionUs The position from which to start loading media.
153-
* @param drmSessionManager The {@link DrmSessionManager} to obtain {@link DrmSession DrmSessions}
154-
* from.
155-
* @param drmEventDispatcher A dispatcher to notify of {@link DrmSessionEventListener} events.
156-
* @param loadErrorHandlingPolicy The {@link LoadErrorHandlingPolicy}.
157-
* @param mediaSourceEventDispatcher A dispatcher to notify of {@link MediaSourceEventListener}
158-
* events.
159-
* @param canReportInitialDiscontinuity Whether the stream can report an initial discontinuity if
160-
* the first chunk can't start at the beginning and needs to preroll data.
161-
* @param downloadExecutor An {@link Executor} for supplying the loader's thread. If null,
162-
* a default single thread executor is used.
123+
* @param downloadExecutor An optional externally provided {@link Executor} for loading and
124+
* extracting media.
163125
*/
164126
public ChunkSampleStream(
165127
@C.TrackType int primaryTrackType,
@@ -183,8 +145,8 @@ public ChunkSampleStream(
183145
this.mediaSourceEventDispatcher = mediaSourceEventDispatcher;
184146
this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
185147
this.canReportInitialDiscontinuity = canReportInitialDiscontinuity;
186-
loader = downloadExecutor != null ?
187-
new Loader(downloadExecutor) : new Loader("ChunkSampleStream");
148+
loader =
149+
downloadExecutor != null ? new Loader(downloadExecutor) : new Loader("ChunkSampleStream");
188150
nextChunkHolder = new ChunkHolder();
189151
mediaChunks = new ArrayList<>();
190152
readOnlyMediaChunks = Collections.unmodifiableList(mediaChunks);

libraries/exoplayer/src/test/java/androidx/media3/exoplayer/source/ProgressiveMediaPeriodTest.java

+4-5
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,12 @@ public void supplyingCustomDownloadExecutor_downloadsOnCustomThread() throws Tim
8686
private static void testExtractorsUpdatesSourceInfoBeforeOnPreparedCallback(
8787
ProgressiveMediaExtractor extractor, long imageDurationUs) throws TimeoutException {
8888
testExtractorsUpdatesSourceInfoBeforeOnPreparedCallback(
89-
extractor, imageDurationUs, null);
89+
extractor, imageDurationUs, /* executor= */ null);
9090
}
9191

9292
private static void testExtractorsUpdatesSourceInfoBeforeOnPreparedCallback(
93-
ProgressiveMediaExtractor extractor,
94-
long imageDurationUs,
95-
@Nullable Executor executor) throws TimeoutException {
93+
ProgressiveMediaExtractor extractor, long imageDurationUs, @Nullable Executor executor)
94+
throws TimeoutException {
9695
AtomicBoolean sourceInfoRefreshCalled = new AtomicBoolean(false);
9796
ProgressiveMediaPeriod.Listener sourceInfoRefreshListener =
9897
(durationUs, isSeekable, isLive) -> sourceInfoRefreshCalled.set(true);
@@ -137,7 +136,7 @@ public void onContinueLoadingRequested(MediaPeriod source) {
137136
assertThat(sourceInfoRefreshCalledBeforeOnPrepared.get()).isTrue();
138137
}
139138

140-
private class ExecutionTrackingThread extends Thread {
139+
private static final class ExecutionTrackingThread extends Thread {
141140
private final AtomicBoolean hasRun;
142141

143142
public ExecutionTrackingThread(Runnable runnable, AtomicBoolean hasRun) {

libraries/exoplayer_dash/src/main/java/androidx/media3/exoplayer/dash/DashMediaPeriod.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,8 @@ private ChunkSampleStream<DashChunkSource> buildSampleStream(
837837
drmEventDispatcher,
838838
loadErrorHandlingPolicy,
839839
mediaSourceEventDispatcher,
840-
canReportInitialDiscontinuity);
840+
canReportInitialDiscontinuity,
841+
/* downloadExecutor= */ null);
841842
synchronized (this) {
842843
// The map is also accessed on the loading thread so synchronize access.
843844
trackEmsgHandlerBySampleStream.put(stream, trackPlayerEmsgHandler);

libraries/exoplayer_smoothstreaming/src/main/java/androidx/media3/exoplayer/smoothstreaming/SsMediaPeriod.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,8 @@ private ChunkSampleStream<SsChunkSource> buildSampleStream(
265265
drmEventDispatcher,
266266
loadErrorHandlingPolicy,
267267
mediaSourceEventDispatcher,
268-
/* canReportInitialDiscontinuity= */ false);
268+
/* canReportInitialDiscontinuity= */ false,
269+
/* downloadExecutor= */ null);
269270
}
270271

271272
private static TrackGroupArray buildTrackGroups(

libraries/test_utils/src/main/java/androidx/media3/test/utils/FakeAdaptiveMediaPeriod.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ public long selectTracks(
188188
new DrmSessionEventListener.EventDispatcher(),
189189
new DefaultLoadErrorHandlingPolicy(/* minimumLoadableRetryCount= */ 3),
190190
mediaSourceEventDispatcher,
191-
/* canReportInitialDiscontinuity= */ false);
191+
/* canReportInitialDiscontinuity= */ false,
192+
/* downloadExecutor= */ null);
192193
streams[i] = sampleStream;
193194
sampleStreams.add(sampleStream);
194195
streamResetFlags[i] = true;

0 commit comments

Comments
 (0)