Skip to content

Commit

Permalink
Make DefaultDashChunkSource more robust against empty segment timelines
Browse files Browse the repository at this point in the history
Segment timelines are technically allowed to be empty, but not all places
add the necessary checks.

Issue: google/ExoPlayer#11014
PiperOrigin-RevId: 514722205
(cherry picked from commit 788132b)
  • Loading branch information
tonihei authored and rohitjoins committed Apr 18, 2023
1 parent 4666d57 commit a94fb21
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,12 @@ public long getAdjustedSeekPositionUs(long positionUs, SeekParameters seekParame
// Segments are aligned across representations, so any segment index will do.
for (RepresentationHolder representationHolder : representationHolders) {
if (representationHolder.segmentIndex != null) {
long segmentCount = representationHolder.getSegmentCount();
if (segmentCount == 0) {
continue;
}
long segmentNum = representationHolder.getSegmentNum(positionUs);
long firstSyncUs = representationHolder.getSegmentStartTimeUs(segmentNum);
long segmentCount = representationHolder.getSegmentCount();
long secondSyncUs =
firstSyncUs < positionUs
&& (segmentCount == DashSegmentIndex.INDEX_UNBOUNDED
Expand Down Expand Up @@ -594,7 +597,7 @@ private ArrayList<Representation> getRepresentations() {
}

private long getAvailableLiveDurationUs(long nowUnixTimeUs, long playbackPositionUs) {
if (!manifest.dynamic) {
if (!manifest.dynamic || representationHolders[0].getSegmentCount() == 0) {
return C.TIME_UNSET;
}
long lastSegmentNum = representationHolders[0].getLastAvailableSegmentNum(nowUnixTimeUs);
Expand Down

0 comments on commit a94fb21

Please sign in to comment.