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
This commit is contained in:
andrewlewis 2016-11-30 09:33:32 -08:00 committed by Oliver Woodman
parent 45c68a2fd5
commit 8dc8104059

View file

@ -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