1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-03-28 12:32:17 +02:00

hlsenc: keep the playlist to the correct number of items

Consider the corner case with a list size larger than the wrap
number.
This commit is contained in:
Luca Barbato 2012-12-25 10:05:42 +01:00
parent ae85d6c9c0
commit 0448f26c97

@ -48,6 +48,7 @@ typedef struct HLSContext {
int has_video; int has_video;
int64_t start_pts; int64_t start_pts;
int64_t end_pts; int64_t end_pts;
int nb_entries;
ListEntry *list; ListEntry *list;
ListEntry *end_list; ListEntry *end_list;
char *basename; char *basename;
@ -97,11 +98,12 @@ static int append_entry(HLSContext *hls, uint64_t duration)
hls->end_list = en; hls->end_list = en;
if (hls->number >= hls->size) { if (hls->nb_entries >= hls->size) {
en = hls->list; en = hls->list;
hls->list = en->next; hls->list = en->next;
av_free(en); av_free(en);
} } else
hls->nb_entries++;
return 0; return 0;
} }