Fix large timestamps for HLS playbacks
- If there's no program-date-time then this change is a no-op. - If there is a program-date-time this change considers the period as having started at the epoch rather than at the start of the content. The window is then set to start at the start of the content. This is a little weird, but is required so that the period sample timestamps match the start of the period. Note that this also brings the handling of on-demand in line with how the live case is handled, meaning there wont be weird changes if a live stream changes into an on-demand one. Issue: #2224 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=142442719
This commit is contained in:
parent
4bb8793203
commit
ab88821614
@ -104,15 +104,14 @@ public final class HlsMediaSource implements MediaSource,
|
|||||||
SinglePeriodTimeline timeline;
|
SinglePeriodTimeline timeline;
|
||||||
if (playlistTracker.isLive()) {
|
if (playlistTracker.isLive()) {
|
||||||
// TODO: fix windowPositionInPeriodUs when playlist is empty.
|
// TODO: fix windowPositionInPeriodUs when playlist is empty.
|
||||||
long windowPositionInPeriodUs = playlist.startTimeUs;
|
|
||||||
List<HlsMediaPlaylist.Segment> segments = playlist.segments;
|
List<HlsMediaPlaylist.Segment> segments = playlist.segments;
|
||||||
long windowDefaultStartPositionUs = segments.isEmpty() ? 0
|
long windowDefaultStartPositionUs = segments.isEmpty() ? 0
|
||||||
: segments.get(Math.max(0, segments.size() - 3)).relativeStartTimeUs;
|
: segments.get(Math.max(0, segments.size() - 3)).relativeStartTimeUs;
|
||||||
timeline = new SinglePeriodTimeline(C.TIME_UNSET, playlist.durationUs,
|
timeline = new SinglePeriodTimeline(C.TIME_UNSET, playlist.durationUs,
|
||||||
windowPositionInPeriodUs, windowDefaultStartPositionUs, true, !playlist.hasEndTag);
|
playlist.startTimeUs, windowDefaultStartPositionUs, true, !playlist.hasEndTag);
|
||||||
} else /* not live */ {
|
} else /* not live */ {
|
||||||
timeline = new SinglePeriodTimeline(playlist.durationUs, playlist.durationUs, 0, 0, true,
|
timeline = new SinglePeriodTimeline(playlist.startTimeUs + playlist.durationUs,
|
||||||
false);
|
playlist.durationUs, playlist.startTimeUs, 0, true, false);
|
||||||
}
|
}
|
||||||
sourceListener.onSourceInfoRefreshed(timeline, playlist);
|
sourceListener.onSourceInfoRefreshed(timeline, playlist);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user