aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2012-12-25 10:05:42 +0100
committerLuca Barbato <lu_zero@gentoo.org>2012-12-29 17:26:30 +0100
commit0448f26c97c5ab4858d31e456a4f1738ae783242 (patch)
treefeb2095cb0688e6130d961eceb9f3727568a3a41
parentae85d6c9c0dcc71dd18c2afb5d15e8b033d67646 (diff)
downloadffmpeg-0448f26c97c5ab4858d31e456a4f1738ae783242.tar.gz
hlsenc: keep the playlist to the correct number of items
Consider the corner case with a list size larger than the wrap number.
-rw-r--r--libavformat/hlsenc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 7abb46d366..39e8df96ab 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;
}