mirror of
https://github.com/samsonjs/media.git
synced 2026-03-26 09:35:47 +00:00
Update HLS window duration with trailing parts.
If we have trailing parts the available window should reach to the end of all trailing parts and not only to the last finished segment. Issue: #5011 PiperOrigin-RevId: 347996626
This commit is contained in:
parent
7027e75ce8
commit
490519a49a
2 changed files with 7 additions and 4 deletions
|
|
@ -536,7 +536,6 @@ public final class HlsMediaSource extends BaseMediaSource
|
|||
} else if (windowDefaultStartPositionUs == C.TIME_UNSET) {
|
||||
windowDefaultStartPositionUs = 0;
|
||||
}
|
||||
|
||||
timeline =
|
||||
new SinglePeriodTimeline(
|
||||
presentationStartTimeMs,
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import com.google.android.exoplayer2.drm.DrmInitData;
|
|||
import com.google.android.exoplayer2.offline.StreamKey;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Iterables;
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
|
@ -475,9 +476,12 @@ public final class HlsMediaPlaylist extends HlsPlaylist {
|
|||
this.skippedSegmentCount = skippedSegmentCount;
|
||||
this.trailingParts = ImmutableList.copyOf(trailingParts);
|
||||
this.renditionReports = ImmutableMap.copyOf(renditionReports);
|
||||
if (!segments.isEmpty()) {
|
||||
Segment last = segments.get(segments.size() - 1);
|
||||
durationUs = last.relativeStartTimeUs + last.durationUs;
|
||||
if (!trailingParts.isEmpty()) {
|
||||
Part lastPart = Iterables.getLast(trailingParts);
|
||||
durationUs = lastPart.relativeStartTimeUs + lastPart.durationUs;
|
||||
} else if (!segments.isEmpty()) {
|
||||
Segment lastSegment = Iterables.getLast(segments);
|
||||
durationUs = lastSegment.relativeStartTimeUs + lastSegment.durationUs;
|
||||
} else {
|
||||
durationUs = 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue