Fix Dackka/Metalava errors in the ExoPlayer module

This makes two types of fix:
1. Align parameter names on overridden methods where the superclass
   has `@param` javadoc.
2. Use `@hide` on `protected final` methods that refer to package-private
   types. This will hide these symbols from Dackka javadoc generation
   but not (currently) from the artefacts distributed on Maven. These
   methods are currently unusable outside their package anyway (e.g. by
   external developers) because of the dependency on a package-private
   type.

This also changes some HLS, SmoothStreaming, and IMA code where I've renamed
parameters of overridden methods to be consistent across the type
hierarchy.

#minor-release

PiperOrigin-RevId: 487472665
This commit is contained in:
ibaker 2022-11-10 09:58:57 +00:00 committed by microkatz
parent 2ff5dab003
commit 7905744a83
10 changed files with 58 additions and 43 deletions

View File

@ -228,11 +228,11 @@ public final class ClippingMediaSource extends WrappingMediaSource {
}
@Override
protected void onChildSourceInfoRefreshed(Timeline timeline) {
protected void onChildSourceInfoRefreshed(Timeline newTimeline) {
if (clippingError != null) {
return;
}
refreshClippedTimeline(timeline);
refreshClippedTimeline(newTimeline);
}
private void refreshClippedTimeline(Timeline timeline) {

View File

@ -92,12 +92,12 @@ public abstract class CompositeMediaSource<T> extends BaseMediaSource {
/**
* Called when the source info of a child source has been refreshed.
*
* @param id The unique id used to prepare the child source.
* @param childSourceId The unique id used to prepare the child source.
* @param mediaSource The child source whose source info has been refreshed.
* @param timeline The timeline of the child source.
* @param newTimeline The timeline of the child source.
*/
protected abstract void onChildSourceInfoRefreshed(
@UnknownNull T id, MediaSource mediaSource, Timeline timeline);
@UnknownNull T childSourceId, MediaSource mediaSource, Timeline newTimeline);
/**
* Prepares a child source.
@ -161,11 +161,11 @@ public abstract class CompositeMediaSource<T> extends BaseMediaSource {
* Returns the window index in the composite source corresponding to the specified window index in
* a child source. The default implementation does not change the window index.
*
* @param id The unique id used to prepare the child source.
* @param childSourceId The unique id used to prepare the child source.
* @param windowIndex A window index of the child source.
* @return The corresponding window index in the composite source.
*/
protected int getWindowIndexForChildWindowIndex(@UnknownNull T id, int windowIndex) {
protected int getWindowIndexForChildWindowIndex(@UnknownNull T childSourceId, int windowIndex) {
return windowIndex;
}
@ -174,14 +174,14 @@ public abstract class CompositeMediaSource<T> extends BaseMediaSource {
* MediaPeriodId} in a child source. The default implementation does not change the media period
* id.
*
* @param id The unique id used to prepare the child source.
* @param childSourceId The unique id used to prepare the child source.
* @param mediaPeriodId A {@link MediaPeriodId} of the child source.
* @return The corresponding {@link MediaPeriodId} in the composite source. Null if no
* corresponding media period id can be determined.
*/
@Nullable
protected MediaPeriodId getMediaPeriodIdForChildMediaPeriodId(
@UnknownNull T id, MediaPeriodId mediaPeriodId) {
@UnknownNull T childSourceId, MediaPeriodId mediaPeriodId) {
return mediaPeriodId;
}
@ -190,13 +190,13 @@ public abstract class CompositeMediaSource<T> extends BaseMediaSource {
* specified media time in the {@link MediaPeriod} of the child source. The default implementation
* does not change the media time.
*
* @param id The unique id used to prepare the child source.
* @param childSourceId The unique id used to prepare the child source.
* @param mediaTimeMs A media time in the {@link MediaPeriod} of the child source, in
* milliseconds.
* @return The corresponding media time in the {@link MediaPeriod} of the composite source, in
* milliseconds.
*/
protected long getMediaTimeForChildMediaTime(@UnknownNull T id, long mediaTimeMs) {
protected long getMediaTimeForChildMediaTime(@UnknownNull T childSourceId, long mediaTimeMs) {
return mediaTimeMs;
}

View File

@ -528,12 +528,22 @@ public final class ConcatenatingMediaSource extends CompositeMediaSource<MediaSo
dispatchOnCompletionActions(pendingOnCompletionActions);
}
/**
* {@inheritDoc}
*
* @hide
*/
@Override
protected void onChildSourceInfoRefreshed(
MediaSourceHolder mediaSourceHolder, MediaSource mediaSource, Timeline timeline) {
updateMediaSourceInternal(mediaSourceHolder, timeline);
}
/**
* {@inheritDoc}
*
* @hide
*/
@Override
@Nullable
protected MediaPeriodId getMediaPeriodIdForChildMediaPeriodId(
@ -550,6 +560,11 @@ public final class ConcatenatingMediaSource extends CompositeMediaSource<MediaSo
return null;
}
/**
* {@inheritDoc}
*
* @hide
*/
@Override
protected int getWindowIndexForChildWindowIndex(
MediaSourceHolder mediaSourceHolder, int windowIndex) {

View File

@ -110,11 +110,11 @@ public final class LoopingMediaSource extends WrappingMediaSource {
}
@Override
protected void onChildSourceInfoRefreshed(Timeline timeline) {
protected void onChildSourceInfoRefreshed(Timeline newTimeline) {
Timeline loopingTimeline =
loopCount != Integer.MAX_VALUE
? new LoopingTimeline(timeline, loopCount)
: new InfinitelyLoopingTimeline(timeline);
? new LoopingTimeline(newTimeline, loopCount)
: new InfinitelyLoopingTimeline(newTimeline);
refreshSourceInfo(loopingTimeline);
}

View File

@ -238,13 +238,13 @@ public final class MergingMediaSource extends CompositeMediaSource<Integer> {
@Override
protected void onChildSourceInfoRefreshed(
Integer id, MediaSource mediaSource, Timeline timeline) {
Integer childSourceId, MediaSource mediaSource, Timeline newTimeline) {
if (mergeError != null) {
return;
}
if (periodCount == PERIOD_COUNT_UNSET) {
periodCount = timeline.getPeriodCount();
} else if (timeline.getPeriodCount() != periodCount) {
periodCount = newTimeline.getPeriodCount();
} else if (newTimeline.getPeriodCount() != periodCount) {
mergeError = new IllegalMergeException(IllegalMergeException.REASON_PERIOD_COUNT_MISMATCH);
return;
}
@ -252,7 +252,7 @@ public final class MergingMediaSource extends CompositeMediaSource<Integer> {
periodTimeOffsetsUs = new long[periodCount][timelines.length];
}
pendingTimelineSources.remove(mediaSource);
timelines[id] = timeline;
timelines[childSourceId] = newTimeline;
if (pendingTimelineSources.isEmpty()) {
if (adjustPeriodTimeOffsets) {
computePeriodTimeOffsets();
@ -269,8 +269,8 @@ public final class MergingMediaSource extends CompositeMediaSource<Integer> {
@Override
@Nullable
protected MediaPeriodId getMediaPeriodIdForChildMediaPeriodId(
Integer id, MediaPeriodId mediaPeriodId) {
return id == 0 ? mediaPeriodId : null;
Integer childSourceId, MediaPeriodId mediaPeriodId) {
return childSourceId == 0 ? mediaPeriodId : null;
}
private void computePeriodTimeOffsets() {

View File

@ -128,8 +128,8 @@ public abstract class WrappingMediaSource extends CompositeMediaSource<Void> {
@Override
protected final void onChildSourceInfoRefreshed(
Void id, MediaSource mediaSource, Timeline timeline) {
onChildSourceInfoRefreshed(timeline);
Void childSourceId, MediaSource mediaSource, Timeline newTimeline) {
onChildSourceInfoRefreshed(newTimeline);
}
/**
@ -139,14 +139,14 @@ public abstract class WrappingMediaSource extends CompositeMediaSource<Void> {
* ForwardingTimeline}. The {@link Timeline} for the wrapping source needs to be published with
* {@link #refreshSourceInfo(Timeline)}.
*
* @param timeline The timeline of the child source.
* @param newTimeline The timeline of the child source.
*/
protected void onChildSourceInfoRefreshed(Timeline timeline) {
refreshSourceInfo(timeline);
protected void onChildSourceInfoRefreshed(Timeline newTimeline) {
refreshSourceInfo(newTimeline);
}
@Override
protected final int getWindowIndexForChildWindowIndex(Void id, int windowIndex) {
protected final int getWindowIndexForChildWindowIndex(Void childSourceId, int windowIndex) {
return getWindowIndexForChildWindowIndex(windowIndex);
}
@ -164,7 +164,7 @@ public abstract class WrappingMediaSource extends CompositeMediaSource<Void> {
@Nullable
@Override
protected final MediaPeriodId getMediaPeriodIdForChildMediaPeriodId(
Void id, MediaPeriodId mediaPeriodId) {
Void childSourceId, MediaPeriodId mediaPeriodId) {
return getMediaPeriodIdForChildMediaPeriodId(mediaPeriodId);
}
@ -183,7 +183,7 @@ public abstract class WrappingMediaSource extends CompositeMediaSource<Void> {
}
@Override
protected final long getMediaTimeForChildMediaTime(Void id, long mediaTimeMs) {
protected final long getMediaTimeForChildMediaTime(Void childSourceId, long mediaTimeMs) {
return getMediaTimeForChildMediaTime(mediaTimeMs);
}

View File

@ -259,25 +259,25 @@ public final class AdsMediaSource extends CompositeMediaSource<MediaPeriodId> {
@Override
protected void onChildSourceInfoRefreshed(
MediaPeriodId mediaPeriodId, MediaSource mediaSource, Timeline timeline) {
if (mediaPeriodId.isAd()) {
int adGroupIndex = mediaPeriodId.adGroupIndex;
int adIndexInAdGroup = mediaPeriodId.adIndexInAdGroup;
MediaPeriodId childSourceId, MediaSource mediaSource, Timeline newTimeline) {
if (childSourceId.isAd()) {
int adGroupIndex = childSourceId.adGroupIndex;
int adIndexInAdGroup = childSourceId.adIndexInAdGroup;
checkNotNull(adMediaSourceHolders[adGroupIndex][adIndexInAdGroup])
.handleSourceInfoRefresh(timeline);
.handleSourceInfoRefresh(newTimeline);
} else {
Assertions.checkArgument(timeline.getPeriodCount() == 1);
contentTimeline = timeline;
Assertions.checkArgument(newTimeline.getPeriodCount() == 1);
contentTimeline = newTimeline;
}
maybeUpdateSourceInfo();
}
@Override
protected MediaPeriodId getMediaPeriodIdForChildMediaPeriodId(
MediaPeriodId childId, MediaPeriodId mediaPeriodId) {
MediaPeriodId childSourceId, MediaPeriodId mediaPeriodId) {
// The child id for the content period is just CHILD_SOURCE_MEDIA_PERIOD_ID. That's why
// we need to forward the reported mediaPeriodId in this case.
return childId.isAd() ? childId : mediaPeriodId;
return childSourceId.isAd() ? childSourceId : mediaPeriodId;
}
// Internal methods.

View File

@ -112,15 +112,15 @@ public final class HlsDownloader extends SegmentDownloader<HlsPlaylist> {
}
@Override
protected List<Segment> getSegments(DataSource dataSource, HlsPlaylist playlist, boolean removing)
protected List<Segment> getSegments(DataSource dataSource, HlsPlaylist manifest, boolean removing)
throws IOException, InterruptedException {
ArrayList<DataSpec> mediaPlaylistDataSpecs = new ArrayList<>();
if (playlist instanceof HlsMultivariantPlaylist) {
HlsMultivariantPlaylist multivariantPlaylist = (HlsMultivariantPlaylist) playlist;
if (manifest instanceof HlsMultivariantPlaylist) {
HlsMultivariantPlaylist multivariantPlaylist = (HlsMultivariantPlaylist) manifest;
addMediaPlaylistDataSpecs(multivariantPlaylist.mediaPlaylistUrls, mediaPlaylistDataSpecs);
} else {
mediaPlaylistDataSpecs.add(
SegmentDownloader.getCompressibleDataSpec(Uri.parse(playlist.baseUri)));
SegmentDownloader.getCompressibleDataSpec(Uri.parse(manifest.baseUri)));
}
ArrayList<Segment> segments = new ArrayList<>();

View File

@ -533,7 +533,7 @@ public final class ImaServerSideAdInsertionMediaSource extends CompositeMediaSou
@Override
protected void onChildSourceInfoRefreshed(
Void id, MediaSource mediaSource, Timeline newTimeline) {
Void childSourceId, MediaSource mediaSource, Timeline newTimeline) {
refreshSourceInfo(
new ForwardingTimeline(newTimeline) {
@Override

View File

@ -117,7 +117,7 @@ public final class SsDownloader extends SegmentDownloader<SsManifest> {
@Override
protected List<Segment> getSegments(
DataSource dataSource, SsManifest manifest, boolean allowIncompleteList) {
DataSource dataSource, SsManifest manifest, boolean removing) {
ArrayList<Segment> segments = new ArrayList<>();
for (StreamElement streamElement : manifest.streamElements) {
for (int i = 0; i < streamElement.formats.length; i++) {