Remove Timeline.UNKNOWN_PERIOD_COUNT
It's no longer used. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=129870115
This commit is contained in:
parent
d10c811bd8
commit
91c7551cc3
@ -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,
|
||||
|
@ -22,11 +22,6 @@ 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.
|
||||
@ -34,8 +29,7 @@ public interface Timeline {
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user