Commit 478be502 by bachinger Committed by Oliver Woodman

Remove constructor of SinglePeriodTimline without tag and media item

We aim for all SinglePeriodTimelines to set window.mediaItem and hence want to eliminate all constructors not passing a media item. The constructor removed in this CL is the easiest one to remove and fix in google3. It is still a breaking change for external ExoPlayer user who provide a custom media source with this timeline.

PiperOrigin-RevId: 311291493
parent 30bc77f2
...@@ -43,19 +43,6 @@ public final class SinglePeriodTimeline extends Timeline { ...@@ -43,19 +43,6 @@ public final class SinglePeriodTimeline extends Timeline {
@Nullable private final MediaItem mediaItem; @Nullable private final MediaItem mediaItem;
/** /**
* Creates a timeline containing a single period and a window that spans it.
*
* @param durationUs The duration of the period, in microseconds.
* @param isSeekable Whether seeking is supported within the period.
* @param isDynamic Whether the window may change when the timeline is updated.
* @param isLive Whether the window is live.
*/
public SinglePeriodTimeline(
long durationUs, boolean isSeekable, boolean isDynamic, boolean isLive) {
this(durationUs, isSeekable, isDynamic, isLive, /* manifest= */ null, /* mediaItem= */ null);
}
/**
* @deprecated Use {@link #SinglePeriodTimeline(long, boolean, boolean, boolean, Object, * @deprecated Use {@link #SinglePeriodTimeline(long, boolean, boolean, boolean, Object,
* MediaItem)} instead. * MediaItem)} instead.
*/ */
......
...@@ -52,7 +52,12 @@ public final class MediaPeriodQueueTest { ...@@ -52,7 +52,12 @@ public final class MediaPeriodQueueTest {
private static final Timeline CONTENT_TIMELINE = private static final Timeline CONTENT_TIMELINE =
new SinglePeriodTimeline( new SinglePeriodTimeline(
CONTENT_DURATION_US, /* isSeekable= */ true, /* isDynamic= */ false, /* isLive= */ false); CONTENT_DURATION_US,
/* isSeekable= */ true,
/* isDynamic= */ false,
/* isLive= */ false,
/* manifest= */ null,
/* mediaItem= */ null);
private static final Uri AD_URI = Uri.EMPTY; private static final Uri AD_URI = Uri.EMPTY;
private MediaPeriodQueue mediaPeriodQueue; private MediaPeriodQueue mediaPeriodQueue;
......
...@@ -69,7 +69,9 @@ public final class ClippingMediaSourceTest { ...@@ -69,7 +69,9 @@ public final class ClippingMediaSourceTest {
TEST_PERIOD_DURATION_US, TEST_PERIOD_DURATION_US,
/* isSeekable= */ true, /* isSeekable= */ true,
/* isDynamic= */ false, /* isDynamic= */ false,
/* isLive= */ false); /* isLive= */ false,
/* manifest= */ null,
/* mediaItem= */ null);
Timeline clippedTimeline = getClippedTimeline(timeline, 0, TEST_PERIOD_DURATION_US); Timeline clippedTimeline = getClippedTimeline(timeline, 0, TEST_PERIOD_DURATION_US);
...@@ -88,7 +90,9 @@ public final class ClippingMediaSourceTest { ...@@ -88,7 +90,9 @@ public final class ClippingMediaSourceTest {
TEST_PERIOD_DURATION_US, TEST_PERIOD_DURATION_US,
/* isSeekable= */ false, /* isSeekable= */ false,
/* isDynamic= */ false, /* isDynamic= */ false,
/* isLive= */ false); /* isLive= */ false,
/* manifest= */ null,
/* mediaItem= */ null);
// If the unseekable window isn't clipped, clipping succeeds. // If the unseekable window isn't clipped, clipping succeeds.
getClippedTimeline(timeline, 0, TEST_PERIOD_DURATION_US); getClippedTimeline(timeline, 0, TEST_PERIOD_DURATION_US);
...@@ -108,7 +112,9 @@ public final class ClippingMediaSourceTest { ...@@ -108,7 +112,9 @@ public final class ClippingMediaSourceTest {
/* durationUs= */ C.TIME_UNSET, /* durationUs= */ C.TIME_UNSET,
/* isSeekable= */ false, /* isSeekable= */ false,
/* isDynamic= */ false, /* isDynamic= */ false,
/* isLive= */ false); /* isLive= */ false,
/* manifest= */ null,
/* mediaItem= */ null);
// If the unseekable window isn't clipped, clipping succeeds. // If the unseekable window isn't clipped, clipping succeeds.
getClippedTimeline(timeline, /* startUs= */ 0, TEST_PERIOD_DURATION_US); getClippedTimeline(timeline, /* startUs= */ 0, TEST_PERIOD_DURATION_US);
...@@ -128,7 +134,9 @@ public final class ClippingMediaSourceTest { ...@@ -128,7 +134,9 @@ public final class ClippingMediaSourceTest {
TEST_PERIOD_DURATION_US, TEST_PERIOD_DURATION_US,
/* isSeekable= */ true, /* isSeekable= */ true,
/* isDynamic= */ false, /* isDynamic= */ false,
/* isLive= */ false); /* isLive= */ false,
/* manifest= */ null,
/* mediaItem= */ null);
Timeline clippedTimeline = Timeline clippedTimeline =
getClippedTimeline(timeline, TEST_CLIP_AMOUNT_US, TEST_PERIOD_DURATION_US); getClippedTimeline(timeline, TEST_CLIP_AMOUNT_US, TEST_PERIOD_DURATION_US);
...@@ -145,7 +153,9 @@ public final class ClippingMediaSourceTest { ...@@ -145,7 +153,9 @@ public final class ClippingMediaSourceTest {
TEST_PERIOD_DURATION_US, TEST_PERIOD_DURATION_US,
/* isSeekable= */ true, /* isSeekable= */ true,
/* isDynamic= */ false, /* isDynamic= */ false,
/* isLive= */ false); /* isLive= */ false,
/* manifest= */ null,
/* mediaItem= */ null);
Timeline clippedTimeline = Timeline clippedTimeline =
getClippedTimeline(timeline, 0, TEST_PERIOD_DURATION_US - TEST_CLIP_AMOUNT_US); getClippedTimeline(timeline, 0, TEST_PERIOD_DURATION_US - TEST_CLIP_AMOUNT_US);
...@@ -179,7 +189,9 @@ public final class ClippingMediaSourceTest { ...@@ -179,7 +189,9 @@ public final class ClippingMediaSourceTest {
/* durationUs= */ TEST_PERIOD_DURATION_US, /* durationUs= */ TEST_PERIOD_DURATION_US,
/* isSeekable= */ true, /* isSeekable= */ true,
/* isDynamic= */ false, /* isDynamic= */ false,
/* isLive= */ false); /* isLive= */ false,
/* manifest= */ null,
/* mediaItem= */ null);
// When clipping to the end, the clipped timeline should also have a duration. // When clipping to the end, the clipped timeline should also have a duration.
Timeline clippedTimeline = Timeline clippedTimeline =
...@@ -196,7 +208,9 @@ public final class ClippingMediaSourceTest { ...@@ -196,7 +208,9 @@ public final class ClippingMediaSourceTest {
/* durationUs= */ C.TIME_UNSET, /* durationUs= */ C.TIME_UNSET,
/* isSeekable= */ true, /* isSeekable= */ true,
/* isDynamic= */ false, /* isDynamic= */ false,
/* isLive= */ false); /* isLive= */ false,
/* manifest= */ null,
/* mediaItem= */ null);
// When clipping to the end, the clipped timeline should also have an unset duration. // When clipping to the end, the clipped timeline should also have an unset duration.
Timeline clippedTimeline = Timeline clippedTimeline =
...@@ -212,7 +226,9 @@ public final class ClippingMediaSourceTest { ...@@ -212,7 +226,9 @@ public final class ClippingMediaSourceTest {
TEST_PERIOD_DURATION_US, TEST_PERIOD_DURATION_US,
/* isSeekable= */ true, /* isSeekable= */ true,
/* isDynamic= */ false, /* isDynamic= */ false,
/* isLive= */ false); /* isLive= */ false,
/* manifest= */ null,
/* mediaItem= */ null);
Timeline clippedTimeline = Timeline clippedTimeline =
getClippedTimeline( getClippedTimeline(
...@@ -540,7 +556,9 @@ public final class ClippingMediaSourceTest { ...@@ -540,7 +556,9 @@ public final class ClippingMediaSourceTest {
TEST_PERIOD_DURATION_US, TEST_PERIOD_DURATION_US,
/* isSeekable= */ true, /* isSeekable= */ true,
/* isDynamic= */ false, /* isDynamic= */ false,
/* isLive= */ false); /* isLive= */ false,
/* manifest= */ null,
/* mediaItem= */ null);
FakeMediaSource fakeMediaSource = FakeMediaSource fakeMediaSource =
new FakeMediaSource(timeline) { new FakeMediaSource(timeline) {
@Override @Override
......
...@@ -45,7 +45,12 @@ public final class SinglePeriodTimelineTest { ...@@ -45,7 +45,12 @@ public final class SinglePeriodTimelineTest {
public void getPeriodPositionDynamicWindowUnknownDuration() { public void getPeriodPositionDynamicWindowUnknownDuration() {
SinglePeriodTimeline timeline = SinglePeriodTimeline timeline =
new SinglePeriodTimeline( new SinglePeriodTimeline(
C.TIME_UNSET, /* isSeekable= */ false, /* isDynamic= */ true, /* isLive= */ true); C.TIME_UNSET,
/* isSeekable= */ false,
/* isDynamic= */ true,
/* isLive= */ true,
/* manifest= */ null,
/* mediaItem= */ null);
// Should return null with any positive position projection. // Should return null with any positive position projection.
Pair<Object, Long> position = timeline.getPeriodPosition(window, period, 0, C.TIME_UNSET, 1); Pair<Object, Long> position = timeline.getPeriodPosition(window, period, 0, C.TIME_UNSET, 1);
assertThat(position).isNull(); assertThat(position).isNull();
......
...@@ -59,14 +59,21 @@ public final class AdsMediaSourceTest { ...@@ -59,14 +59,21 @@ public final class AdsMediaSourceTest {
PREROLL_AD_DURATION_US, PREROLL_AD_DURATION_US,
/* isSeekable= */ true, /* isSeekable= */ true,
/* isDynamic= */ false, /* isDynamic= */ false,
/* isLive= */ false); /* isLive= */ false,
/* manifest= */ null,
/* mediaItem= */ null);
private static final Object PREROLL_AD_PERIOD_UID = private static final Object PREROLL_AD_PERIOD_UID =
PREROLL_AD_TIMELINE.getUidOfPeriod(/* periodIndex= */ 0); PREROLL_AD_TIMELINE.getUidOfPeriod(/* periodIndex= */ 0);
private static final long CONTENT_DURATION_US = 30 * C.MICROS_PER_SECOND; private static final long CONTENT_DURATION_US = 30 * C.MICROS_PER_SECOND;
private static final Timeline CONTENT_TIMELINE = private static final Timeline CONTENT_TIMELINE =
new SinglePeriodTimeline( new SinglePeriodTimeline(
CONTENT_DURATION_US, /* isSeekable= */ true, /* isDynamic= */ false, /* isLive= */ false); CONTENT_DURATION_US,
/* isSeekable= */ true,
/* isDynamic= */ false,
/* isLive= */ false,
/* manifest= */ null,
/* mediaItem= */ null);
private static final Object CONTENT_PERIOD_UID = private static final Object CONTENT_PERIOD_UID =
CONTENT_TIMELINE.getUidOfPeriod(/* periodIndex= */ 0); CONTENT_TIMELINE.getUidOfPeriod(/* periodIndex= */ 0);
......
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