diff --git a/library/src/main/java/com/google/android/exoplayer2/source/dash/manifest/SegmentBase.java b/library/src/main/java/com/google/android/exoplayer2/source/dash/manifest/SegmentBase.java index ef319d508d7..70a65e932af 100644 --- a/library/src/main/java/com/google/android/exoplayer2/source/dash/manifest/SegmentBase.java +++ b/library/src/main/java/com/google/android/exoplayer2/source/dash/manifest/SegmentBase.java @@ -143,7 +143,7 @@ public int getSegmentNum(long timeUs, long periodDurationUs) { } else { // The high index cannot be unbounded. Identify the segment using binary search. while (lowIndex <= highIndex) { - int midIndex = (lowIndex + highIndex) / 2; + int midIndex = lowIndex + (highIndex - lowIndex) / 2; long midTimeUs = getSegmentTimeUs(midIndex); if (midTimeUs < timeUs) { lowIndex = midIndex + 1;