Replace IndexOutOfBounds Exception for BehindLiveWindowException
This is a problem when two invocations of getNextChunk that retrieve chunks (i.e. not playlists) occur too apart in time. In that case the last loaded chunk has a media sequence that is behind the current playlist. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=136501291
This commit is contained in:
parent
1cfc432bb8
commit
aecbbdd36c
@ -440,6 +440,10 @@ import java.util.Locale;
|
||||
}
|
||||
HlsMediaPlaylist oldMediaPlaylist = variantPlaylists[oldVariantIndex];
|
||||
HlsMediaPlaylist newMediaPlaylist = variantPlaylists[newVariantIndex];
|
||||
if (previousChunkIndex < oldMediaPlaylist.mediaSequence) {
|
||||
// We have fallen behind the live window.
|
||||
return newMediaPlaylist.mediaSequence - 1;
|
||||
}
|
||||
double offsetToLiveInstantSecs = 0;
|
||||
for (int i = previousChunkIndex - oldMediaPlaylist.mediaSequence;
|
||||
i < oldMediaPlaylist.segments.size(); i++) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user