[FFmpeg-cvslog] avformat/hlsenc: increase initial program date time precision
Marton Balint
git at videolan.org
Thu Jul 30 00:11:22 EEST 2020
ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Sat Jul 18 23:57:42 2020 +0200| [b2318c1e537f15c4c23f302a5193d6218dffdde8] | committer: Marton Balint
avformat/hlsenc: increase initial program date time precision
Also query time only once, not for every variant stream, otherwise variant
streams might get a slightly different initial program date time. And we can
set this unconditionally because HLS_PROGRAM_DATE_TIME flag is checked
elsewhere.
Signed-off-by: Marton Balint <cus at passwd.hu>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b2318c1e537f15c4c23f302a5193d6218dffdde8
---
libavformat/hlsenc.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index df84e6487d..39ff1fa1e7 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -2704,6 +2704,7 @@ static int hls_init(AVFormatContext *s)
char *p = NULL;
int http_base_proto = ff_is_http_proto(s->url);
int fmp4_init_filename_len = strlen(hls->fmp4_init_filename) + 1;
+ double initial_program_date_time = av_gettime() / 1000000.0;
if (hls->use_localtime) {
pattern = get_default_pattern_localtime_fmt(s);
@@ -2798,12 +2799,7 @@ static int hls_init(AVFormatContext *s)
vs->start_pts = AV_NOPTS_VALUE;
vs->end_pts = AV_NOPTS_VALUE;
vs->current_segment_final_filename_fmt[0] = '\0';
-
- if (hls->flags & HLS_PROGRAM_DATE_TIME) {
- time_t now0;
- time(&now0);
- vs->initial_prog_date_time = now0;
- }
+ vs->initial_prog_date_time = initial_program_date_time;
for (j = 0; j < vs->nb_streams; j++) {
vs->has_video += vs->streams[j]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO;
More information about the ffmpeg-cvslog
mailing list