HLS: Handle the case when hls_list_size=0. Playlist file should contain all the segme...
authorSenthilnathan M <senthil.codr@gmail.com>
Sat, 1 Mar 2014 07:43:51 +0000 (13:13 +0530)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 1 Mar 2014 14:13:23 +0000 (15:13 +0100)
Signed-off-by: Senthilnathan M <senthil.codr@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/hlsenc.c

index 3b50397..1b5ef0e 100644 (file)
@@ -102,7 +102,7 @@ static int append_entry(HLSContext *hls, uint64_t duration)
 
     hls->end_list = en;
 
-    if (hls->nb_entries >= hls->size) {
+    if (hls->size && hls->nb_entries >= hls->size) {
         en = hls->list;
         hls->list = en->next;
         av_free(en);
@@ -145,7 +145,7 @@ static int hls_window(AVFormatContext *s, int last)
     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(0, hls->sequence - hls->size));
+                FFMAX(0, hls->sequence - hls->nb_entries));
 
     for (en = hls->list; en; en = en->next) {
         avio_printf(hls->pb, "#EXTINF:%d,\n", en->duration);