From 8dc810405964770fe227a333b1b4d0f3fdfef0a3 Mon Sep 17 00:00:00 2001 From: andrewlewis Date: Wed, 30 Nov 2016 09:33:32 -0800 Subject: [PATCH] Load the next period only if its start point is known. If a period has no enabled tracks it is considered to be fully buffered, even if its duration is unknown. This would cause the offset of the next loading period to be set based on the unset duration of the preceding period, in turn causing the from of the player to expose a position based on an unset value. Only load the next period when the current one has a known duration. If a period has no enabled tracks and an unknown duration this causes the player to play the period indefinitely. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=140613858 --- .../com/google/android/exoplayer2/ExoPlayerImplInternal.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/library/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java b/library/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java index 0e0c30ffc0..1c82130131 100644 --- a/library/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java +++ b/library/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java @@ -1068,8 +1068,9 @@ import java.io.IOException; } if (loadingPeriodHolder == null - || (loadingPeriodHolder.isFullyBuffered() && !loadingPeriodHolder.isLast - && (playingPeriodHolder == null + || (loadingPeriodHolder.isFullyBuffered() + && timeline.getPeriod(loadingPeriodHolder.index, period).getDurationUs() != C.TIME_UNSET + && !loadingPeriodHolder.isLast && (playingPeriodHolder == null || loadingPeriodHolder.index - playingPeriodHolder.index < MAXIMUM_BUFFER_AHEAD_PERIODS))) { // We don't have a loading period or it's fully loaded, so try and create the next one. int newLoadingPeriodIndex = loadingPeriodHolder == null ? playbackInfo.periodIndex