[FFmpeg-cvslog] avformat/hlsenc: correctly compute target duration

Nicolas Martyanoff git at videolan.org
Thu Jul 10 00:31:35 CEST 2014


ffmpeg | branch: master | Nicolas Martyanoff <khaelin at gmail.com> | Mon Jul  7 13:26:12 2014 +0200| [6cc1fec41263add956b35af96d7c4a81c9436a65] | committer: Anssi Hannula

avformat/hlsenc: correctly compute target duration

With HLS, the duration of all segments must be lower or equal to the target
duration. Therefore floor(duration + 0.5) yields incorrect results.

For example, for duration = 1.35, floor(duration + 0.5) yields 1.0, but the
correct result is 2.0.

Signed-off-by: Anssi Hannula <anssi.hannula at iki.fi>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6cc1fec41263add956b35af96d7c4a81c9436a65
---

 libavformat/hlsenc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 86447d8..388a23a 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -141,7 +141,7 @@ static int hls_window(AVFormatContext *s, int last)
 
     for (en = hls->list; en; en = en->next) {
         if (target_duration < en->duration)
-            target_duration = (int) floor(en->duration + 0.5);
+            target_duration = ceil(en->duration);
     }
 
     avio_printf(hls->pb, "#EXTM3U\n");



More information about the ffmpeg-cvslog mailing list