[FFmpeg-devel] [PATCH 2/2] hlsenc: set target duration always exact or longer than max segment duration

Steven Liu lingjiujianke at gmail.com
Sat Mar 24 07:35:49 EET 2018


2018-03-24 6:42 GMT+08:00 Jan Ekström <jeebjp at gmail.com>:
> From: Jan Ekström <jan.ekstrom at aminocom.com>
>
> Follows the RFC with floating point durations.
> F.ex., 5.005 => 6
>
> Signed-off-by: Jan Ekström <jan.ekstrom at aminocom.com>
> ---
>  libavformat/hlsenc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 07569dbff1..ecb581acb9 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -1386,7 +1386,8 @@ static int hls_window(AVFormatContext *s, int last, VariantStream *vs)
>
>      for (en = vs->segments; en; en = en->next) {
>          if (target_duration <= en->duration)
> -            target_duration = lrint(en->duration);
> +            /* Target duration has to always be exactly or longer than any segment */
> +            target_duration = ceil(en->duration);
This is not correct, at the specification author said, the duration
should set to 5, not 6, reference link
:https://trac.ffmpeg.org/ticket/6915

Thanks

Steven


More information about the ffmpeg-devel mailing list