hlsenc: Don't reset the number variable when wrapping
authorCarl Eugen Hoyos <cehoyos@ag.or.at>
Thu, 6 Jun 2013 10:09:38 +0000 (12:09 +0200)
committerMartin Storsjö <martin@martin.st>
Thu, 15 Aug 2013 19:41:19 +0000 (22:41 +0300)
The counter itself shouldn't be wrapped, since it is used for
determining end_pts for the next segment - only wrap the number
used for the segment file name.

Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/hlsenc.c

index a4b1baf..3dd4273 100644 (file)
@@ -164,12 +164,10 @@ static int hls_start(AVFormatContext *s)
     AVFormatContext *oc = c->avf;
     int err = 0;
 
-    if (c->wrap)
-        c->number %= c->wrap;
-
     if (av_get_frame_filename(oc->filename, sizeof(oc->filename),
-                              c->basename, c->number++) < 0)
+                              c->basename, c->wrap ? c->number % c->wrap : c->number) < 0)
         return AVERROR(EINVAL);
+    c->number++;
 
     if ((err = avio_open2(&oc->pb, oc->filename, AVIO_FLAG_WRITE,
                           &s->interrupt_callback, NULL)) < 0)