summaryrefslogtreecommitdiff
path: root/libavformat/hlsenc.c
diff options
context:
space:
mode:
authorNicolas Martyanoff <khaelin@gmail.com>2014-07-07 13:26:12 +0200
committerAnssi Hannula <anssi.hannula@iki.fi>2014-07-10 01:31:04 +0300
commit6cc1fec41263add956b35af96d7c4a81c9436a65 (patch)
treeb7164042473fff28203d99c00be7b24402dc8065 /libavformat/hlsenc.c
parent92c29914de3da5776adea361bd3add0c1969b883 (diff)
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@iki.fi>
Diffstat (limited to 'libavformat/hlsenc.c')
-rw-r--r--libavformat/hlsenc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 86447d8151..388a23a18b 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");