Allow regressing media sequence numbers in HLS media playlists

This is techically not allowed by the spec[1] but might still occur in
certain scenarios. New playlists with older media sequence numbers are
ignored.

[1]: HLS draft version 20, section-6.2.1

Issue:#2059

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=139564889
This commit is contained in:
aquilescanta 2016-11-18 03:30:44 -08:00 committed by Oliver Woodman
parent d890c2f48f
commit cafe603694

View file

@ -311,6 +311,10 @@ public final class HlsPlaylistTracker implements Loader.Callback<ParsingLoadable
// Playlist has not changed.
return oldPlaylist;
}
if (mediaSequenceOffset < 0) {
// Playlist has changed but media sequence has regressed.
return oldPlaylist;
}
if (mediaSequenceOffset <= oldPlaylistSize) {
// We can extrapolate the start time of new segments from the segments of the old snapshot.
ArrayList<HlsMediaPlaylist.Segment> newSegments = new ArrayList<>(newPlaylistSize);