mirror of
https://github.com/samsonjs/media.git
synced 2026-03-26 09:35:47 +00:00
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
1 changed files with 4 additions and 0 deletions
|
|
@ -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…
Reference in a new issue