Prevent index out of bounds exceptions in some live HLS scenarios
Can happen if the load position falls behind in every playlist and when we try to load the next segment, the adaptive selection logic decides to change variant. Issue:#5816 PiperOrigin-RevId: 245923006
This commit is contained in:
parent
802ebc8db1
commit
f64011ae04
@ -112,6 +112,8 @@
|
|||||||
([#5441](https://github.com/google/ExoPlayer/issues/5441)).
|
([#5441](https://github.com/google/ExoPlayer/issues/5441)).
|
||||||
* Parse `EXT-X-MEDIA` `CHARACTERISTICS` attribute into `Format.roleFlags`.
|
* Parse `EXT-X-MEDIA` `CHARACTERISTICS` attribute into `Format.roleFlags`.
|
||||||
* Add metadata entry for HLS tracks to expose master playlist information.
|
* Add metadata entry for HLS tracks to expose master playlist information.
|
||||||
|
* Prevent `IndexOutOfBoundsException` in some live HLS scenarios
|
||||||
|
([#5816](https://github.com/google/ExoPlayer/issues/5816)).
|
||||||
* Support for playing spherical videos on Daydream.
|
* Support for playing spherical videos on Daydream.
|
||||||
* Cast extension: Work around Cast framework returning a limited-size queue
|
* Cast extension: Work around Cast framework returning a limited-size queue
|
||||||
items list ([#4964](https://github.com/google/ExoPlayer/issues/4964)).
|
items list ([#4964](https://github.com/google/ExoPlayer/issues/4964)).
|
||||||
|
@ -278,8 +278,7 @@ import java.util.Map;
|
|||||||
long chunkMediaSequence =
|
long chunkMediaSequence =
|
||||||
getChunkMediaSequence(
|
getChunkMediaSequence(
|
||||||
previous, switchingTrack, mediaPlaylist, startOfPlaylistInPeriodUs, loadPositionUs);
|
previous, switchingTrack, mediaPlaylist, startOfPlaylistInPeriodUs, loadPositionUs);
|
||||||
if (chunkMediaSequence < mediaPlaylist.mediaSequence) {
|
if (chunkMediaSequence < mediaPlaylist.mediaSequence && previous != null && switchingTrack) {
|
||||||
if (previous != null && switchingTrack) {
|
|
||||||
// We try getting the next chunk without adapting in case that's the reason for falling
|
// We try getting the next chunk without adapting in case that's the reason for falling
|
||||||
// behind the live window.
|
// behind the live window.
|
||||||
selectedTrackIndex = oldTrackIndex;
|
selectedTrackIndex = oldTrackIndex;
|
||||||
@ -289,11 +288,12 @@ import java.util.Map;
|
|||||||
startOfPlaylistInPeriodUs =
|
startOfPlaylistInPeriodUs =
|
||||||
mediaPlaylist.startTimeUs - playlistTracker.getInitialStartTimeUs();
|
mediaPlaylist.startTimeUs - playlistTracker.getInitialStartTimeUs();
|
||||||
chunkMediaSequence = previous.getNextChunkIndex();
|
chunkMediaSequence = previous.getNextChunkIndex();
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if (chunkMediaSequence < mediaPlaylist.mediaSequence) {
|
||||||
fatalError = new BehindLiveWindowException();
|
fatalError = new BehindLiveWindowException();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
int segmentIndexInPlaylist = (int) (chunkMediaSequence - mediaPlaylist.mediaSequence);
|
int segmentIndexInPlaylist = (int) (chunkMediaSequence - mediaPlaylist.mediaSequence);
|
||||||
if (segmentIndexInPlaylist >= mediaPlaylist.segments.size()) {
|
if (segmentIndexInPlaylist >= mediaPlaylist.segments.size()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user