Commit aecbbdd3 by aquilescanta Committed by Oliver Woodman

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
parent 1cfc432b
...@@ -440,6 +440,10 @@ import java.util.Locale; ...@@ -440,6 +440,10 @@ import java.util.Locale;
} }
HlsMediaPlaylist oldMediaPlaylist = variantPlaylists[oldVariantIndex]; HlsMediaPlaylist oldMediaPlaylist = variantPlaylists[oldVariantIndex];
HlsMediaPlaylist newMediaPlaylist = variantPlaylists[newVariantIndex]; HlsMediaPlaylist newMediaPlaylist = variantPlaylists[newVariantIndex];
if (previousChunkIndex < oldMediaPlaylist.mediaSequence) {
// We have fallen behind the live window.
return newMediaPlaylist.mediaSequence - 1;
}
double offsetToLiveInstantSecs = 0; double offsetToLiveInstantSecs = 0;
for (int i = previousChunkIndex - oldMediaPlaylist.mediaSequence; for (int i = previousChunkIndex - oldMediaPlaylist.mediaSequence;
i < oldMediaPlaylist.segments.size(); i++) { i < oldMediaPlaylist.segments.size(); i++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment