]> git.sesse.net Git - ffmpeg/commit
avformat/hls: Fixes overwriting existing #EXT-X-PROGRAM-DATE-TIME value in HLS playlist
authorVignesh Ravichandran <vignesh.ravichandran02@gmail.com>
Tue, 1 Dec 2020 10:10:40 +0000 (15:40 +0530)
committerliuqi05 <liuqi05@kuaishou.com>
Tue, 8 Dec 2020 12:57:24 +0000 (20:57 +0800)
commit45a673ebee2e603a87c0ecb259c0027c14321018
tree0c5e1e41d45426928bad9d9df001781b86831244
parent18befac5da2c71aeb9922b6fd5551502f4c5a913
avformat/hls: Fixes overwriting existing #EXT-X-PROGRAM-DATE-TIME value in HLS playlist

fix ticket: 8989

This is is due to the following behavior in the current code:
1. The initial_prog_date_time gets set to the current local time
2. The existing playlist (.m3u8) file gets parsed and the segments
   present are added to the variant stream
3. The new segment is created and added
4. The existing segments and the new segment are written to the
   playlist file. The initial_prog_date_time from point 1 is used
   for calculating "#EXT-X-PROGRAM-DATE-TIME" for the segments,
   which results in incorrect "#EXT-X-PROGRAM-DATE-TIME" values
   for existing segments
The following approach fixes this bug:
1. Add a new variable "discont_program_date_time" of type double
   to HLSSegment struct
2. Store the "EXT-X-PROGRAM-DATE-TIME" value from the existing
   segments in this variable
3. When writing to playlist file if "discont_program_date_time"
   is set, then use that value for "EXT-X-PROGRAM-DATE-TIME" else
   use the value present in vs->initial_prog_date_time

Signed-off-by: Vignesh Ravichandran <vignesh.ravichandran02@gmail.com>
Signed-off-by: liuqi05 <liuqi05@kuaishou.com>
libavformat/hlsenc.c