Commit 702568c3 by kimvde Committed by kim-vde

Remove some occurrences of dummy in core library

Remove occurrences in comments and private fields.

ISSUE: #7565
PiperOrigin-RevId: 320606558
parent a0703cb7
Showing with 109 additions and 108 deletions
......@@ -54,7 +54,7 @@ import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.Timeline.Period;
import com.google.android.exoplayer2.ext.ima.ImaAdsLoader.ImaFactory;
import com.google.android.exoplayer2.source.MaskingMediaSource.DummyTimeline;
import com.google.android.exoplayer2.source.MaskingMediaSource.PlaceholderTimeline;
import com.google.android.exoplayer2.source.ads.AdPlaybackState;
import com.google.android.exoplayer2.source.ads.AdsLoader;
import com.google.android.exoplayer2.source.ads.AdsMediaSource.AdLoadException;
......@@ -170,7 +170,7 @@ public final class ImaAdsLoaderTest {
@Test
public void start_withPlaceholderContent_initializedAdsLoader() {
Timeline placeholderTimeline = new DummyTimeline(MediaItem.fromUri(Uri.EMPTY));
Timeline placeholderTimeline = new PlaceholderTimeline(MediaItem.fromUri(Uri.EMPTY));
setupPlayback(placeholderTimeline, PREROLL_CUE_POINTS_SECONDS);
imaAdsLoader.start(adsLoaderListener, adViewProvider);
......
......@@ -983,7 +983,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
// The seek position was valid for the timeline that it was performed into, but the
// timeline has changed or is not ready and a suitable seek position could not be resolved.
Pair<MediaPeriodId, Long> firstPeriodAndPosition =
getDummyFirstMediaPeriodPosition(playbackInfo.timeline);
getPlaceholderFirstMediaPeriodPosition(playbackInfo.timeline);
periodId = firstPeriodAndPosition.first;
periodPositionUs = firstPeriodAndPosition.second;
requestedContentPosition = C.TIME_UNSET;
......@@ -1267,7 +1267,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
boolean resetTrackInfo = clearMediaSourceList;
if (resetPosition) {
pendingInitialSeekPosition = null;
Pair<MediaPeriodId, Long> firstPeriodAndPosition = getDummyFirstMediaPeriodPosition(timeline);
Pair<MediaPeriodId, Long> firstPeriodAndPosition =
getPlaceholderFirstMediaPeriodPosition(timeline);
mediaPeriodId = firstPeriodAndPosition.first;
startPositionUs = firstPeriodAndPosition.second;
requestedContentPositionUs = C.TIME_UNSET;
......@@ -1300,7 +1301,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
}
}
private Pair<MediaPeriodId, Long> getDummyFirstMediaPeriodPosition(Timeline timeline) {
private Pair<MediaPeriodId, Long> getPlaceholderFirstMediaPeriodPosition(Timeline timeline) {
if (timeline.isEmpty()) {
return Pair.create(PlaybackInfo.getDummyPeriodForEmptyTimeline(), 0L);
}
......
......@@ -380,7 +380,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
}
/**
* For each renderer of type {@link C#TRACK_TYPE_NONE}, we will remove the dummy {@link
* For each renderer of type {@link C#TRACK_TYPE_NONE}, we will remove the {@link
* EmptySampleStream} that was associated with it.
*/
private void disassociateNoSampleRenderersWithEmptySampleStream(
......@@ -394,7 +394,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
/**
* For each renderer of type {@link C#TRACK_TYPE_NONE} that was enabled, we will associate it with
* a dummy {@link EmptySampleStream}.
* an {@link EmptySampleStream}.
*/
private void associateNoSampleRenderersWithEmptySampleStream(
@NullableType SampleStream[] sampleStreams) {
......
......@@ -28,10 +28,10 @@ import com.google.android.exoplayer2.trackselection.TrackSelectorResult;
/* package */ final class PlaybackInfo {
/**
* Dummy media period id used while the timeline is empty and no period id is specified. This id
* is used when playback infos are created with {@link #createDummy(TrackSelectorResult)}.
* Placeholder media period id used while the timeline is empty and no period id is specified.
* This id is used when playback infos are created with {@link #createDummy(TrackSelectorResult)}.
*/
private static final MediaPeriodId DUMMY_MEDIA_PERIOD_ID =
private static final MediaPeriodId PLACEHOLDER_MEDIA_PERIOD_ID =
new MediaPeriodId(/* periodUid= */ new Object());
/** The current {@link Timeline}. */
......@@ -81,24 +81,24 @@ import com.google.android.exoplayer2.trackselection.TrackSelectorResult;
public volatile long positionUs;
/**
* Creates empty dummy playback info which can be used for masking as long as no real playback
* info is available.
* Creates an empty placeholder playback info which can be used for masking as long as no real
* playback info is available.
*
* @param emptyTrackSelectorResult An empty track selector result with null entries for each
* renderer.
* @return A dummy playback info.
* @return A placeholder playback info.
*/
public static PlaybackInfo createDummy(TrackSelectorResult emptyTrackSelectorResult) {
return new PlaybackInfo(
Timeline.EMPTY,
DUMMY_MEDIA_PERIOD_ID,
PLACEHOLDER_MEDIA_PERIOD_ID,
/* requestedContentPositionUs= */ C.TIME_UNSET,
Player.STATE_IDLE,
/* playbackError= */ null,
/* isLoading= */ false,
TrackGroupArray.EMPTY,
emptyTrackSelectorResult,
DUMMY_MEDIA_PERIOD_ID,
PLACEHOLDER_MEDIA_PERIOD_ID,
/* playWhenReady= */ false,
Player.PLAYBACK_SUPPRESSION_REASON_NONE,
/* bufferedPositionUs= */ 0,
......@@ -152,9 +152,9 @@ import com.google.android.exoplayer2.trackselection.TrackSelectorResult;
this.positionUs = positionUs;
}
/** Returns dummy period id for an empty timeline. */
/** Returns a placeholder period id for an empty timeline. */
public static MediaPeriodId getDummyPeriodForEmptyTimeline() {
return DUMMY_MEDIA_PERIOD_ID;
return PLACEHOLDER_MEDIA_PERIOD_ID;
}
/**
......
......@@ -124,7 +124,7 @@ public abstract class Timeline {
*/
public static final Object SINGLE_WINDOW_UID = new Object();
private static final MediaItem DUMMY_MEDIA_ITEM =
private static final MediaItem EMPTY_MEDIA_ITEM =
new MediaItem.Builder()
.setMediaId("com.google.android.exoplayer2.Timeline")
.setUri(Uri.EMPTY)
......@@ -222,7 +222,7 @@ public abstract class Timeline {
/** Creates window. */
public Window() {
uid = SINGLE_WINDOW_UID;
mediaItem = DUMMY_MEDIA_ITEM;
mediaItem = EMPTY_MEDIA_ITEM;
}
/** Sets the data held by this window. */
......@@ -243,7 +243,7 @@ public abstract class Timeline {
int lastPeriodIndex,
long positionInFirstPeriodUs) {
this.uid = uid;
this.mediaItem = mediaItem != null ? mediaItem : DUMMY_MEDIA_ITEM;
this.mediaItem = mediaItem != null ? mediaItem : EMPTY_MEDIA_ITEM;
this.tag =
mediaItem != null && mediaItem.playbackProperties != null
? mediaItem.playbackProperties.tag
......
......@@ -150,7 +150,7 @@ public final class PlaybackStatsListener
// TODO: Add AnalyticsListener.onAttachedToPlayer and onDetachedFromPlayer to auto-release with
// an actual EventTime. Should also simplify other cases where the listener needs to be released
// separately from the player.
EventTime dummyEventTime =
sessionManager.finishAllSessions(
new EventTime(
SystemClock.elapsedRealtime(),
Timeline.EMPTY,
......@@ -161,8 +161,7 @@ public final class PlaybackStatsListener
/* currentWindowIndex= */ 0,
/* currentMediaPeriodId= */ null,
/* currentPlaybackPositionMs= */ 0,
/* totalBufferedDurationMs= */ 0);
sessionManager.finishAllSessions(dummyEventTime);
/* totalBufferedDurationMs= */ 0));
}
// PlaybackSessionManager.Listener implementation.
......
......@@ -98,12 +98,12 @@ public interface AudioRendererEventListener {
@Nullable private final AudioRendererEventListener listener;
/**
* @param handler A handler for dispatching events, or null if creating a dummy instance.
* @param listener The listener to which events should be dispatched, or null if creating a
* dummy instance.
* @param handler A handler for dispatching events, or null if events should not be dispatched.
* @param listener The listener to which events should be dispatched, or null if events should
* not be dispatched.
*/
public EventDispatcher(@Nullable Handler handler,
@Nullable AudioRendererEventListener listener) {
public EventDispatcher(
@Nullable Handler handler, @Nullable AudioRendererEventListener listener) {
this.handler = listener != null ? Assertions.checkNotNull(handler) : null;
this.listener = listener;
}
......
......@@ -34,7 +34,7 @@ import java.util.UUID;
@RequiresApi(18)
public final class OfflineLicenseHelper {
private static final DrmInitData DUMMY_DRM_INIT_DATA = new DrmInitData();
private static final DrmInitData EMPTY_DRM_INIT_DATA = new DrmInitData();
private final ConditionVariable conditionVariable;
private final DefaultDrmSessionManager drmSessionManager;
......@@ -202,7 +202,7 @@ public final class OfflineLicenseHelper {
throws DrmSessionException {
Assertions.checkNotNull(offlineLicenseKeySetId);
return blockingKeyRequest(
DefaultDrmSessionManager.MODE_DOWNLOAD, offlineLicenseKeySetId, DUMMY_DRM_INIT_DATA);
DefaultDrmSessionManager.MODE_DOWNLOAD, offlineLicenseKeySetId, EMPTY_DRM_INIT_DATA);
}
/**
......@@ -215,7 +215,7 @@ public final class OfflineLicenseHelper {
throws DrmSessionException {
Assertions.checkNotNull(offlineLicenseKeySetId);
blockingKeyRequest(
DefaultDrmSessionManager.MODE_RELEASE, offlineLicenseKeySetId, DUMMY_DRM_INIT_DATA);
DefaultDrmSessionManager.MODE_RELEASE, offlineLicenseKeySetId, EMPTY_DRM_INIT_DATA);
}
/**
......@@ -231,7 +231,7 @@ public final class OfflineLicenseHelper {
drmSessionManager.prepare();
DrmSession drmSession =
openBlockingKeyRequest(
DefaultDrmSessionManager.MODE_QUERY, offlineLicenseKeySetId, DUMMY_DRM_INIT_DATA);
DefaultDrmSessionManager.MODE_QUERY, offlineLicenseKeySetId, EMPTY_DRM_INIT_DATA);
DrmSessionException error = drmSession.getError();
Pair<Long, Long> licenseDurationRemainingSec =
WidevineUtil.getLicenseDurationRemainingSec(drmSession);
......
......@@ -500,7 +500,7 @@ public final class DownloadHelper {
new DefaultTrackSelector(trackSelectorParameters, new DownloadTrackSelection.Factory());
this.rendererCapabilities = rendererCapabilities;
this.scratchSet = new SparseIntArray();
trackSelector.init(/* listener= */ () -> {}, new DummyBandwidthMeter());
trackSelector.init(/* listener= */ () -> {}, new FakeBandwidthMeter());
callbackHandler = Util.createHandlerForCurrentOrMainLooper();
window = new Timeline.Window();
}
......@@ -1152,7 +1152,7 @@ public final class DownloadHelper {
}
}
private static final class DummyBandwidthMeter implements BandwidthMeter {
private static final class FakeBandwidthMeter implements BandwidthMeter {
@Override
public long getBitrateEstimate() {
......
......@@ -56,7 +56,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 DUMMY_MEDIA_ITEM =
private static final MediaItem EMPTY_MEDIA_ITEM =
new MediaItem.Builder().setUri(Uri.EMPTY).build();
// Accessed on any thread.
......@@ -445,8 +445,8 @@ public final class ConcatenatingMediaSource extends CompositeMediaSource<MediaSo
@Override
public MediaItem getMediaItem() {
// This method is actually never called because getInitialTimeline is implemented and hence the
// MaskingMediaSource does not need to create a dummy timeline for this media source.
return DUMMY_MEDIA_ITEM;
// MaskingMediaSource does not need to create a placeholder timeline for this media source.
return EMPTY_MEDIA_ITEM;
}
@Override
......@@ -476,7 +476,7 @@ public final class ConcatenatingMediaSource extends CompositeMediaSource<MediaSo
@Nullable MediaSourceHolder holder = mediaSourceByUid.get(mediaSourceHolderUid);
if (holder == null) {
// Stale event. The media source has already been removed.
holder = new MediaSourceHolder(new DummyMediaSource(), useLazyPreparation);
holder = new MediaSourceHolder(new FakeMediaSource(), useLazyPreparation);
holder.isRemoved = true;
prepareChildSource(holder, holder.mediaSource);
}
......@@ -988,8 +988,8 @@ public final class ConcatenatingMediaSource extends CompositeMediaSource<MediaSo
}
}
/** Dummy media source which does nothing and does not support creating periods. */
private static final class DummyMediaSource extends BaseMediaSource {
/** A media source which does nothing and does not support creating periods. */
private static final class FakeMediaSource extends BaseMediaSource {
@Override
protected void prepareSourceInternal(@Nullable TransferListener mediaTransferListener) {
......@@ -998,7 +998,7 @@ public final class ConcatenatingMediaSource extends CompositeMediaSource<MediaSo
@Override
public MediaItem getMediaItem() {
return DUMMY_MEDIA_ITEM;
return EMPTY_MEDIA_ITEM;
}
@Override
......
......@@ -67,7 +67,7 @@ public final class MaskingMediaSource extends CompositeMediaSource<Void> {
initialTimeline, /* firstWindowUid= */ null, /* firstPeriodUid= */ null);
hasRealTimeline = true;
} else {
timeline = MaskingTimeline.createWithDummyTimeline(mediaSource.getMediaItem());
timeline = MaskingTimeline.createWithPlaceholderTimeline(mediaSource.getMediaItem());
}
}
......@@ -165,7 +165,9 @@ public final class MaskingMediaSource extends CompositeMediaSource<Void> {
hasRealTimeline
? timeline.cloneWithUpdatedTimeline(newTimeline)
: MaskingTimeline.createWithRealTimeline(
newTimeline, Window.SINGLE_WINDOW_UID, MaskingTimeline.DUMMY_EXTERNAL_PERIOD_UID);
newTimeline,
Window.SINGLE_WINDOW_UID,
MaskingTimeline.MASKING_EXTERNAL_PERIOD_UID);
} else {
// Determine first period and the start position.
// This will be:
......@@ -174,7 +176,7 @@ public final class MaskingMediaSource extends CompositeMediaSource<Void> {
// a non-zero initial seek position in the window.
// 3. The default window start position if the deferred period has a prepare position of zero
// under the assumption that the prepare position of zero was used because it's the
// default position of the DummyTimeline window. Note that this will override an
// default position of the PlaceholderTimeline window. Note that this will override an
// intentional seek to zero for a window with a non-zero default position. This is
// unlikely to be a problem as a non-zero default position usually only occurs for live
// playbacks and seeking to zero in a live window would cause BehindLiveWindowExceptions
......@@ -230,7 +232,7 @@ public final class MaskingMediaSource extends CompositeMediaSource<Void> {
private Object getInternalPeriodUid(Object externalPeriodUid) {
return timeline.replacedInternalPeriodUid != null
&& externalPeriodUid.equals(MaskingTimeline.DUMMY_EXTERNAL_PERIOD_UID)
&& externalPeriodUid.equals(MaskingTimeline.MASKING_EXTERNAL_PERIOD_UID)
? timeline.replacedInternalPeriodUid
: externalPeriodUid;
}
......@@ -238,7 +240,7 @@ public final class MaskingMediaSource extends CompositeMediaSource<Void> {
private Object getExternalPeriodUid(Object internalPeriodUid) {
return timeline.replacedInternalPeriodUid != null
&& timeline.replacedInternalPeriodUid.equals(internalPeriodUid)
? MaskingTimeline.DUMMY_EXTERNAL_PERIOD_UID
? MaskingTimeline.MASKING_EXTERNAL_PERIOD_UID
: internalPeriodUid;
}
......@@ -265,34 +267,36 @@ public final class MaskingMediaSource extends CompositeMediaSource<Void> {
/**
* Timeline used as placeholder for an unprepared media source. After preparation, a
* MaskingTimeline is used to keep the originally assigned dummy period ID.
* MaskingTimeline is used to keep the originally assigned masking period ID.
*/
private static final class MaskingTimeline extends ForwardingTimeline {
public static final Object DUMMY_EXTERNAL_PERIOD_UID = new Object();
public static final Object MASKING_EXTERNAL_PERIOD_UID = new Object();
@Nullable private final Object replacedInternalWindowUid;
@Nullable private final Object replacedInternalPeriodUid;
/**
* Returns an instance with a dummy timeline using the provided {@link MediaItem}.
* Returns an instance with a placeholder timeline using the provided {@link MediaItem}.
*
* @param mediaItem A {@link MediaItem}.
*/
public static MaskingTimeline createWithDummyTimeline(MediaItem mediaItem) {
public static MaskingTimeline createWithPlaceholderTimeline(MediaItem mediaItem) {
return new MaskingTimeline(
new DummyTimeline(mediaItem), Window.SINGLE_WINDOW_UID, DUMMY_EXTERNAL_PERIOD_UID);
new PlaceholderTimeline(mediaItem),
Window.SINGLE_WINDOW_UID,
MASKING_EXTERNAL_PERIOD_UID);
}
/**
* Returns an instance with a real timeline, replacing the provided period ID with the already
* assigned dummy period ID.
* assigned masking period ID.
*
* @param timeline The real timeline.
* @param firstWindowUid The window UID in the timeline which will be replaced by the already
* assigned {@link Window#SINGLE_WINDOW_UID}.
* @param firstPeriodUid The period UID in the timeline which will be replaced by the already
* assigned {@link #DUMMY_EXTERNAL_PERIOD_UID}.
* assigned {@link #MASKING_EXTERNAL_PERIOD_UID}.
*/
public static MaskingTimeline createWithRealTimeline(
Timeline timeline, @Nullable Object firstWindowUid, @Nullable Object firstPeriodUid) {
......@@ -335,7 +339,7 @@ public final class MaskingMediaSource extends CompositeMediaSource<Void> {
public Period getPeriod(int periodIndex, Period period, boolean setIds) {
timeline.getPeriod(periodIndex, period, setIds);
if (Util.areEqual(period.uid, replacedInternalPeriodUid) && setIds) {
period.uid = DUMMY_EXTERNAL_PERIOD_UID;
period.uid = MASKING_EXTERNAL_PERIOD_UID;
}
return period;
}
......@@ -343,7 +347,7 @@ public final class MaskingMediaSource extends CompositeMediaSource<Void> {
@Override
public int getIndexOfPeriod(Object uid) {
return timeline.getIndexOfPeriod(
DUMMY_EXTERNAL_PERIOD_UID.equals(uid) && replacedInternalPeriodUid != null
MASKING_EXTERNAL_PERIOD_UID.equals(uid) && replacedInternalPeriodUid != null
? replacedInternalPeriodUid
: uid);
}
......@@ -351,18 +355,18 @@ public final class MaskingMediaSource extends CompositeMediaSource<Void> {
@Override
public Object getUidOfPeriod(int periodIndex) {
Object uid = timeline.getUidOfPeriod(periodIndex);
return Util.areEqual(uid, replacedInternalPeriodUid) ? DUMMY_EXTERNAL_PERIOD_UID : uid;
return Util.areEqual(uid, replacedInternalPeriodUid) ? MASKING_EXTERNAL_PERIOD_UID : uid;
}
}
/** Dummy placeholder timeline with one dynamic window with a period of indeterminate duration. */
/** A timeline with one dynamic window with a period of indeterminate duration. */
@VisibleForTesting
public static final class DummyTimeline extends Timeline {
public static final class PlaceholderTimeline extends Timeline {
private final MediaItem mediaItem;
/** Creates a new instance with the given media item. */
public DummyTimeline(MediaItem mediaItem) {
public PlaceholderTimeline(MediaItem mediaItem) {
this.mediaItem = mediaItem;
}
......@@ -402,7 +406,7 @@ public final class MaskingMediaSource extends CompositeMediaSource<Void> {
public Period getPeriod(int periodIndex, Period period, boolean setIds) {
return period.set(
/* id= */ setIds ? 0 : null,
/* uid= */ setIds ? MaskingTimeline.DUMMY_EXTERNAL_PERIOD_UID : null,
/* uid= */ setIds ? MaskingTimeline.MASKING_EXTERNAL_PERIOD_UID : null,
/* windowIndex= */ 0,
/* durationUs = */ C.TIME_UNSET,
/* positionInWindowUs= */ 0);
......@@ -410,12 +414,12 @@ public final class MaskingMediaSource extends CompositeMediaSource<Void> {
@Override
public int getIndexOfPeriod(Object uid) {
return uid == MaskingTimeline.DUMMY_EXTERNAL_PERIOD_UID ? 0 : C.INDEX_UNSET;
return uid == MaskingTimeline.MASKING_EXTERNAL_PERIOD_UID ? 0 : C.INDEX_UNSET;
}
@Override
public Object getUidOfPeriod(int periodIndex) {
return MaskingTimeline.DUMMY_EXTERNAL_PERIOD_UID;
return MaskingTimeline.MASKING_EXTERNAL_PERIOD_UID;
}
}
}
......@@ -93,8 +93,8 @@ public interface MediaSource {
public final int nextAdGroupIndex;
/**
* Creates a media period identifier for a dummy period which is not part of a buffered sequence
* of windows.
* Creates a media period identifier for a period which is not part of a buffered sequence of
* windows.
*
* @param periodUid The unique id of the timeline period.
*/
......@@ -248,8 +248,8 @@ public interface MediaSource {
void removeDrmEventListener(DrmSessionEventListener eventListener);
/**
* Returns the initial dummy timeline that is returned immediately when the real timeline is not
* yet known, or null to let the player create an initial timeline.
* Returns the initial placeholder timeline that is returned immediately when the real timeline is
* not yet known, or null to let the player create an initial timeline.
*
* <p>The initial timeline must use the same uids for windows and periods that the real timeline
* will use. It also must provide windows which are marked as dynamic to indicate that the window
......
......@@ -66,7 +66,7 @@ public final class MergingMediaSource extends CompositeMediaSource<Integer> {
}
private static final int PERIOD_COUNT_UNSET = -1;
private static final MediaItem DUMMY_MEDIA_ITEM =
private static final MediaItem EMPTY_MEDIA_ITEM =
new MediaItem.Builder().setMediaId("MergingMediaSource").build();
private final boolean adjustPeriodTimeOffsets;
......@@ -137,7 +137,7 @@ public final class MergingMediaSource extends CompositeMediaSource<Integer> {
@Override
public MediaItem getMediaItem() {
return mediaSources.length > 0 ? mediaSources[0].getMediaItem() : DUMMY_MEDIA_ITEM;
return mediaSources.length > 0 ? mediaSources[0].getMediaItem() : EMPTY_MEDIA_ITEM;
}
@Override
......
......@@ -121,7 +121,7 @@ public final class AdsMediaSource extends CompositeMediaSource<MediaPeriodId> {
}
// Used to identify the content "child" source for CompositeMediaSource.
private static final MediaPeriodId DUMMY_CONTENT_MEDIA_PERIOD_ID =
private static final MediaPeriodId CHILD_SOURCE_MEDIA_PERIOD_ID =
new MediaPeriodId(/* periodUid= */ new Object());
private final MediaSource contentMediaSource;
......@@ -203,7 +203,7 @@ public final class AdsMediaSource extends CompositeMediaSource<MediaPeriodId> {
super.prepareSourceInternal(mediaTransferListener);
ComponentListener componentListener = new ComponentListener();
this.componentListener = componentListener;
prepareChildSource(DUMMY_CONTENT_MEDIA_PERIOD_ID, contentMediaSource);
prepareChildSource(CHILD_SOURCE_MEDIA_PERIOD_ID, contentMediaSource);
mainHandler.post(() -> adsLoader.start(componentListener, adViewProvider));
}
......@@ -284,8 +284,8 @@ public final class AdsMediaSource extends CompositeMediaSource<MediaPeriodId> {
@Override
protected MediaPeriodId getMediaPeriodIdForChildMediaPeriodId(
MediaPeriodId childId, MediaPeriodId mediaPeriodId) {
// The child id for the content period is just DUMMY_CONTENT_MEDIA_PERIOD_ID. That's why we need
// to forward the reported mediaPeriodId in this case.
// 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;
}
......
......@@ -41,7 +41,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
*/
public final class BundledChunkExtractor implements ExtractorOutput, ChunkExtractor {
private static final PositionHolder DUMMY_POSITION_HOLDER = new PositionHolder();
private static final PositionHolder POSITION_HOLDER = new PositionHolder();
private final Extractor extractor;
private final int primaryTrackType;
......@@ -106,7 +106,7 @@ public final class BundledChunkExtractor implements ExtractorOutput, ChunkExtrac
@Override
public boolean read(ExtractorInput input) throws IOException {
int result = extractor.read(input, DUMMY_POSITION_HOLDER);
int result = extractor.read(input, POSITION_HOLDER);
Assertions.checkState(result != Extractor.RESULT_SEEK);
return result == Extractor.RESULT_CONTINUE;
}
......@@ -149,7 +149,7 @@ public final class BundledChunkExtractor implements ExtractorOutput, ChunkExtrac
private final int id;
private final int type;
@Nullable private final Format manifestFormat;
private final DummyTrackOutput dummyTrackOutput;
private final DummyTrackOutput fakeTrackOutput;
public @MonotonicNonNull Format sampleFormat;
private @MonotonicNonNull TrackOutput trackOutput;
......@@ -159,12 +159,12 @@ public final class BundledChunkExtractor implements ExtractorOutput, ChunkExtrac
this.id = id;
this.type = type;
this.manifestFormat = manifestFormat;
dummyTrackOutput = new DummyTrackOutput();
fakeTrackOutput = new DummyTrackOutput();
}
public void bind(@Nullable TrackOutputProvider trackOutputProvider, long endTimeUs) {
if (trackOutputProvider == null) {
trackOutput = dummyTrackOutput;
trackOutput = fakeTrackOutput;
return;
}
this.endTimeUs = endTimeUs;
......@@ -201,7 +201,7 @@ public final class BundledChunkExtractor implements ExtractorOutput, ChunkExtrac
int offset,
@Nullable CryptoData cryptoData) {
if (endTimeUs != C.TIME_UNSET && timeUs >= endTimeUs) {
trackOutput = dummyTrackOutput;
trackOutput = fakeTrackOutput;
}
castNonNull(trackOutput).sampleMetadata(timeUs, flags, size, offset, cryptoData);
}
......
......@@ -19,9 +19,7 @@ import android.net.Uri;
import androidx.annotation.Nullable;
import java.io.IOException;
/**
* A dummy DataSource which provides no data. {@link #open(DataSpec)} throws {@link IOException}.
*/
/** A DataSource which provides no data. {@link #open(DataSpec)} throws {@link IOException}. */
public final class DummyDataSource implements DataSource {
public static final DummyDataSource INSTANCE = new DummyDataSource();
......@@ -38,7 +36,7 @@ public final class DummyDataSource implements DataSource {
@Override
public long open(DataSpec dataSpec) throws IOException {
throw new IOException("Dummy source");
throw new IOException("DummyDataSource cannot be opened");
}
@Override
......
......@@ -22,7 +22,6 @@ import static com.google.android.exoplayer2.util.EGLSurfaceTexture.SECURE_MODE_S
import android.content.Context;
import android.graphics.SurfaceTexture;
import android.os.Handler;
import android.os.Handler.Callback;
import android.os.HandlerThread;
import android.os.Message;
import android.view.Surface;
......@@ -70,14 +69,14 @@ public final class DummySurface extends Surface {
/**
* Returns a newly created dummy surface. The surface must be released by calling {@link #release}
* when it's no longer required.
* <p>
* Must only be called if {@link Util#SDK_INT} is 17 or higher.
*
* <p>Must only be called if {@link Util#SDK_INT} is 17 or higher.
*
* @param context Any {@link Context}.
* @param secure Whether a secure surface is required. Must only be requested if
* {@link #isSecureSupported(Context)} returns {@code true}.
* @throws IllegalStateException If a secure surface is requested on a device for which
* {@link #isSecureSupported(Context)} returns {@code false}.
* @param secure Whether a secure surface is required. Must only be requested if {@link
* #isSecureSupported(Context)} returns {@code true}.
* @throws IllegalStateException If a secure surface is requested on a device for which {@link
* #isSecureSupported(Context)} returns {@code false}.
*/
public static DummySurface newInstanceV17(Context context, boolean secure) {
Assertions.checkState(!secure || isSecureSupported(context));
......@@ -123,7 +122,7 @@ public final class DummySurface extends Surface {
}
}
private static class DummySurfaceThread extends HandlerThread implements Callback {
private static class DummySurfaceThread extends HandlerThread implements Handler.Callback {
private static final int MSG_INIT = 1;
private static final int MSG_RELEASE = 2;
......
......@@ -138,12 +138,12 @@ public interface VideoRendererEventListener {
@Nullable private final VideoRendererEventListener listener;
/**
* @param handler A handler for dispatching events, or null if creating a dummy instance.
* @param listener The listener to which events should be dispatched, or null if creating a
* dummy instance.
* @param handler A handler for dispatching events, or null if events should not be dispatched.
* @param listener The listener to which events should be dispatched, or null if events should
* not be dispatched.
*/
public EventDispatcher(@Nullable Handler handler,
@Nullable VideoRendererEventListener listener) {
public EventDispatcher(
@Nullable Handler handler, @Nullable VideoRendererEventListener listener) {
this.handler = listener != null ? Assertions.checkNotNull(handler) : null;
this.listener = listener;
}
......
......@@ -786,7 +786,7 @@ public final class AnalyticsCollectorTest {
assertThat(listener.getEvents(EVENT_TIMELINE_CHANGED))
.containsExactly(
WINDOW_0 /* PLAYLIST_CHANGED */,
window0Period1Seq0 /* SOURCE_UPDATE (concatenated timeline replaces dummy) */,
window0Period1Seq0 /* SOURCE_UPDATE (concatenated timeline replaces placeholder) */,
period1Seq0 /* SOURCE_UPDATE (child sources in concatenating source moved) */)
.inOrder();
assertThat(listener.getEvents(EVENT_LOADING_CHANGED))
......
......@@ -94,7 +94,7 @@ public class VersionTableTest {
@Test
public void doesTableExist_existingTable_returnsTrue() {
String table = "TestTable";
databaseProvider.getWritableDatabase().execSQL("CREATE TABLE " + table + " (dummy INTEGER)");
databaseProvider.getWritableDatabase().execSQL("CREATE TABLE " + table + " (test INTEGER)");
assertThat(VersionTable.tableExists(database, table)).isTrue();
}
}
......@@ -56,7 +56,7 @@ public class DownloadManagerTest {
private static final int APP_STOP_REASON = 1;
/** The minimum number of times a download must be retried before failing. */
private static final int MIN_RETRY_COUNT = 3;
/** Dummy value for the current time. */
/** Test value for the current time. */
private static final long NOW_MS = 1234;
private static final String ID1 = "id1";
......@@ -68,19 +68,19 @@ public class DownloadManagerTest {
private DownloadManager downloadManager;
private TestDownloadManagerListener downloadManagerListener;
private DummyMainThread dummyMainThread;
private DummyMainThread testThread;
@Before
public void setUp() throws Exception {
ShadowLog.stream = System.out;
dummyMainThread = new DummyMainThread();
testThread = new DummyMainThread();
setupDownloadManager(/* maxParallelDownloads= */ 100);
}
@After
public void tearDown() throws Exception {
releaseDownloadManager();
dummyMainThread.release();
testThread.release();
}
@Test
......@@ -728,7 +728,7 @@ public class DownloadManagerTest {
}
private void runOnMainThread(TestRunnable r) {
dummyMainThread.runTestOnMainThread(r);
testThread.runTestOnMainThread(r);
}
private FakeDownloader getDownloaderAt(int index) throws InterruptedException {
......
......@@ -30,7 +30,7 @@ import com.google.android.exoplayer2.Timeline.Window;
import com.google.android.exoplayer2.drm.DrmSessionEventListener;
import com.google.android.exoplayer2.drm.DrmSessionManager;
import com.google.android.exoplayer2.source.ClippingMediaSource.IllegalClippingException;
import com.google.android.exoplayer2.source.MaskingMediaSource.DummyTimeline;
import com.google.android.exoplayer2.source.MaskingMediaSource.PlaceholderTimeline;
import com.google.android.exoplayer2.source.MediaSource.MediaPeriodId;
import com.google.android.exoplayer2.testutil.FakeMediaPeriod;
import com.google.android.exoplayer2.testutil.FakeMediaSource;
......@@ -173,7 +173,7 @@ public final class ClippingMediaSourceTest {
// Timeline that's dynamic and not seekable. A child source might report such a timeline prior
// to it having loaded sufficient data to establish its duration and seekability. Such timelines
// should not result in clipping failure.
Timeline timeline = new DummyTimeline(MediaItem.fromUri(Uri.EMPTY));
Timeline timeline = new PlaceholderTimeline(MediaItem.fromUri(Uri.EMPTY));
Timeline clippedTimeline =
getClippedTimeline(
......
......@@ -123,7 +123,7 @@ public final class SampleQueueTest {
private static final int[] ENCRYPTED_SAMPLE_OFFSETS = new int[] {7, 4, 3, 0};
private static final byte[] ENCRYPTED_SAMPLE_DATA = new byte[] {1, 1, 1, 1, 1, 1, 1, 1};
private static final TrackOutput.CryptoData DUMMY_CRYPTO_DATA =
private static final TrackOutput.CryptoData CRYPTO_DATA =
new TrackOutput.CryptoData(C.CRYPTO_MODE_AES_CTR, new byte[16], 0, 0);
private Allocator allocator;
......@@ -1205,7 +1205,7 @@ public final class SampleQueueTest {
sampleFlags[i],
sampleSizes[i],
sampleOffsets[i],
(sampleFlags[i] & C.BUFFER_FLAG_ENCRYPTED) != 0 ? DUMMY_CRYPTO_DATA : null);
(sampleFlags[i] & C.BUFFER_FLAG_ENCRYPTED) != 0 ? CRYPTO_DATA : null);
}
}
......@@ -1222,7 +1222,7 @@ public final class SampleQueueTest {
sampleFlags,
data.length,
/* offset= */ 0,
(sampleFlags & C.BUFFER_FLAG_ENCRYPTED) != 0 ? DUMMY_CRYPTO_DATA : null);
(sampleFlags & C.BUFFER_FLAG_ENCRYPTED) != 0 ? CRYPTO_DATA : null);
}
/**
......
......@@ -569,7 +569,7 @@ public final class DefaultBandwidthMeterTest {
long[] bitrateEstimates = new long[SIMULATED_TRANSFER_COUNT];
Random random = new Random(/* seed= */ 0);
DataSource dataSource = new FakeDataSource();
DataSpec dataSpec = new DataSpec(Uri.parse("https://dummy.com"));
DataSpec dataSpec = new DataSpec(Uri.parse("https://test.com"));
for (int i = 0; i < SIMULATED_TRANSFER_COUNT; i++) {
bandwidthMeter.onTransferStart(dataSource, dataSpec, /* isNetwork= */ true);
clock.advanceTime(random.nextInt(/* bound= */ 5000));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment