[FFmpeg-devel] [PATCH] fix: the "delete-segment" flag did not work properly (implementation in commit 97b65f6). The set length of the list was populated twice (e.g. setting the list-size to 10, create

2016-03-14 Thread develop
From: Boris Nagels 

---
 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

___
ffmpeg-devel mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] fix: the "delete-segment" flag did not work properly

2016-05-16 Thread develop
From: Boris Nagels 

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
[email protected]
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel