From 5b0e693419c189f76cd0822fb6168311c660658b Mon Sep 17 00:00:00 2001 From: olly Date: Tue, 19 Sep 2017 07:44:46 -0700 Subject: [PATCH] Fix DefaultDashChunkSource.updateLiveEdgeTimeUs Very subtle, but lastAvailableSegmentNum is shifted by RepresentationHolder.segmentNumShift. When accessing the index directly it's necessary to unshift. The easiest way to do this is to call through the holder, which does this for you. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=169239928 --- .../source/dash/DefaultDashChunkSource.java | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DefaultDashChunkSource.java b/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DefaultDashChunkSource.java index cd7ef6a2bf..eba36e9057 100644 --- a/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DefaultDashChunkSource.java +++ b/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DefaultDashChunkSource.java @@ -317,15 +317,8 @@ public class DefaultDashChunkSource implements DashChunkSource { private void updateLiveEdgeTimeUs(RepresentationHolder representationHolder, int lastAvailableSegmentNum) { - if (manifest.dynamic) { - DashSegmentIndex segmentIndex = representationHolder.representation.getIndex(); - long lastSegmentDurationUs = segmentIndex.getDurationUs(lastAvailableSegmentNum, - manifest.getPeriodDurationUs(periodIndex)); - liveEdgeTimeUs = segmentIndex.getTimeUs(lastAvailableSegmentNum) - + lastSegmentDurationUs; - } else { - liveEdgeTimeUs = C.TIME_UNSET; - } + liveEdgeTimeUs = manifest.dynamic + ? representationHolder.getSegmentEndTimeUs(lastAvailableSegmentNum) : C.TIME_UNSET; } private long getNowUnixTimeUs() {