Skip to content

Commit

Permalink
Add timeline size check to avoid IndexOutOfBoundsException.
Browse files Browse the repository at this point in the history
Closes google#1865.
  • Loading branch information
Johannes Schamburger committed Feb 14, 2017
1 parent 6a844eb commit 976e3ba
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public int getSegmentNum(long timeUs, long periodDurationUs) {
* @see DashSegmentIndex#getDurationUs(int, long)
*/
public final long getSegmentDurationUs(int sequenceNumber, long periodDurationUs) {
if (segmentTimeline != null) {
if (segmentTimeline != null && segmentTimeline.size() > sequenceNumber - startNumber) {
long duration = segmentTimeline.get(sequenceNumber - startNumber).duration;
return (duration * C.MICROS_PER_SECOND) / timescale;
} else {
Expand Down

0 comments on commit 976e3ba

Please sign in to comment.