[FFmpeg-devel] [PATCH] avformat/hlsenc: program_date_time and append_list flags conflict
Bodecs Bela
bodecsb at vivanet.hu
Sat Jan 18 21:31:13 EET 2020
sorry for missing patch file, here it is.
Bela
2020.01.18. 18:56 keltezéssel, Bodecs Bela írta:
> Dear All,
>
>
> When program_date_time flag is present, in m3u8 playlist file each
> segment has a corresponding EXT-X-PROGRAM-DATE-TIME value. The initial
> program-date-time value is the actual current time at init and
> each new segment increments this value by its duration. When append_list
> flags is also present, existing playlist parsing by hls_append_segment
> treats existing segments as new segments regarding the program-date-time
> calculation. But it should not do that, because this way all the real
> new segments' EXT-X-PROGRAM-DATE-TIME values will be shifted erroneously
> by the sum duration of existing segments. Instead it should have
> decremented the initial program-date-time value by its duration. This
> would ensure that the first new segment's program-date-time value had
> the current time as it is expected.
> This patch corrects this behaviour and prevent existing segments to
> increment the value of initial_prog_date_time variable but decrements
> it.
>
>
> please review this patch!
>
> thank you in advance,
>
> Bela
>
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
-------------- next part --------------
From 7e10fcb0a150259bdb0bf01f3ded7e92ed1447b8 Mon Sep 17 00:00:00 2001
From: Bela Bodecs <bodecsb at vivanet.hu>
Date: Sat, 18 Jan 2020 17:41:55 +0100
Subject: [PATCH] avformat/hlsenc: program_date_time and append_list flags
conflict
When program_date_time flag is present, in m3u8 playlist file each
segment has a corresponding EXT-X-PROGRAM-DATE-TIME value. The intial
program-date-time value is the actual current time at init and
each new segment increments this value by its duration. When append_list
flags is also present, existing playlist parsing by hls_append_segment
treats existing segments as new segments regarding the program-date-time
calculation. But it should not do that, because this way all real the
new segments' EXT-X-PROGRAM-DATE-TIME values will be shifted erroneously
by the sum duration of existing segments. Instead it should have
decremented the initial program-date-time value by its duration. This
would ensure that
the first new segment's program-date-time value had the current time as
it is expected.
This patch corrects this behaviour and prevent existing segments to
increment the value of initial_prog_date_time variable but decrements
it.
Signed-off-by: Bela Bodecs <bodecsb at vivanet.hu>
---
libavformat/hlsenc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 9884f74d51a..7eeb0df48ae 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1130,6 +1130,7 @@ static int parse_playlist(AVFormatContext *s, const char *url, VariantStream *vs
is_segment = 0;
new_start_pos = avio_tell(vs->avf->pb);
vs->size = new_start_pos - vs->start_pos;
+ vs->initial_prog_date_time -= vs->duration; // this is a previously existing segment
ret = hls_append_segment(s, hls, vs, vs->duration, vs->start_pos, vs->size);
if (ret < 0)
goto fail;
--
2.20.1.windows.1
More information about the ffmpeg-devel
mailing list