hls: Factor the sequence computation
authorLuca Barbato <lu_zero@gentoo.org>
Tue, 29 Apr 2014 16:37:01 +0000 (18:37 +0200)
committerLuca Barbato <lu_zero@gentoo.org>
Wed, 30 Apr 2014 15:52:33 +0000 (17:52 +0200)
libavformat/hlsenc.c

index dc51e7e..79820f0 100644 (file)
@@ -132,6 +132,7 @@ static int hls_window(AVFormatContext *s, int last)
     ListEntry *en;
     int target_duration = 0;
     int ret = 0;
+    int64_t sequence = FFMAX(hls->start_sequence, hls->sequence - hls->size);
 
     if ((ret = avio_open2(&hls->pb, s->filename, AVIO_FLAG_WRITE,
                           &s->interrupt_callback, NULL)) < 0)
@@ -145,11 +146,10 @@ static int hls_window(AVFormatContext *s, int last)
     avio_printf(hls->pb, "#EXTM3U\n");
     avio_printf(hls->pb, "#EXT-X-VERSION:3\n");
     avio_printf(hls->pb, "#EXT-X-TARGETDURATION:%d\n", target_duration);
-    avio_printf(hls->pb, "#EXT-X-MEDIA-SEQUENCE:%"PRId64"\n",
-                FFMAX(hls->start_sequence, hls->sequence - hls->size));
+    avio_printf(hls->pb, "#EXT-X-MEDIA-SEQUENCE:%"PRId64"\n", sequence);
 
     av_log(s, AV_LOG_VERBOSE, "EXT-X-MEDIA-SEQUENCE:%"PRId64"\n",
-           FFMAX(hls->start_sequence, hls->sequence - hls->size));
+           sequence);
 
     for (en = hls->list; en; en = en->next) {
         avio_printf(hls->pb, "#EXTINF:%d,\n", en->duration);