[FFmpeg-devel] [PATCH] lavf/segment: fix computation of M3U8 segment target duration

Stefano Sabatini stefasab at gmail.com
Sat Aug 18 22:51:04 CEST 2012


On date Saturday 2012-08-18 22:39:27 +0200, Clément Bœsch encoded:
> On Sat, Aug 18, 2012 at 10:35:45PM +0200, Stefano Sabatini wrote:
> > Use ceil on the max duration, rather than approximating it to the nearest
> > integer.
> > ---
> >  libavformat/segment.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/libavformat/segment.c b/libavformat/segment.c
> > index db96a41..e148dc0 100644
> > --- a/libavformat/segment.c
> > +++ b/libavformat/segment.c
> > @@ -139,7 +139,7 @@ static void segment_list_close(AVFormatContext *s)
> >  
> >      if (seg->list_type == LIST_TYPE_M3U8) {
> >          avio_printf(seg->list_pb, "#EXT-X-TARGETDURATION:%d\n",
> > -                    (int)(seg->list_max_segment_time + 0.5));
> > +                    (int)ceil(seg->list_max_segment_time));
> >          avio_printf(seg->list_pb, "#EXT-X-ENDLIST\n");
> >      }
> 
> 
> Don't forget to #include <math.h>, otherwise LGTM, thanks

It is included by libavutil/mathematics.h, included by etc. etc.

Patch pushed (I was not sure about the use/portability of ceil(), but I
see is used in other places in lavu). Thanks.
-- 
FFmpeg = Formidable and Fanciful Martial Portable Entertaining Genius


More information about the ffmpeg-devel mailing list