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

Jeyapal, Karthick kjeyapal at akamai.com
Wed Sep 6 09:06:11 EEST 2017


Hi Steven,

I am restarting this discussion, just to conclude this thread one way or the other. Maybe I am not thinking correctly. Here is detailed thinking, on why I think this patch will not violate HLS spec.

>        if (target_duration <= en->duration)
>            target_duration = (hls->flags & HLS_ROUND_DURATIONS) ?
>                    lrint(en->duration) : get_int_from_double(en->duration);

As per the above code, target duration will be maximum of all lrint(en->duration) when HLS_ROUND_DURATIONS is set.

>            if (hls->flags & HLS_ROUND_DURATIONS)
>                avio_printf(out, "#EXTINF:%ld,\n",  lrint(en->duration));
>            else
>                avio_printf(out, "#EXTINF:%f,\n", en->duration);

As per this code #EXTINF duration will be lrint(en->duration) when HLS_ROUND_DURATIONS is set.

>https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1
>
>4.3.3.1.  EXT-X-TARGETDURATION
>
>   The EXT-X-TARGETDURATION tag specifies the maximum Media Segment
>   duration.  The EXTINF duration of each Media Segment in the Playlist
>   file, when rounded to the nearest integer, MUST be less than or equal
>   to the target duration; longer segments can trigger playback stalls
>   or other errors.  It applies to the entire Playlist file.  Its format
>   is:
>
>   #EXT-X-TARGETDURATION:<s>
>
>   where s is a decimal-integer indicating the target duration in
>   seconds.  The EXT-X-TARGETDURATION tag is REQUIRED.

As rightly pointed by you, spec says “The EXTINF duration of each Media Segment in the Playlist file, when rounded to the nearest integer, MUST be less than or equal to the target duration”. With this patch this is always true, and hence there is no violation of spec.

Maybe I misunderstood and missing out something very obvious. Could you let me know the situation in which this code will generate target duration lesser than the EXTINF duration? Thanks for your help.

Regards,
Karthick



More information about the ffmpeg-devel mailing list