diff --git a/extensions/ima/src/test/java/com/google/android/exoplayer2/ext/ima/ImaAdsLoaderTest.java b/extensions/ima/src/test/java/com/google/android/exoplayer2/ext/ima/ImaAdsLoaderTest.java index e313535e9a..a9acbad72c 100644 --- a/extensions/ima/src/test/java/com/google/android/exoplayer2/ext/ima/ImaAdsLoaderTest.java +++ b/extensions/ima/src/test/java/com/google/android/exoplayer2/ext/ima/ImaAdsLoaderTest.java @@ -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); diff --git a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java index bff541ce18..b693b4ca70 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java @@ -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 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 firstPeriodAndPosition = getDummyFirstMediaPeriodPosition(timeline); + Pair 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 getDummyFirstMediaPeriodPosition(Timeline timeline) { + private Pair getPlaceholderFirstMediaPeriodPosition(Timeline timeline) { if (timeline.isEmpty()) { return Pair.create(PlaybackInfo.getDummyPeriodForEmptyTimeline(), 0L); } diff --git a/library/core/src/main/java/com/google/android/exoplayer2/MediaPeriodHolder.java b/library/core/src/main/java/com/google/android/exoplayer2/MediaPeriodHolder.java index 0b92eab8b1..8fa835f1ff 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/MediaPeriodHolder.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/MediaPeriodHolder.java @@ -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) { diff --git a/library/core/src/main/java/com/google/android/exoplayer2/PlaybackInfo.java b/library/core/src/main/java/com/google/android/exoplayer2/PlaybackInfo.java index f183af0d8c..6ad8adf7f4 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/PlaybackInfo.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/PlaybackInfo.java @@ -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; } /** diff --git a/library/core/src/main/java/com/google/android/exoplayer2/Timeline.java b/library/core/src/main/java/com/google/android/exoplayer2/Timeline.java index fa062bbbff..b2268e1fcc 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/Timeline.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/Timeline.java @@ -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 diff --git a/library/core/src/main/java/com/google/android/exoplayer2/analytics/PlaybackStatsListener.java b/library/core/src/main/java/com/google/android/exoplayer2/analytics/PlaybackStatsListener.java index cefe143b73..662cb0b8a1 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/analytics/PlaybackStatsListener.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/analytics/PlaybackStatsListener.java @@ -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. diff --git a/library/core/src/main/java/com/google/android/exoplayer2/audio/AudioRendererEventListener.java b/library/core/src/main/java/com/google/android/exoplayer2/audio/AudioRendererEventListener.java index 7cb05cfa0d..41153bd015 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/audio/AudioRendererEventListener.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/audio/AudioRendererEventListener.java @@ -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; } diff --git a/library/core/src/main/java/com/google/android/exoplayer2/drm/OfflineLicenseHelper.java b/library/core/src/main/java/com/google/android/exoplayer2/drm/OfflineLicenseHelper.java index 15b060b9e1..7c659b0a27 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/drm/OfflineLicenseHelper.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/drm/OfflineLicenseHelper.java @@ -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 licenseDurationRemainingSec = WidevineUtil.getLicenseDurationRemainingSec(drmSession); diff --git a/library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadHelper.java b/library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadHelper.java index 018af45264..80a7a1aade 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadHelper.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadHelper.java @@ -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() { diff --git a/library/core/src/main/java/com/google/android/exoplayer2/source/ConcatenatingMediaSource.java b/library/core/src/main/java/com/google/android/exoplayer2/source/ConcatenatingMediaSource.java index c3e4e91947..3ef2b1e27a 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/source/ConcatenatingMediaSource.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/source/ConcatenatingMediaSource.java @@ -56,7 +56,7 @@ public final class ConcatenatingMediaSource extends CompositeMediaSource { 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 { 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 { // 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 { 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 { 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 { /** * 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 { 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 { @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 { @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 { 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 { @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; } } } diff --git a/library/core/src/main/java/com/google/android/exoplayer2/source/MediaSource.java b/library/core/src/main/java/com/google/android/exoplayer2/source/MediaSource.java index 8e860f6ed1..94a9f82030 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/source/MediaSource.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/source/MediaSource.java @@ -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. * *

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 diff --git a/library/core/src/main/java/com/google/android/exoplayer2/source/MergingMediaSource.java b/library/core/src/main/java/com/google/android/exoplayer2/source/MergingMediaSource.java index 446f7132b0..8df7a639c6 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/source/MergingMediaSource.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/source/MergingMediaSource.java @@ -66,7 +66,7 @@ public final class MergingMediaSource extends CompositeMediaSource { } 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 { @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 diff --git a/library/core/src/main/java/com/google/android/exoplayer2/source/ads/AdsMediaSource.java b/library/core/src/main/java/com/google/android/exoplayer2/source/ads/AdsMediaSource.java index ddc4680613..f805642da8 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/source/ads/AdsMediaSource.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/source/ads/AdsMediaSource.java @@ -121,7 +121,7 @@ public final class AdsMediaSource extends CompositeMediaSource { } // 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 { 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 { @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; } diff --git a/library/core/src/main/java/com/google/android/exoplayer2/source/chunk/BundledChunkExtractor.java b/library/core/src/main/java/com/google/android/exoplayer2/source/chunk/BundledChunkExtractor.java index 83a6da844f..f5b05db047 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/source/chunk/BundledChunkExtractor.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/source/chunk/BundledChunkExtractor.java @@ -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); } diff --git a/library/core/src/main/java/com/google/android/exoplayer2/upstream/DummyDataSource.java b/library/core/src/main/java/com/google/android/exoplayer2/upstream/DummyDataSource.java index 4124a2531f..5303e7f6eb 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/upstream/DummyDataSource.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/upstream/DummyDataSource.java @@ -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 diff --git a/library/core/src/main/java/com/google/android/exoplayer2/video/DummySurface.java b/library/core/src/main/java/com/google/android/exoplayer2/video/DummySurface.java index a5dd9cfefb..a68a64b28d 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/video/DummySurface.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/video/DummySurface.java @@ -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. - *

- * Must only be called if {@link Util#SDK_INT} is 17 or higher. + * + *

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; diff --git a/library/core/src/main/java/com/google/android/exoplayer2/video/VideoRendererEventListener.java b/library/core/src/main/java/com/google/android/exoplayer2/video/VideoRendererEventListener.java index 671d66c31c..f8037d2e72 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/video/VideoRendererEventListener.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/video/VideoRendererEventListener.java @@ -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; } diff --git a/library/core/src/test/java/com/google/android/exoplayer2/ExoPlayerTest.java b/library/core/src/test/java/com/google/android/exoplayer2/ExoPlayerTest.java index 39804646f4..ac7a082bec 100644 --- a/library/core/src/test/java/com/google/android/exoplayer2/ExoPlayerTest.java +++ b/library/core/src/test/java/com/google/android/exoplayer2/ExoPlayerTest.java @@ -126,13 +126,13 @@ public final class ExoPlayerTest { private static final int TIMEOUT_MS = 10_000; private Context context; - private Timeline dummyTimeline; + private Timeline placeholderTimeline; @Before public void setUp() { context = ApplicationProvider.getApplicationContext(); - dummyTimeline = - new MaskingMediaSource.DummyTimeline( + placeholderTimeline = + new MaskingMediaSource.PlaceholderTimeline( FakeTimeline.FAKE_MEDIA_ITEM.buildUpon().setTag(0).build()); } @@ -144,7 +144,7 @@ public final class ExoPlayerTest { public void playEmptyTimeline() throws Exception { Timeline timeline = Timeline.EMPTY; Timeline expectedMaskingTimeline = - new MaskingMediaSource.DummyTimeline(FakeMediaSource.FAKE_MEDIA_ITEM); + new MaskingMediaSource.PlaceholderTimeline(FakeMediaSource.FAKE_MEDIA_ITEM); FakeRenderer renderer = new FakeRenderer(C.TRACK_TYPE_UNKNOWN); ExoPlayerTestRunner testRunner = new ExoPlayerTestRunner.Builder(context) @@ -178,7 +178,7 @@ public final class ExoPlayerTest { .start() .blockUntilEnded(TIMEOUT_MS); testRunner.assertNoPositionDiscontinuities(); - testRunner.assertTimelinesSame(dummyTimeline, timeline); + testRunner.assertTimelinesSame(placeholderTimeline, timeline); testRunner.assertTimelineChangeReasonsEqual( Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE); @@ -234,7 +234,7 @@ public final class ExoPlayerTest { Integer[] expectedReasons = new Integer[99]; Arrays.fill(expectedReasons, Player.DISCONTINUITY_REASON_PERIOD_TRANSITION); testRunner.assertPositionDiscontinuityReasonsEqual(expectedReasons); - testRunner.assertTimelinesSame(dummyTimeline, timeline); + testRunner.assertTimelinesSame(placeholderTimeline, timeline); testRunner.assertTimelineChangeReasonsEqual( Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE); @@ -382,11 +382,15 @@ public final class ExoPlayerTest { .blockUntilEnded(TIMEOUT_MS); testRunner.assertNoPositionDiscontinuities(); // The first source's preparation completed with a real timeline. When the second source was - // prepared, it immediately exposed a dummy timeline, but the source info refresh from the + // prepared, it immediately exposed a placeholder timeline, but the source info refresh from the // second source was suppressed as we replace it with the third source before the update // arrives. testRunner.assertTimelinesSame( - dummyTimeline, firstTimeline, dummyTimeline, dummyTimeline, thirdTimeline); + placeholderTimeline, + firstTimeline, + placeholderTimeline, + placeholderTimeline, + thirdTimeline); testRunner.assertTimelineChangeReasonsEqual( Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE, @@ -881,7 +885,7 @@ public final class ExoPlayerTest { .build() .start() .blockUntilEnded(TIMEOUT_MS); - testRunner.assertTimelinesSame(dummyTimeline, timeline, timeline2); + testRunner.assertTimelinesSame(placeholderTimeline, timeline, timeline2); testRunner.assertTimelineChangeReasonsEqual( Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE, @@ -1083,7 +1087,7 @@ public final class ExoPlayerTest { .start() .blockUntilActionScheduleFinished(TIMEOUT_MS) .blockUntilEnded(TIMEOUT_MS); - testRunner.assertTimelinesSame(dummyTimeline, timeline); + testRunner.assertTimelinesSame(placeholderTimeline, timeline); testRunner.assertTimelineChangeReasonsEqual( Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE); @@ -1117,7 +1121,7 @@ public final class ExoPlayerTest { .start() .blockUntilActionScheduleFinished(TIMEOUT_MS) .blockUntilEnded(TIMEOUT_MS); - testRunner.assertTimelinesSame(dummyTimeline, timeline); + testRunner.assertTimelinesSame(placeholderTimeline, timeline); testRunner.assertTimelineChangeReasonsEqual( Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE); @@ -1151,7 +1155,7 @@ public final class ExoPlayerTest { .start() .blockUntilActionScheduleFinished(TIMEOUT_MS) .blockUntilEnded(TIMEOUT_MS); - testRunner.assertTimelinesSame(dummyTimeline, timeline, Timeline.EMPTY); + testRunner.assertTimelinesSame(placeholderTimeline, timeline, Timeline.EMPTY); testRunner.assertTimelineChangeReasonsEqual( Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE, @@ -1244,7 +1248,7 @@ public final class ExoPlayerTest { Player.STATE_READY, Player.STATE_ENDED); testRunner.assertTimelinesSame( - dummyTimeline, + placeholderTimeline, timeline, Timeline.EMPTY, new FakeMediaSource.InitialTimeline(secondTimeline), @@ -1267,14 +1271,14 @@ public final class ExoPlayerTest { new FakeTimeline( new TimelineWindowDefinition(/* periodCount= */ 1, /* id= */ firstWindowId)); Timeline firstExpectedMaskingTimeline = - new MaskingMediaSource.DummyTimeline( + new MaskingMediaSource.PlaceholderTimeline( FakeTimeline.FAKE_MEDIA_ITEM.buildUpon().setTag(firstWindowId).build()); Object secondWindowId = new Object(); Timeline secondTimeline = new FakeTimeline( new TimelineWindowDefinition(/* periodCount= */ 1, /* id= */ secondWindowId)); Timeline secondExpectedMaskingTimeline = - new MaskingMediaSource.DummyTimeline( + new MaskingMediaSource.PlaceholderTimeline( FakeTimeline.FAKE_MEDIA_ITEM.buildUpon().setTag(secondWindowId).build()); MediaSource secondSource = new FakeMediaSource(secondTimeline); AtomicLong positionAfterReprepare = new AtomicLong(); @@ -1320,15 +1324,15 @@ public final class ExoPlayerTest { Timeline timeline = new FakeTimeline( new TimelineWindowDefinition(/* periodCount= */ 1, /* id= */ firstWindowId)); - Timeline firstExpectedDummyTimeline = - new MaskingMediaSource.DummyTimeline( + Timeline firstExpectedPlaceholderTimeline = + new MaskingMediaSource.PlaceholderTimeline( FakeTimeline.FAKE_MEDIA_ITEM.buildUpon().setTag(firstWindowId).build()); Object secondWindowId = new Object(); Timeline secondTimeline = new FakeTimeline( new TimelineWindowDefinition(/* periodCount= */ 1, /* id= */ secondWindowId)); - Timeline secondExpectedDummyTimeline = - new MaskingMediaSource.DummyTimeline( + Timeline secondExpectedPlaceholderTimeline = + new MaskingMediaSource.PlaceholderTimeline( FakeTimeline.FAKE_MEDIA_ITEM.buildUpon().setTag(secondWindowId).build()); MediaSource secondSource = new FakeMediaSource(secondTimeline); AtomicLong positionAfterReprepare = new AtomicLong(); @@ -1359,7 +1363,10 @@ public final class ExoPlayerTest { .blockUntilEnded(TIMEOUT_MS); testRunner.assertTimelinesSame( - firstExpectedDummyTimeline, timeline, secondExpectedDummyTimeline, secondTimeline); + firstExpectedPlaceholderTimeline, + timeline, + secondExpectedPlaceholderTimeline, + secondTimeline); testRunner.assertTimelineChangeReasonsEqual( Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE, @@ -1374,15 +1381,15 @@ public final class ExoPlayerTest { Timeline timeline = new FakeTimeline( new TimelineWindowDefinition(/* periodCount= */ 1, /* id= */ firstWindowId)); - Timeline firstExpectedDummyTimeline = - new MaskingMediaSource.DummyTimeline( + Timeline firstExpectedPlaceholderTimeline = + new MaskingMediaSource.PlaceholderTimeline( FakeTimeline.FAKE_MEDIA_ITEM.buildUpon().setTag(firstWindowId).build()); Object secondWindowId = new Object(); Timeline secondTimeline = new FakeTimeline( new TimelineWindowDefinition(/* periodCount= */ 1, /* id= */ secondWindowId)); - Timeline secondExpectedDummyTimeline = - new MaskingMediaSource.DummyTimeline( + Timeline secondExpectedPlaceholderTimeline = + new MaskingMediaSource.PlaceholderTimeline( FakeTimeline.FAKE_MEDIA_ITEM.buildUpon().setTag(secondWindowId).build()); MediaSource secondSource = new FakeMediaSource(secondTimeline); AtomicLong positionAfterReprepare = new AtomicLong(); @@ -1413,7 +1420,10 @@ public final class ExoPlayerTest { .blockUntilEnded(TIMEOUT_MS); testRunner.assertTimelinesSame( - firstExpectedDummyTimeline, timeline, secondExpectedDummyTimeline, secondTimeline); + firstExpectedPlaceholderTimeline, + timeline, + secondExpectedPlaceholderTimeline, + secondTimeline); testRunner.assertTimelineChangeReasonsEqual( Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE, @@ -1439,7 +1449,7 @@ public final class ExoPlayerTest { .start() .blockUntilActionScheduleFinished(TIMEOUT_MS) .blockUntilEnded(TIMEOUT_MS); - testRunner.assertTimelinesSame(dummyTimeline, Timeline.EMPTY); + testRunner.assertTimelinesSame(placeholderTimeline, Timeline.EMPTY); testRunner.assertTimelineChangeReasonsEqual( Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED, Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED); @@ -1465,7 +1475,7 @@ public final class ExoPlayerTest { .start() .blockUntilActionScheduleFinished(TIMEOUT_MS) .blockUntilEnded(TIMEOUT_MS); - testRunner.assertTimelinesSame(dummyTimeline, timeline); + testRunner.assertTimelinesSame(placeholderTimeline, timeline); testRunner.assertTimelineChangeReasonsEqual( Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE); @@ -1493,7 +1503,7 @@ public final class ExoPlayerTest { } catch (ExoPlaybackException e) { // Expected exception. } - testRunner.assertTimelinesSame(dummyTimeline, timeline); + testRunner.assertTimelinesSame(placeholderTimeline, timeline); testRunner.assertTimelineChangeReasonsEqual( Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE); @@ -1542,7 +1552,7 @@ public final class ExoPlayerTest { .start() .blockUntilActionScheduleFinished(TIMEOUT_MS) .blockUntilEnded(TIMEOUT_MS)); - testRunner.assertTimelinesSame(dummyTimeline, timeline); + testRunner.assertTimelinesSame(placeholderTimeline, timeline); testRunner.assertTimelineChangeReasonsEqual( Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE); @@ -1821,7 +1831,7 @@ public final class ExoPlayerTest { } catch (ExoPlaybackException e) { // Expected exception. } - testRunner.assertTimelinesSame(dummyTimeline, timeline, dummyTimeline, timeline); + testRunner.assertTimelinesSame(placeholderTimeline, timeline, placeholderTimeline, timeline); testRunner.assertTimelineChangeReasonsEqual( Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE, @@ -3840,7 +3850,7 @@ public final class ExoPlayerTest { Timeline timeline2 = new FakeTimeline(secondWindowDefinition); MediaSource mediaSource1 = new FakeMediaSource(timeline1); MediaSource mediaSource2 = new FakeMediaSource(timeline2); - Timeline expectedDummyTimeline = + Timeline expectedPlaceholderTimeline = new FakeTimeline( TimelineWindowDefinition.createDummy(/* tag= */ 1), TimelineWindowDefinition.createDummy(/* tag= */ 2)); @@ -3867,7 +3877,7 @@ public final class ExoPlayerTest { Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE, Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED); exoPlayerTestRunner.assertTimelinesSame( - expectedDummyTimeline, expectedRealTimeline, expectedRealTimelineAfterMove); + expectedPlaceholderTimeline, expectedRealTimeline, expectedRealTimelineAfterMove); } @Test @@ -3913,7 +3923,7 @@ public final class ExoPlayerTest { .blockUntilActionScheduleFinished(TIMEOUT_MS) .blockUntilEnded(TIMEOUT_MS); - Timeline expectedDummyTimeline = + Timeline expectedPlaceholderTimeline = new FakeTimeline( TimelineWindowDefinition.createDummy(/* tag= */ 1), TimelineWindowDefinition.createDummy(/* tag= */ 2), @@ -3927,7 +3937,7 @@ public final class ExoPlayerTest { Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE, Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED); exoPlayerTestRunner.assertTimelinesSame( - expectedDummyTimeline, expectedRealTimeline, expectedRealTimelineAfterRemove); + expectedPlaceholderTimeline, expectedRealTimeline, expectedRealTimelineAfterRemove); } @Test @@ -3973,7 +3983,7 @@ public final class ExoPlayerTest { .blockUntilActionScheduleFinished(TIMEOUT_MS) .blockUntilEnded(TIMEOUT_MS); - Timeline expectedDummyTimeline = + Timeline expectedPlaceholderTimeline = new FakeTimeline( TimelineWindowDefinition.createDummy(/* tag= */ 1), TimelineWindowDefinition.createDummy(/* tag= */ 2), @@ -3986,7 +3996,7 @@ public final class ExoPlayerTest { Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE, Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED); exoPlayerTestRunner.assertTimelinesSame( - expectedDummyTimeline, expectedRealTimeline, expectedRealTimelineAfterRemove); + expectedPlaceholderTimeline, expectedRealTimeline, expectedRealTimelineAfterRemove); } @Test @@ -4010,7 +4020,7 @@ public final class ExoPlayerTest { exoPlayerTestRunner.assertPlaybackStatesEqual( Player.STATE_BUFFERING, Player.STATE_READY, Player.STATE_ENDED); - exoPlayerTestRunner.assertTimelinesSame(dummyTimeline, timeline, Timeline.EMPTY); + exoPlayerTestRunner.assertTimelinesSame(placeholderTimeline, timeline, Timeline.EMPTY); exoPlayerTestRunner.assertTimelineChangeReasonsEqual( Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED /* media item set (masked timeline) */, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE /* source prepared */, @@ -4040,7 +4050,7 @@ public final class ExoPlayerTest { .blockUntilEnded(TIMEOUT_MS); exoPlayerTestRunner.assertTimelinesSame( - dummyTimeline, + placeholderTimeline, timeline, Timeline.EMPTY, new FakeMediaSource.InitialTimeline(secondTimeline), @@ -4064,7 +4074,8 @@ public final class ExoPlayerTest { int[] maskingPlaybackState = {C.INDEX_UNSET}; ActionSchedule actionSchedule = new ActionSchedule.Builder(TAG) - .waitForTimelineChanged(dummyTimeline, Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED) + .waitForTimelineChanged( + placeholderTimeline, Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED) .executeRunnable( new PlaybackStateCollector(/* index= */ 0, playbackStates, timelineWindowCounts)) .clearMediaItems() @@ -4113,7 +4124,7 @@ public final class ExoPlayerTest { Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED /* set media items */, Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED /* add media items */, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE /* source update after prepare */); - Timeline expectedSecondDummyTimeline = + Timeline expectedSecondPlaceholderTimeline = new FakeTimeline( TimelineWindowDefinition.createDummy(/* tag= */ 0), TimelineWindowDefinition.createDummy(/* tag= */ 0)); @@ -4132,10 +4143,10 @@ public final class ExoPlayerTest { /* isDynamic= */ false, /* durationUs= */ 10_000_000)); exoPlayerTestRunner.assertTimelinesSame( - dummyTimeline, + placeholderTimeline, Timeline.EMPTY, - dummyTimeline, - expectedSecondDummyTimeline, + placeholderTimeline, + expectedSecondPlaceholderTimeline, expectedSecondRealTimeline); assertArrayEquals(new int[] {Player.STATE_IDLE}, maskingPlaybackState); } @@ -4179,13 +4190,13 @@ public final class ExoPlayerTest { Player.STATE_READY, Player.STATE_ENDED); exoPlayerTestRunner.assertTimelinesSame( - dummyTimeline, + placeholderTimeline, timeline, Timeline.EMPTY, - dummyTimeline, + placeholderTimeline, timeline, Timeline.EMPTY, - dummyTimeline, + placeholderTimeline, timeline); exoPlayerTestRunner.assertTimelineChangeReasonsEqual( Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED /* media item set (masked timeline) */, @@ -4242,7 +4253,7 @@ public final class ExoPlayerTest { Player.STATE_READY, Player.STATE_ENDED); exoPlayerTestRunner.assertTimelinesSame( - dummyTimeline, timeline, Timeline.EMPTY, dummyTimeline, timeline); + placeholderTimeline, timeline, Timeline.EMPTY, placeholderTimeline, timeline); exoPlayerTestRunner.assertTimelineChangeReasonsEqual( Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED /* media item set (masked timeline) */, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE, /* source prepared */ @@ -4298,7 +4309,7 @@ public final class ExoPlayerTest { exoPlayerTestRunner.assertPlaybackStatesEqual( Player.STATE_BUFFERING, Player.STATE_READY, Player.STATE_ENDED); - exoPlayerTestRunner.assertTimelinesSame(dummyTimeline, timeline); + exoPlayerTestRunner.assertTimelinesSame(placeholderTimeline, timeline); exoPlayerTestRunner.assertTimelineChangeReasonsEqual( Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED /* media item set (masked timeline) */, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE /* source prepared */); @@ -4558,8 +4569,8 @@ public final class ExoPlayerTest { new FakeMediaSource(new FakeTimeline(/* windowCount= */ 1)), new DefaultDataSourceFactory( context, Util.getUserAgent(context, ExoPlayerLibraryInfo.VERSION_SLASHY)), - new DummyAdsLoader(), - new DummyAdViewProvider()); + new FakeAdsLoader(), + new FakeAdViewProvider()); Exception[] exception = {null}; ActionSchedule actionSchedule = new ActionSchedule.Builder(TAG) @@ -4596,8 +4607,8 @@ public final class ExoPlayerTest { mediaSource, new DefaultDataSourceFactory( context, Util.getUserAgent(context, ExoPlayerLibraryInfo.VERSION_SLASHY)), - new DummyAdsLoader(), - new DummyAdViewProvider()); + new FakeAdsLoader(), + new FakeAdViewProvider()); final Exception[] exception = {null}; ActionSchedule actionSchedule = new ActionSchedule.Builder(TAG) @@ -4636,8 +4647,8 @@ public final class ExoPlayerTest { mediaSource, new DefaultDataSourceFactory( context, Util.getUserAgent(context, ExoPlayerLibraryInfo.VERSION_SLASHY)), - new DummyAdsLoader(), - new DummyAdViewProvider()); + new FakeAdsLoader(), + new FakeAdViewProvider()); final Exception[] exception = {null}; ActionSchedule actionSchedule = new ActionSchedule.Builder(TAG) @@ -6471,7 +6482,7 @@ public final class ExoPlayerTest { @Override public boolean continueLoading(long positionUs) { loader.startLoading( - loadable, new DummyLoaderCallback(), /* defaultMinRetryCount= */ 1); + loadable, new FakeLoaderCallback(), /* defaultMinRetryCount= */ 1); return true; } @@ -6862,7 +6873,7 @@ public final class ExoPlayerTest { } } - private static final class DummyLoaderCallback implements Loader.Callback { + private static final class FakeLoaderCallback implements Loader.Callback { @Override public void onLoadCompleted( Loader.Loadable loadable, long elapsedRealtimeMs, long loadDurationMs) {} @@ -6882,7 +6893,7 @@ public final class ExoPlayerTest { } } - private static class DummyAdsLoader implements AdsLoader { + private static class FakeAdsLoader implements AdsLoader { @Override public void setPlayer(@Nullable Player player) {} @@ -6903,7 +6914,7 @@ public final class ExoPlayerTest { public void handlePrepareError(int adGroupIndex, int adIndexInAdGroup, IOException exception) {} } - private static class DummyAdViewProvider implements AdsLoader.AdViewProvider { + private static class FakeAdViewProvider implements AdsLoader.AdViewProvider { @Override public ViewGroup getAdViewGroup() { diff --git a/library/core/src/test/java/com/google/android/exoplayer2/analytics/AnalyticsCollectorTest.java b/library/core/src/test/java/com/google/android/exoplayer2/analytics/AnalyticsCollectorTest.java index 9916991705..ae76c87e21 100644 --- a/library/core/src/test/java/com/google/android/exoplayer2/analytics/AnalyticsCollectorTest.java +++ b/library/core/src/test/java/com/google/android/exoplayer2/analytics/AnalyticsCollectorTest.java @@ -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)) diff --git a/library/core/src/test/java/com/google/android/exoplayer2/database/VersionTableTest.java b/library/core/src/test/java/com/google/android/exoplayer2/database/VersionTableTest.java index 2d74175265..3d07bdcb5a 100644 --- a/library/core/src/test/java/com/google/android/exoplayer2/database/VersionTableTest.java +++ b/library/core/src/test/java/com/google/android/exoplayer2/database/VersionTableTest.java @@ -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(); } } diff --git a/library/core/src/test/java/com/google/android/exoplayer2/offline/DownloadManagerTest.java b/library/core/src/test/java/com/google/android/exoplayer2/offline/DownloadManagerTest.java index 0f4abf2f89..55bfa35560 100644 --- a/library/core/src/test/java/com/google/android/exoplayer2/offline/DownloadManagerTest.java +++ b/library/core/src/test/java/com/google/android/exoplayer2/offline/DownloadManagerTest.java @@ -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 { diff --git a/library/core/src/test/java/com/google/android/exoplayer2/source/ClippingMediaSourceTest.java b/library/core/src/test/java/com/google/android/exoplayer2/source/ClippingMediaSourceTest.java index 1e27fe7441..4a7dea9315 100644 --- a/library/core/src/test/java/com/google/android/exoplayer2/source/ClippingMediaSourceTest.java +++ b/library/core/src/test/java/com/google/android/exoplayer2/source/ClippingMediaSourceTest.java @@ -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( diff --git a/library/core/src/test/java/com/google/android/exoplayer2/source/ConcatenatingMediaSourceTest.java b/library/core/src/test/java/com/google/android/exoplayer2/source/ConcatenatingMediaSourceTest.java index b3d0d1cc14..abf0296a6e 100644 --- a/library/core/src/test/java/com/google/android/exoplayer2/source/ConcatenatingMediaSourceTest.java +++ b/library/core/src/test/java/com/google/android/exoplayer2/source/ConcatenatingMediaSourceTest.java @@ -408,15 +408,15 @@ public final class ConcatenatingMediaSourceTest { public void customCallbackBeforePreparationAddSingle() throws Exception { CountDownLatch runnableInvoked = new CountDownLatch(1); - DummyMainThread dummyMainThread = new DummyMainThread(); - dummyMainThread.runOnMainThread( + DummyMainThread testThread = new DummyMainThread(); + testThread.runOnMainThread( () -> mediaSource.addMediaSource( createFakeMediaSource(), Util.createHandlerForCurrentLooper(), runnableInvoked::countDown)); runnableInvoked.await(MediaSourceTestRunner.TIMEOUT_MS, TimeUnit.MILLISECONDS); - dummyMainThread.release(); + testThread.release(); assertThat(runnableInvoked.getCount()).isEqualTo(0); } @@ -425,15 +425,15 @@ public final class ConcatenatingMediaSourceTest { public void customCallbackBeforePreparationAddMultiple() throws Exception { CountDownLatch runnableInvoked = new CountDownLatch(1); - DummyMainThread dummyMainThread = new DummyMainThread(); - dummyMainThread.runOnMainThread( + DummyMainThread testThread = new DummyMainThread(); + testThread.runOnMainThread( () -> mediaSource.addMediaSources( Arrays.asList(new MediaSource[] {createFakeMediaSource(), createFakeMediaSource()}), Util.createHandlerForCurrentLooper(), runnableInvoked::countDown)); runnableInvoked.await(MediaSourceTestRunner.TIMEOUT_MS, TimeUnit.MILLISECONDS); - dummyMainThread.release(); + testThread.release(); assertThat(runnableInvoked.getCount()).isEqualTo(0); } @@ -442,8 +442,8 @@ public final class ConcatenatingMediaSourceTest { public void customCallbackBeforePreparationAddSingleWithIndex() throws Exception { CountDownLatch runnableInvoked = new CountDownLatch(1); - DummyMainThread dummyMainThread = new DummyMainThread(); - dummyMainThread.runOnMainThread( + DummyMainThread testThread = new DummyMainThread(); + testThread.runOnMainThread( () -> mediaSource.addMediaSource( /* index */ 0, @@ -451,7 +451,7 @@ public final class ConcatenatingMediaSourceTest { Util.createHandlerForCurrentLooper(), runnableInvoked::countDown)); runnableInvoked.await(MediaSourceTestRunner.TIMEOUT_MS, TimeUnit.MILLISECONDS); - dummyMainThread.release(); + testThread.release(); assertThat(runnableInvoked.getCount()).isEqualTo(0); } @@ -460,8 +460,8 @@ public final class ConcatenatingMediaSourceTest { public void customCallbackBeforePreparationAddMultipleWithIndex() throws Exception { CountDownLatch runnableInvoked = new CountDownLatch(1); - DummyMainThread dummyMainThread = new DummyMainThread(); - dummyMainThread.runOnMainThread( + DummyMainThread testThread = new DummyMainThread(); + testThread.runOnMainThread( () -> mediaSource.addMediaSources( /* index */ 0, @@ -469,7 +469,7 @@ public final class ConcatenatingMediaSourceTest { Util.createHandlerForCurrentLooper(), runnableInvoked::countDown)); runnableInvoked.await(MediaSourceTestRunner.TIMEOUT_MS, TimeUnit.MILLISECONDS); - dummyMainThread.release(); + testThread.release(); assertThat(runnableInvoked.getCount()).isEqualTo(0); } @@ -478,15 +478,15 @@ public final class ConcatenatingMediaSourceTest { public void customCallbackBeforePreparationRemove() throws Exception { CountDownLatch runnableInvoked = new CountDownLatch(1); - DummyMainThread dummyMainThread = new DummyMainThread(); - dummyMainThread.runOnMainThread( + DummyMainThread testThread = new DummyMainThread(); + testThread.runOnMainThread( () -> { mediaSource.addMediaSource(createFakeMediaSource()); mediaSource.removeMediaSource( /* index */ 0, Util.createHandlerForCurrentLooper(), runnableInvoked::countDown); }); runnableInvoked.await(MediaSourceTestRunner.TIMEOUT_MS, TimeUnit.MILLISECONDS); - dummyMainThread.release(); + testThread.release(); assertThat(runnableInvoked.getCount()).isEqualTo(0); } @@ -495,8 +495,8 @@ public final class ConcatenatingMediaSourceTest { public void customCallbackBeforePreparationMove() throws Exception { CountDownLatch runnableInvoked = new CountDownLatch(1); - DummyMainThread dummyMainThread = new DummyMainThread(); - dummyMainThread.runOnMainThread( + DummyMainThread testThread = new DummyMainThread(); + testThread.runOnMainThread( () -> { mediaSource.addMediaSources( Arrays.asList(new MediaSource[] {createFakeMediaSource(), createFakeMediaSource()})); @@ -507,35 +507,35 @@ public final class ConcatenatingMediaSourceTest { runnableInvoked::countDown); }); runnableInvoked.await(MediaSourceTestRunner.TIMEOUT_MS, TimeUnit.MILLISECONDS); - dummyMainThread.release(); + testThread.release(); assertThat(runnableInvoked.getCount()).isEqualTo(0); } @Test public void customCallbackAfterPreparationAddSingle() throws Exception { - DummyMainThread dummyMainThread = new DummyMainThread(); + DummyMainThread testThread = new DummyMainThread(); try { testRunner.prepareSource(); final TimelineGrabber timelineGrabber = new TimelineGrabber(testRunner); - dummyMainThread.runOnMainThread( + testThread.runOnMainThread( () -> mediaSource.addMediaSource( createFakeMediaSource(), Util.createHandlerForCurrentLooper(), timelineGrabber)); Timeline timeline = timelineGrabber.assertTimelineChangeBlocking(); assertThat(timeline.getWindowCount()).isEqualTo(1); } finally { - dummyMainThread.release(); + testThread.release(); } } @Test public void customCallbackAfterPreparationAddMultiple() throws Exception { - DummyMainThread dummyMainThread = new DummyMainThread(); + DummyMainThread testThread = new DummyMainThread(); try { testRunner.prepareSource(); final TimelineGrabber timelineGrabber = new TimelineGrabber(testRunner); - dummyMainThread.runOnMainThread( + testThread.runOnMainThread( () -> mediaSource.addMediaSources( Arrays.asList( @@ -545,17 +545,17 @@ public final class ConcatenatingMediaSourceTest { Timeline timeline = timelineGrabber.assertTimelineChangeBlocking(); assertThat(timeline.getWindowCount()).isEqualTo(2); } finally { - dummyMainThread.release(); + testThread.release(); } } @Test public void customCallbackAfterPreparationAddSingleWithIndex() throws Exception { - DummyMainThread dummyMainThread = new DummyMainThread(); + DummyMainThread testThread = new DummyMainThread(); try { testRunner.prepareSource(); final TimelineGrabber timelineGrabber = new TimelineGrabber(testRunner); - dummyMainThread.runOnMainThread( + testThread.runOnMainThread( () -> mediaSource.addMediaSource( /* index */ 0, @@ -565,17 +565,17 @@ public final class ConcatenatingMediaSourceTest { Timeline timeline = timelineGrabber.assertTimelineChangeBlocking(); assertThat(timeline.getWindowCount()).isEqualTo(1); } finally { - dummyMainThread.release(); + testThread.release(); } } @Test public void customCallbackAfterPreparationAddMultipleWithIndex() throws Exception { - DummyMainThread dummyMainThread = new DummyMainThread(); + DummyMainThread testThread = new DummyMainThread(); try { testRunner.prepareSource(); final TimelineGrabber timelineGrabber = new TimelineGrabber(testRunner); - dummyMainThread.runOnMainThread( + testThread.runOnMainThread( () -> mediaSource.addMediaSources( /* index */ 0, @@ -586,36 +586,36 @@ public final class ConcatenatingMediaSourceTest { Timeline timeline = timelineGrabber.assertTimelineChangeBlocking(); assertThat(timeline.getWindowCount()).isEqualTo(2); } finally { - dummyMainThread.release(); + testThread.release(); } } @Test public void customCallbackAfterPreparationRemove() throws Exception { - DummyMainThread dummyMainThread = new DummyMainThread(); + DummyMainThread testThread = new DummyMainThread(); try { testRunner.prepareSource(); - dummyMainThread.runOnMainThread(() -> mediaSource.addMediaSource(createFakeMediaSource())); + testThread.runOnMainThread(() -> mediaSource.addMediaSource(createFakeMediaSource())); testRunner.assertTimelineChangeBlocking(); final TimelineGrabber timelineGrabber = new TimelineGrabber(testRunner); - dummyMainThread.runOnMainThread( + testThread.runOnMainThread( () -> mediaSource.removeMediaSource( /* index */ 0, Util.createHandlerForCurrentLooper(), timelineGrabber)); Timeline timeline = timelineGrabber.assertTimelineChangeBlocking(); assertThat(timeline.getWindowCount()).isEqualTo(0); } finally { - dummyMainThread.release(); + testThread.release(); } } @Test public void customCallbackAfterPreparationMove() throws Exception { - DummyMainThread dummyMainThread = new DummyMainThread(); + DummyMainThread testThread = new DummyMainThread(); try { testRunner.prepareSource(); - dummyMainThread.runOnMainThread( + testThread.runOnMainThread( () -> mediaSource.addMediaSources( Arrays.asList( @@ -623,7 +623,7 @@ public final class ConcatenatingMediaSourceTest { testRunner.assertTimelineChangeBlocking(); final TimelineGrabber timelineGrabber = new TimelineGrabber(testRunner); - dummyMainThread.runOnMainThread( + testThread.runOnMainThread( () -> mediaSource.moveMediaSource( /* fromIndex */ 1, /* toIndex */ @@ -633,16 +633,16 @@ public final class ConcatenatingMediaSourceTest { Timeline timeline = timelineGrabber.assertTimelineChangeBlocking(); assertThat(timeline.getWindowCount()).isEqualTo(2); } finally { - dummyMainThread.release(); + testThread.release(); } } @Test public void customCallbackIsCalledAfterRelease() throws Exception { - DummyMainThread dummyMainThread = new DummyMainThread(); + DummyMainThread testThread = new DummyMainThread(); CountDownLatch callbackCalledCondition = new CountDownLatch(1); try { - dummyMainThread.runOnMainThread( + testThread.runOnMainThread( () -> { MediaSourceCaller caller = mock(MediaSourceCaller.class); mediaSource.addMediaSources(Arrays.asList(createMediaSources(2))); @@ -659,7 +659,7 @@ public final class ConcatenatingMediaSourceTest { MediaSourceTestRunner.TIMEOUT_MS, TimeUnit.MILLISECONDS)) .isTrue(); } finally { - dummyMainThread.release(); + testThread.release(); } } @@ -891,10 +891,10 @@ public final class ConcatenatingMediaSourceTest { @Test public void clear() throws Exception { - DummyMainThread dummyMainThread = new DummyMainThread(); + DummyMainThread testThread = new DummyMainThread(); final FakeMediaSource preparedChildSource = createFakeMediaSource(); final FakeMediaSource unpreparedChildSource = new FakeMediaSource(/* timeline= */ null); - dummyMainThread.runOnMainThread( + testThread.runOnMainThread( () -> { mediaSource.addMediaSource(preparedChildSource); mediaSource.addMediaSource(unpreparedChildSource); @@ -902,7 +902,7 @@ public final class ConcatenatingMediaSourceTest { testRunner.prepareSource(); final TimelineGrabber timelineGrabber = new TimelineGrabber(testRunner); - dummyMainThread.runOnMainThread( + testThread.runOnMainThread( () -> mediaSource.clear(Util.createHandlerForCurrentLooper(), timelineGrabber)); Timeline timeline = timelineGrabber.assertTimelineChangeBlocking(); @@ -1050,28 +1050,28 @@ public final class ConcatenatingMediaSourceTest { public void customCallbackBeforePreparationSetShuffleOrder() throws Exception { CountDownLatch runnableInvoked = new CountDownLatch(1); - DummyMainThread dummyMainThread = new DummyMainThread(); - dummyMainThread.runOnMainThread( + DummyMainThread testThread = new DummyMainThread(); + testThread.runOnMainThread( () -> mediaSource.setShuffleOrder( new ShuffleOrder.UnshuffledShuffleOrder(/* length= */ 0), Util.createHandlerForCurrentLooper(), runnableInvoked::countDown)); runnableInvoked.await(MediaSourceTestRunner.TIMEOUT_MS, TimeUnit.MILLISECONDS); - dummyMainThread.release(); + testThread.release(); assertThat(runnableInvoked.getCount()).isEqualTo(0); } @Test public void customCallbackAfterPreparationSetShuffleOrder() throws Exception { - DummyMainThread dummyMainThread = new DummyMainThread(); + DummyMainThread testThread = new DummyMainThread(); try { mediaSource.addMediaSources( Arrays.asList(createFakeMediaSource(), createFakeMediaSource(), createFakeMediaSource())); testRunner.prepareSource(); TimelineGrabber timelineGrabber = new TimelineGrabber(testRunner); - dummyMainThread.runOnMainThread( + testThread.runOnMainThread( () -> mediaSource.setShuffleOrder( new ShuffleOrder.UnshuffledShuffleOrder(/* length= */ 3), @@ -1080,7 +1080,7 @@ public final class ConcatenatingMediaSourceTest { Timeline timeline = timelineGrabber.assertTimelineChangeBlocking(); assertThat(timeline.getFirstWindowIndex(/* shuffleModeEnabled= */ true)).isEqualTo(0); } finally { - dummyMainThread.release(); + testThread.release(); } } diff --git a/library/core/src/test/java/com/google/android/exoplayer2/source/SampleQueueTest.java b/library/core/src/test/java/com/google/android/exoplayer2/source/SampleQueueTest.java index 16eb07a509..16444b99bf 100644 --- a/library/core/src/test/java/com/google/android/exoplayer2/source/SampleQueueTest.java +++ b/library/core/src/test/java/com/google/android/exoplayer2/source/SampleQueueTest.java @@ -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); } /** diff --git a/library/core/src/test/java/com/google/android/exoplayer2/upstream/DefaultBandwidthMeterTest.java b/library/core/src/test/java/com/google/android/exoplayer2/upstream/DefaultBandwidthMeterTest.java index d8d22a7b2f..9f30cf4649 100644 --- a/library/core/src/test/java/com/google/android/exoplayer2/upstream/DefaultBandwidthMeterTest.java +++ b/library/core/src/test/java/com/google/android/exoplayer2/upstream/DefaultBandwidthMeterTest.java @@ -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));