17

I'm inspecting about #EXT-X-DISCONTINUITY-SEQUENCE tag in m3u8 file of HLS. (https://datatracker.ietf.org/doc/html/draft-pantos-http-live-streaming-23#section-4.3.3.3) Does somebody can explain the working way of it?

For example, let's suppose that m3u8 file is made for live streaming like below, After 2 seconds segment1.060.ts, file.000.ts will be gone from list and #EXT-X-DISCONTINUITY tag too. after all file.001.ts is going to be first media segment in the list.

At this state, what sequence number should be in #EXT-X-MEDIA-SEQUENCE, #EXT-X-DISCONTINUITY-SEQUENCE? #EXT-X-DISCONTINUITY should be put in front of file.001.ts line again?

#EXTM3U
#EXT-X-VERSION:6
#EXT-X-MEDIA-SEQUENCE:60
#EXT-X-DISCONTINUITY-SEQUENCE:0
#EXT-X-ALLOW-CACHE:NO
#EXT-X-TARGETDURATION:2

#EXTINF:0.933600,
segment1.060.ts

#EXT-X-DISCONTINUITY
#EXTINF:0.966911,
file.000.ts

#EXTINF:1.000489,
file.001.ts
Community
  • 1
  • 1
swj
  • 179
  • 1
  • 1
  • 4

1 Answers1

18

The reason why EXT-X-DISCONTINUITY-SEQUENCE must be used for synchronization across variants is explained in the standard:

A client MUST NOT assume that segments with the same Media Sequence Number in different Media Playlists contain matching content

and

A client MUST NOT assume that segments with the same Media Sequence Number in different Variant Streams or Renditions have the same position in the presentation; Playlists MAY have independent Media Sequence Numbers. Instead, a client MUST use the relative position of each segment on the Playlist timeline and its Discontinuity Sequence Number to locate corresponding segments.

Back to your question:

  • EXT-X-DISCONTINUITY marks a discontinuity between two consecutive segments. Your discontinuity is between segment1.060.ts and file.000.ts. There is no discontinuity between file.000.ts and file.001.ts so no need to re-insert the tag
  • each time you remove a EXT-X-DISCONTINUITY from the playlist you must increment the EXT-X-DISCONTINUITY-SEQUENCE
  • each time you remove a segment from the playlist you must increment the EXT-X-MEDIA-SEQUENCE
aergistal
  • 29,947
  • 5
  • 70
  • 92
  • As the way I understood, the below is correct? (after 2s) **#EXT-X-MEDIA-SEQUENCE:62, #EXT-X-DISCONTINUITY-SEQUENCE:1** (after 3s) **#EXT-X-MEDIA-SEQUENCE:63, #EXT-X-DISCONTINUITY-SEQUENCE:1** (after 4s) **#EXT-X-MEDIA-SEQUENCE:64, #EXT-X-DISCONTINUITY-SEQUENCE:1** Thanks for your concern on my q. – swj Nov 01 '17 at 11:13
  • Thanks for the clear explanation. From 4.3.3.3 in the spec, it indicates that EXT-X-DISCONTINUITY-SEQUENCE will always be assumed to be 0 on the first media segment if the tag is not present. If I am understanding correctly, we can imply that the value of the EXT-X-DISCONTINUITY-SEQUENCE tag will ALWAYS be constant across all variant streams (please correct me if I am wrong). – spencer May 14 '19 at 18:16