hls/m3u8: Fix starting segment for live playlist
authorEdward Hervey <edward@centricular.com>
Thu, 21 Apr 2022 09:47:55 +0000 (11:47 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Fri, 22 Apr 2022 08:06:27 +0000 (08:06 +0000)
commit964ee0299dfe91f4e77e8399405870e3d6d27345
tree8183b1ae32ebd04423376f0772137edb51fab947
parentd824698561f7c3204cae339b227224d61fc4e209
hls/m3u8: Fix starting segment for live playlist

RFC 8216 6.3.3 "Playing the Media Playlist File" : states that for live media
playlists "the client SHOULD NOT choose a segment that starts less than three
target durations from the end of the Playlist file"

This is an off-by-one error. Since we are looking for the "index" of the
segment, we need to subtract 1 from the searched position.

Ex: For a playlist with 12 entries, we want to start playback on the 9th segment
... which is at index 8.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2259>
subprojects/gst-plugins-good/ext/adaptivedemux2/hls/m3u8.c