提交 6cc1fec4 编写于 作者: N Nicolas Martyanoff 提交者: 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: NAnssi Hannula <anssi.hannula@iki.fi>
上级 92c29914
......@@ -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");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册