[FFmpeg-devel] [PATCH 1/1] avformat/hlsenc: Fix target duration computation when 'round_durations' is enabled

kjeyapal at akamai.com kjeyapal at akamai.com
Fri Sep 1 13:15:19 EEST 2017


From: Karthick J <kjeyapal at akamai.com>

Signed-off-by: Karthick J <kjeyapal at akamai.com>
---
 libavformat/hlsenc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 4a908863..dd36fde 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1,6 +1,7 @@
 /*
  * Apple HTTP Live Streaming segmenter
  * Copyright (c) 2012, Luca Barbato
+ * Copyright (c) 2017 Akamai Technologies, Inc.
  *
  * This file is part of FFmpeg.
  *
@@ -1039,7 +1040,8 @@ static int hls_window(AVFormatContext *s, int last)
 
     for (en = hls->segments; en; en = en->next) {
         if (target_duration <= en->duration)
-            target_duration = get_int_from_double(en->duration);
+            target_duration = (hls->flags & HLS_ROUND_DURATIONS) ?
+                    lrint(en->duration) : get_int_from_double(en->duration);
     }
 
     hls->discontinuity_set = 0;
-- 
1.9.1



More information about the ffmpeg-devel mailing list