summaryrefslogtreecommitdiff
path: root/libavformat/hlsenc.c
diff options
context:
space:
mode:
authorSteven Liu <lq@chinaffmpeg.org>2022-05-08 09:15:40 +0800
committerSteven Liu <lq@chinaffmpeg.org>2022-05-12 16:21:27 +0800
commitea6ed838c3fe0e2462163d35cbbed772f4bcff9f (patch)
treead899e37f7841fe9e5329cad3b677b77ecb6500f /libavformat/hlsenc.c
parent439ca8b5f4e3488ab9b5e8398e0d706c94d4357a (diff)
avformat/hlsenc: check discont_program_date_time before use it in parse_playlist
Fix ticket: 9238 In parse_playlist, the discont_program_date_time should be used after EXT-X-PROGRAM-DATE-TIME tag parsed. Tested-by: pero Reviewed-by: Zhao Zhili <zhilizhao@tencent.com> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
Diffstat (limited to 'libavformat/hlsenc.c')
-rw-r--r--libavformat/hlsenc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 5561be0588..3bafddfa61 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1286,8 +1286,10 @@ static int parse_playlist(AVFormatContext *s, const char *url, VariantStream *vs
new_start_pos = avio_tell(vs->avf->pb);
vs->size = new_start_pos - vs->start_pos;
ret = hls_append_segment(s, hls, vs, vs->duration, vs->start_pos, vs->size);
- vs->last_segment->discont_program_date_time = discont_program_date_time;
- discont_program_date_time += vs->duration;
+ if (discont_program_date_time) {
+ vs->last_segment->discont_program_date_time = discont_program_date_time;
+ discont_program_date_time += vs->duration;
+ }
if (ret < 0)
goto fail;
vs->start_pos = new_start_pos;