Fix second sync point calculation for unbounded live streams.

We currently use INDEX_UNBOUNDED for the calculation and don't
offset the index by the firstSegmentNum if not unbounded.

PiperOrigin-RevId: 348445797
This commit is contained in:
tonihei 2020-12-21 12:11:39 +00:00 committed by Oliver Woodman
parent 686d11de1b
commit 696bb34ac6

View file

@ -195,8 +195,12 @@ public class DefaultDashChunkSource implements DashChunkSource {
if (representationHolder.segmentIndex != null) {
long segmentNum = representationHolder.getSegmentNum(positionUs);
long firstSyncUs = representationHolder.getSegmentStartTimeUs(segmentNum);
int segmentCount = representationHolder.getSegmentCount();
long secondSyncUs =
firstSyncUs < positionUs && segmentNum < representationHolder.getSegmentCount() - 1
firstSyncUs < positionUs
&& (segmentCount == DashSegmentIndex.INDEX_UNBOUNDED
|| segmentNum
< representationHolder.getFirstSegmentNum() + segmentCount - 1)
? representationHolder.getSegmentStartTimeUs(segmentNum + 1)
: firstSyncUs;
return seekParameters.resolveSeekPositionUs(positionUs, firstSyncUs, secondSyncUs);