From: Boris Nagels <deve...@focusware.nl>

Implementation in commit 97b65f6. The set length of the list was populated 
twice (e.g. setting the list-size to 10, creates a list of approx. 20 files). 
Now calculation works on the theoretical playlist length compensated for the 
segment lengths that are currently in the playlist.
---
 libavformat/hlsenc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 7ab7cbb..c6ab7c5 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -126,12 +126,17 @@ static int hls_delete_old_segments(HLSContext *hls) {
     char *dirname = NULL, *p, *sub_path;
     char *path = NULL;
 
+       // Calculate the maximum playlist duration.
+       playlist_duration = hls->max_nb_segments * hls->time;
+
+       // Compensate for the segments that are currently in the playlist.
     segment = hls->segments;
     while (segment) {
-        playlist_duration += segment->duration;
+        playlist_duration -= segment->duration;
         segment = segment->next;
     }
 
+       // Check the old-segments.
     segment = hls->old_segments;
     while (segment) {
         playlist_duration -= segment->duration;
-- 
2.6.4 (Apple Git-63)

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to