diff mbox series

[FFmpeg-devel,1/2] avformat/hlsenc: check option before set discont_program_date_time

Message ID 20220508005418.1270-1-lq@chinaffmpeg.org
State New
Headers show
Series [FFmpeg-devel,1/2] avformat/hlsenc: check option before set discont_program_date_time | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Steven Liu May 8, 2022, 12:54 a.m. UTC
fix ticket: 9238
There should check option flags with HLS_PROGRAM_DATE_TIME before
set discont_program_date_time.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
---
 libavformat/hlsenc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index d2b8215dff..d91c7ebcb7 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1288,8 +1288,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 (hls->flags & HLS_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;