Search in sources :

Example 6 with HlsMediaPlaylist

use of com.google.android.exoplayer2.source.hls.playlist.HlsMediaPlaylist in project ExoPlayer by google.

the class HlsPlaylistTracker method getLoadedPlaylistDiscontinuitySequence.

private int getLoadedPlaylistDiscontinuitySequence(HlsMediaPlaylist oldPlaylist, HlsMediaPlaylist loadedPlaylist) {
    if (loadedPlaylist.hasDiscontinuitySequence) {
        return loadedPlaylist.discontinuitySequence;
    }
    // TODO: Improve cross-playlist discontinuity adjustment.
    int primaryUrlDiscontinuitySequence = primaryUrlSnapshot != null ? primaryUrlSnapshot.discontinuitySequence : 0;
    if (oldPlaylist == null) {
        return primaryUrlDiscontinuitySequence;
    }
    Segment firstOldOverlappingSegment = getFirstOldOverlappingSegment(oldPlaylist, loadedPlaylist);
    if (firstOldOverlappingSegment != null) {
        return oldPlaylist.discontinuitySequence + firstOldOverlappingSegment.relativeDiscontinuitySequence - loadedPlaylist.segments.get(0).relativeDiscontinuitySequence;
    }
    return primaryUrlDiscontinuitySequence;
}
Also used : Segment(com.google.android.exoplayer2.source.hls.playlist.HlsMediaPlaylist.Segment)

Aggregations

Segment (com.google.android.exoplayer2.source.hls.playlist.HlsMediaPlaylist.Segment)5 Uri (android.net.Uri)2 ParserException (com.google.android.exoplayer2.ParserException)1 BehindLiveWindowException (com.google.android.exoplayer2.source.BehindLiveWindowException)1 SinglePeriodTimeline (com.google.android.exoplayer2.source.SinglePeriodTimeline)1 HlsUrl (com.google.android.exoplayer2.source.hls.playlist.HlsMasterPlaylist.HlsUrl)1 HlsMediaPlaylist (com.google.android.exoplayer2.source.hls.playlist.HlsMediaPlaylist)1 DataSpec (com.google.android.exoplayer2.upstream.DataSpec)1 TimestampAdjuster (com.google.android.exoplayer2.util.TimestampAdjuster)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1