[FFmpeg-cvslog] hlsenc: keep the playlist to the correct number of items

Luca Barbato git at videolan.org
Sun Dec 30 14:08:53 CET 2012


ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Tue Dec 25 10:05:42 2012 +0100| [0448f26c97c5ab4858d31e456a4f1738ae783242] | committer: Luca Barbato

hlsenc: keep the playlist to the correct number of items

Consider the corner case with a list size larger than the wrap
number.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0448f26c97c5ab4858d31e456a4f1738ae783242
---

 libavformat/hlsenc.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 7abb46d..39e8df9 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -48,6 +48,7 @@ typedef struct HLSContext {
     int has_video;
     int64_t start_pts;
     int64_t end_pts;
+    int nb_entries;
     ListEntry *list;
     ListEntry *end_list;
     char *basename;
@@ -97,11 +98,12 @@ static int append_entry(HLSContext *hls, uint64_t duration)
 
     hls->end_list = en;
 
-    if (hls->number >= hls->size) {
+    if (hls->nb_entries >= hls->size) {
         en = hls->list;
         hls->list = en->next;
         av_free(en);
-    }
+    } else
+        hls->nb_entries++;
 
     return 0;
 }



More information about the ffmpeg-cvslog mailing list