avformat/hlsenc: set EXT-X-TARGETDURATION use lrint(EXTINF)
authorKarthick J <kjeyapal@akamai.com>
Thu, 21 Dec 2017 23:43:54 +0000 (07:43 +0800)
committerSteven Liu <lq@chinaffmpeg.org>
Thu, 21 Dec 2017 23:43:54 +0000 (07:43 +0800)
libavformat/hlsenc.c
libavformat/hlsplaylist.h

index 29fc1d4..0095ca4 100644 (file)
@@ -1235,7 +1235,7 @@ 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 = hls_get_int_from_double(en->duration);
+            target_duration = lrint(en->duration);
     }
 
     vs->discontinuity_set = 0;
index 48d71b7..fe19f34 100644 (file)
@@ -36,11 +36,6 @@ typedef enum {
     PLAYLIST_TYPE_NB,
 } PlaylistType;
 
-static inline int hls_get_int_from_double(double val)
-{
-    return (int)((val - (int)val) >= 0.001) ? (int)(val + 1) : (int)val;
-}
-
 void ff_hls_write_playlist_version(AVIOContext *out, int version);
 void ff_hls_write_stream_info(AVStream *st, AVIOContext *out,
                               int bandwidth, char *filename);