[FFmpeg-devel] [PATCH] avformat/dashenc: Fix the EXT-X-TARGETDURATION as per the hls specification

Steven Liu lingjiujianke at gmail.com
Fri Dec 22 01:37:46 EET 2017


2017-12-21 18:09 GMT+08:00 Karthick J <kjeyapal at akamai.com>:
> From: Karthick Jeyapal <kjeyapal at akamai.com>
>
> The HLS specification states the following about EXT-X-TARGETDURATION
>
> 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.
>
> Currently the dashenc rounds the duration to the next integer,
> rather than rounding the duration to the nearest integer.
> ---
>  libavformat/dashenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
> index 5687530..5368a23 100644
> --- a/libavformat/dashenc.c
> +++ b/libavformat/dashenc.c
> @@ -358,7 +358,7 @@ static void output_segment_list(OutputStream *os, AVIOContext *out, DASHContext
>              Segment *seg = os->segments[i];
>              double duration = (double) seg->duration / timescale;
>              if (target_duration <= duration)
> -                target_duration = hls_get_int_from_double(duration);
> +                target_duration = lrint(duration);
>          }
>
>          ff_hls_write_playlist_header(out_hls, 6, -1, target_duration,
> --
> 1.9.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


LGTM, I have checked from HLS Team, Set the EXT-X-TARGETDURATION by
print(EXTINF).


Thanks


More information about the ffmpeg-devel mailing list