[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 11:46:05 EEST 2017


>On 9/6/17, 12:37 PM, "Steven Liu" <lingjiujianke at gmail.com<mailto:lingjiujianke at gmail.com>> wrote:
>segment1.ts   duration = 4.880000
>ROUND is 5, not 4,  is it?
>if its duration = 4.040000
>ROUND is 4,   the real segment1.ts duration is 4.040000,
>
>the safe one is TARGETDURATION = 5, the get_int_from_ double API can
>make the truely,

Yes, when duration of segment1.ts is 4.040000, EXTINF duration is 4 when HLS_ROUND_DURATIONS is set. After this patch EXT-X-TARGETDURATION will also be 4(instead of 5), which will be equal to the EXTINF duration and hence there is no violation of spec. And when another segment has duration of 4.880000 both the EXTINF and duration and EXT-X-TARGETDURATION will be 5, still in line with the HLS specification. What is reason to be safe when we know deterministically that EXTINF duration will always be lesser than or equal to EXT-X-TARGETDURATION?

>yes, your patch can make 4.880000 to 5, and make 4.040000 to 4, all
>solution's TARGETDURATION is INT, but just make safe, i know the lrint
>API, so that is why have not use it, not i don't know lrint.

lrint was already being used for EXTINF duration when HLS_ROUND_DURATIONS is set. And this patch kicks in only when HLS_ROUND_DURATIONS is set. It still uses the get_int_from_double API otherwise. This patch still doesn’t affect the default path when EXTINF is not rounded.

Thanks and Regards,
Karthick


More information about the ffmpeg-devel mailing list