mirror of
https://github.com/samsonjs/media.git
synced 2026-04-01 10:35:48 +00:00
Add absolute start time to Timeline
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=129869741
This commit is contained in:
parent
4502a464dd
commit
cd4cc1dc14
5 changed files with 23 additions and 3 deletions
|
|
@ -95,9 +95,9 @@ import java.util.Locale;
|
|||
boolean isFinal = timeline.isFinal();
|
||||
int periodCount = timeline.getPeriodCount();
|
||||
int seekWindowCount = timeline.getSeekWindowCount();
|
||||
Log.d(TAG, "sourceInfo[isFinal=" + isFinal + ", periodCount="
|
||||
+ (periodCount == Timeline.UNKNOWN_PERIOD_COUNT ? "?" : periodCount) + ", seekWindows: "
|
||||
+ seekWindowCount);
|
||||
Log.d(TAG, "sourceInfo[isFinal=" + isFinal + ", startTime=" + timeline.getAbsoluteStartTime()
|
||||
+ ", periodCount=" + (periodCount == Timeline.UNKNOWN_PERIOD_COUNT ? "?" : periodCount)
|
||||
+ ", seekWindows: " + seekWindowCount);
|
||||
for (int seekWindowIndex = 0; seekWindowIndex < seekWindowCount; seekWindowIndex++) {
|
||||
Log.d(TAG, " " + timeline.getSeekWindow(seekWindowIndex));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,6 +151,11 @@ public final class ConcatenatingMediaSource implements MediaSource {
|
|||
return isFinal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAbsoluteStartTime() {
|
||||
return timelines[0].getAbsoluteStartTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPeriodDuration(int index) {
|
||||
int sourceIndex = getSourceIndexForPeriod(index);
|
||||
|
|
|
|||
|
|
@ -90,6 +90,11 @@ public final class SinglePeriodTimeline implements Timeline {
|
|||
return isFinal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAbsoluteStartTime() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPeriodDuration(int index) {
|
||||
if (index != 0) {
|
||||
|
|
|
|||
|
|
@ -44,6 +44,11 @@ public interface Timeline {
|
|||
*/
|
||||
boolean isFinal();
|
||||
|
||||
/**
|
||||
* Returns the absolute start time of the timeline in milliseconds.
|
||||
*/
|
||||
long getAbsoluteStartTime();
|
||||
|
||||
/**
|
||||
* Returns the duration of the period at {@code index} in the timeline, in milliseconds, or
|
||||
* {@link ExoPlayer#UNKNOWN_TIME} if not known.
|
||||
|
|
|
|||
|
|
@ -503,6 +503,11 @@ public final class DashMediaSource implements MediaSource {
|
|||
return !manifest.dynamic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAbsoluteStartTime() {
|
||||
return manifest.availabilityStartTime + manifest.getPeriod(0).startMs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPeriodDuration(int index) {
|
||||
return manifest.getPeriodDurationMs(index);
|
||||
|
|
|
|||
Loading…
Reference in a new issue