Commit 91c7551c by olly Committed by Oliver Woodman

Remove Timeline.UNKNOWN_PERIOD_COUNT

It's no longer used.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=129870115
parent d10c811b
......@@ -96,8 +96,7 @@ import java.util.Locale;
int periodCount = timeline.getPeriodCount();
int seekWindowCount = timeline.getSeekWindowCount();
Log.d(TAG, "sourceInfo[isFinal=" + isFinal + ", startTime=" + timeline.getAbsoluteStartTime()
+ ", periodCount=" + (periodCount == Timeline.UNKNOWN_PERIOD_COUNT ? "?" : periodCount)
+ ", seekWindows: " + seekWindowCount);
+ ", periodCount=" + periodCount + ", seekWindows: " + seekWindowCount);
for (int seekWindowIndex = 0; seekWindowIndex < seekWindowCount; seekWindowIndex++) {
Log.d(TAG, " " + timeline.getSeekWindow(seekWindowIndex));
}
......
......@@ -18,7 +18,6 @@ package com.google.android.exoplayer2.source;
import com.google.android.exoplayer2.util.Util;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
/**
* Concatenates multiple {@link MediaSource}s.
......@@ -124,26 +123,18 @@ public final class ConcatenatingMediaSource implements MediaSource {
SeekWindow sourceSeekWindow = timeline.getSeekWindow(j);
concatenatedSeekWindows.add(sourceSeekWindow.copyOffsetByPeriodCount(sourceOffset));
}
int periodCount = timeline.getPeriodCount();
if (periodCount == Timeline.UNKNOWN_PERIOD_COUNT) {
sourceOffsets = Arrays.copyOf(sourceOffsets, i);
isFinal = false;
break;
}
sourceOffset += periodCount;
sourceOffset += timeline.getPeriodCount();
sourceOffsets[i] = sourceOffset;
}
this.timelines = timelines;
this.isFinal = isFinal;
this.sourceOffsets = sourceOffsets;
seekWindows =
concatenatedSeekWindows.toArray(new SeekWindow[concatenatedSeekWindows.size()]);
seekWindows = concatenatedSeekWindows.toArray(new SeekWindow[concatenatedSeekWindows.size()]);
}
@Override
public int getPeriodCount() {
return sourceOffsets.length == timelines.length ? sourceOffsets[sourceOffsets.length - 1]
: UNKNOWN_PERIOD_COUNT;
return sourceOffsets[sourceOffsets.length - 1];
}
@Override
......
......@@ -39,7 +39,7 @@ public final class SeekWindow {
* @param startTimeUs The start time of the window in microseconds, relative to the start of the
* specified start period.
* @param endPeriodIndex The index of the period containing the end of the window.
* @param endTimeUs = The end time of the window in microseconds, relative to the start of the
* @param endTimeUs The end time of the window in microseconds, relative to the start of the
* specified end period.
*/
public static SeekWindow createWindow(int startPeriodIndex, long startTimeUs,
......
......@@ -23,19 +23,13 @@ import com.google.android.exoplayer2.ExoPlayer;
public interface Timeline {
/**
* Returned by {@link #getPeriodCount()} when the number of periods is not known.
*/
int UNKNOWN_PERIOD_COUNT = -1;
/**
* Returned by {@link #getIndexOfPeriod(Object)} if no period index corresponds to the specified
* identifier.
*/
int NO_PERIOD_INDEX = -1;
/**
* Returns the number of periods in the timeline, or {@link #UNKNOWN_PERIOD_COUNT} if not known.
* If {@link #isFinal()} returns {@code true}, the number of periods must be known.
* Returns the number of periods in the timeline.
*/
int getPeriodCount();
......
......@@ -142,7 +142,7 @@ public final class DashMediaSource implements MediaSource {
public int getNewPlayingPeriodIndex(int oldPlayingPeriodIndex, Timeline oldTimeline) {
int periodIndex = oldPlayingPeriodIndex;
int oldPeriodCount = oldTimeline.getPeriodCount();
while (oldPeriodCount == Timeline.UNKNOWN_PERIOD_COUNT || periodIndex < oldPeriodCount) {
while (periodIndex < oldPeriodCount) {
Object id = oldTimeline.getPeriodId(periodIndex);
if (id == null) {
break;
......
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