From: Jun Zhao <barryjz...@tencent.com>

fix hls muxer time drifts from the actual clock time, based on
Pavel Pilar's fix.

fix: Ticket7986

Signed-off-by: Pavel Pilar <pilar...@centrum.cz>
Signed-off-by: Jun Zhao <barryjz...@tencent.com>
---
 libavformat/hlsenc.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 4abc728..110d114 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -42,6 +42,7 @@
 #include "libavutil/opt.h"
 #include "libavutil/log.h"
 #include "libavutil/time_internal.h"
+#include "libavutil/time.h"
 
 #include "avformat.h"
 #include "avio_internal.h"
@@ -2741,11 +2742,9 @@ static int hls_init(AVFormatContext *s)
                    "Disabling 'independent_segments' flag\n");
         }
 
-        if (hls->flags & HLS_PROGRAM_DATE_TIME) {
-            time_t now0;
-            time(&now0);
-            vs->initial_prog_date_time = now0;
-        }
+        if (hls->flags & HLS_PROGRAM_DATE_TIME)
+            vs->initial_prog_date_time = av_gettime() * 0.000001; // 
microseconds to seconds
+
         if (hls->format_options_str) {
             ret = av_dict_parse_string(&hls->format_options, 
hls->format_options_str, "=", ":", 0);
             if (ret < 0) {
-- 
1.7.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to