Rename EMPTY_MEDIA_ITEM
to PLACEHOLDER_MEDIA_ITEM
The `MediaItem` instances in the following cases are not actually empty but acts as a placeholder. `EMPTY_MEDIA_ITEM` can also be confused with `MediaItem.EMPTY`. PiperOrigin-RevId: 495843012
This commit is contained in:
parent
8d15116478
commit
3e7f53fda7
@ -158,7 +158,7 @@ public abstract class Timeline implements Bundleable {
|
||||
|
||||
private static final Object FAKE_WINDOW_UID = new Object();
|
||||
|
||||
private static final MediaItem EMPTY_MEDIA_ITEM =
|
||||
private static final MediaItem PLACEHOLDER_MEDIA_ITEM =
|
||||
new MediaItem.Builder()
|
||||
.setMediaId("androidx.media3.common.Timeline")
|
||||
.setUri(Uri.EMPTY)
|
||||
@ -258,7 +258,7 @@ public abstract class Timeline implements Bundleable {
|
||||
/** Creates window. */
|
||||
public Window() {
|
||||
uid = SINGLE_WINDOW_UID;
|
||||
mediaItem = EMPTY_MEDIA_ITEM;
|
||||
mediaItem = PLACEHOLDER_MEDIA_ITEM;
|
||||
}
|
||||
|
||||
/** Sets the data held by this window. */
|
||||
@ -281,7 +281,7 @@ public abstract class Timeline implements Bundleable {
|
||||
int lastPeriodIndex,
|
||||
long positionInFirstPeriodUs) {
|
||||
this.uid = uid;
|
||||
this.mediaItem = mediaItem != null ? mediaItem : EMPTY_MEDIA_ITEM;
|
||||
this.mediaItem = mediaItem != null ? mediaItem : PLACEHOLDER_MEDIA_ITEM;
|
||||
this.tag =
|
||||
mediaItem != null && mediaItem.localConfiguration != null
|
||||
? mediaItem.localConfiguration.tag
|
||||
|
@ -61,7 +61,7 @@ public final class ConcatenatingMediaSource extends CompositeMediaSource<MediaSo
|
||||
private static final int MSG_UPDATE_TIMELINE = 4;
|
||||
private static final int MSG_ON_COMPLETION = 5;
|
||||
|
||||
private static final MediaItem EMPTY_MEDIA_ITEM =
|
||||
private static final MediaItem PLACEHOLDER_MEDIA_ITEM =
|
||||
new MediaItem.Builder().setUri(Uri.EMPTY).build();
|
||||
|
||||
// Accessed on any thread.
|
||||
@ -451,7 +451,7 @@ public final class ConcatenatingMediaSource extends CompositeMediaSource<MediaSo
|
||||
public MediaItem getMediaItem() {
|
||||
// This method is actually never called because getInitialTimeline is implemented and hence the
|
||||
// MaskingMediaSource does not need to create a placeholder timeline for this media source.
|
||||
return EMPTY_MEDIA_ITEM;
|
||||
return PLACEHOLDER_MEDIA_ITEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1018,7 +1018,7 @@ public final class ConcatenatingMediaSource extends CompositeMediaSource<MediaSo
|
||||
|
||||
@Override
|
||||
public MediaItem getMediaItem() {
|
||||
return EMPTY_MEDIA_ITEM;
|
||||
return PLACEHOLDER_MEDIA_ITEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -72,7 +72,7 @@ public final class MergingMediaSource extends CompositeMediaSource<Integer> {
|
||||
}
|
||||
|
||||
private static final int PERIOD_COUNT_UNSET = -1;
|
||||
private static final MediaItem EMPTY_MEDIA_ITEM =
|
||||
private static final MediaItem PLACEHOLDER_MEDIA_ITEM =
|
||||
new MediaItem.Builder().setMediaId("MergingMediaSource").build();
|
||||
|
||||
private final boolean adjustPeriodTimeOffsets;
|
||||
@ -163,7 +163,7 @@ public final class MergingMediaSource extends CompositeMediaSource<Integer> {
|
||||
|
||||
@Override
|
||||
public MediaItem getMediaItem() {
|
||||
return mediaSources.length > 0 ? mediaSources[0].getMediaItem() : EMPTY_MEDIA_ITEM;
|
||||
return mediaSources.length > 0 ? mediaSources[0].getMediaItem() : PLACEHOLDER_MEDIA_ITEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user