[FFmpeg-devel] [PATCH] libavformat/segment: change segment_list_size behavior to match hls_list_size behavior.

Simon Thelen ffmpeg-dev at c-14.de
Wed Jul 9 21:40:43 CEST 2014


Make the segment muxer keep segment_list_size segments instead of
segment_list_size + 1 segments. This patch also changes the
documentation for segment_list_size to reduce possible confusion over
how many segments are kept.

Signed-off-by: Simon Thelen <ffmpeg-dev at c-14.de>
---
 doc/muxers.texi       | 2 +-
 libavformat/segment.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index dc2a08b..7bf47a2 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -822,7 +822,7 @@ Select the listing format.
 @end table
 
 @item segment_list_size @var{size}
-Update the list file so that it contains at most the last @var{size}
+Update the list file so that it contains at most @var{size}
 segments. If 0 the list file will contain all the segments. Default
 value is 0.
 
diff --git a/libavformat/segment.c b/libavformat/segment.c
index f5e25a2..623b076 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -333,7 +333,7 @@ static int segment_end(AVFormatContext *s, int write_trailer, int is_last)
             seg->segment_list_entries_end = entry;
 
             /* drop first item */
-            if (seg->list_size && seg->segment_count > seg->list_size) {
+            if (seg->list_size && seg->segment_count >= seg->list_size) {
                 entry = seg->segment_list_entries;
                 seg->segment_list_entries = seg->segment_list_entries->next;
                 av_free(entry->filename);
-- 
2.0.0



More information about the ffmpeg-devel mailing list