Schedule load for non-primary playlist for low latency streams

Low latency streams potentially need to remove preload chunks in case they are removed from the playlist. Hence we need to schedule loading the next playlist even if the playlist is not a primary playlist.

Issue: #5011
PiperOrigin-RevId: 344995891
This commit is contained in:
bachinger 2020-12-01 12:42:56 +00:00 committed by Oliver Woodman
parent c7e1d3f222
commit 1a5d79b78a

View File

@ -716,10 +716,13 @@ public final class DefaultHlsPlaylistTracker
: (playlistSnapshot.targetDurationUs / 2); : (playlistSnapshot.targetDurationUs / 2);
} }
earliestNextLoadTimeMs = currentTimeMs + C.usToMs(durationUntilNextLoadUs); earliestNextLoadTimeMs = currentTimeMs + C.usToMs(durationUntilNextLoadUs);
// Schedule a load if this is the primary playlist and it doesn't have an end tag. Else the // Schedule a load if this is the primary playlist or a playlist of a low-latency stream and
// next load will be scheduled when refreshPlaylist is called, or when this playlist becomes // it doesn't have an end tag. Else the next load will be scheduled when refreshPlaylist is
// the primary. // called, or when this playlist becomes the primary.
if (playlistUrl.equals(primaryMediaPlaylistUrl) && !playlistSnapshot.hasEndTag) { boolean scheduleLoad =
playlistSnapshot.partTargetDurationUs != C.TIME_UNSET
|| playlistUrl.equals(primaryMediaPlaylistUrl);
if (scheduleLoad && !playlistSnapshot.hasEndTag) {
loadPlaylistInternal(getMediaPlaylistUriForReload()); loadPlaylistInternal(getMediaPlaylistUriForReload());
} }
} }