Skip to content

HLS media sequence resets make the player get stuck in buffering state #2872

@yueyueniao2012

Description

@yueyueniao2012

Issue description

@AquilesCanta
I meet this issue with this url:
http://live.hkstv.hk.lxdns.com/live/hks/playlist.m3u8.
This video play stuck buffering in random time and never come back to ready.
This issue will always appear on any device when playing a little bit longer time.Through the analysis of a period of time I find the issue is that sometime this live stream http://live.hkstv.hk.lxdns.com/live/hks/playlist.m3u8 HlsMediaPlaylist's mediaSequence suddenly change to start from zero.This behavior leads to HlsPlaylistTracker's func getLatestPlaylistSnapshot always return oldPlaylist,so the Exoplayer stuck at buffering.I think in this case the player should continue to play the live stream or throw an exception and not stuck at buffering.

private HlsMediaPlaylist getLatestPlaylistSnapshot(HlsMediaPlaylist oldPlaylist,
      HlsMediaPlaylist loadedPlaylist) {
    if (!loadedPlaylist.isNewerThan(oldPlaylist)) {
      if (loadedPlaylist.hasEndTag) {
        // If the loaded playlist has an end tag but is not newer than the old playlist then we have
        // an inconsistent state. This is typically caused by the server incorrectly resetting the
        // media sequence when appending the end tag. We resolve this case as best we can by
        // returning the old playlist with the end tag appended.
        return oldPlaylist.copyWithEndTag();
      } else {
        return oldPlaylist;
      }
    }
    long startTimeUs = getLoadedPlaylistStartTimeUs(oldPlaylist, loadedPlaylist);
    int discontinuitySequence = getLoadedPlaylistDiscontinuitySequence(oldPlaylist, loadedPlaylist);
    return loadedPlaylist.copyWith(startTimeUs, discontinuitySequence);
  }

Reproduction steps

Play this url http://live.hkstv.hk.lxdns.com/live/hks/playlist.m3u8 with a little bit longer time.

Version of ExoPlayer being used

latest

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions