Browse code

libavformat/segment: change segment_list_size behavior to match hls_list_size behavior.

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.

this allows the segment list to
be limited to containing only one segment which used to be impossible
because a segment_list_size of 0 kept all the segments and a
segment_list_size of 1 kept 2 segments.

Signed-off-by: Simon Thelen <ffmpeg-dev@c-14.de>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Simon Thelen authored on 2014/07/10 04:40:43
Showing 2 changed files
... ...
@@ -822,7 +822,7 @@ Select the listing format.
822 822
 @end table
823 823
 
824 824
 @item segment_list_size @var{size}
825
-Update the list file so that it contains at most the last @var{size}
825
+Update the list file so that it contains at most @var{size}
826 826
 segments. If 0 the list file will contain all the segments. Default
827 827
 value is 0.
828 828
 
... ...
@@ -333,7 +333,7 @@ static int segment_end(AVFormatContext *s, int write_trailer, int is_last)
333 333
             seg->segment_list_entries_end = entry;
334 334
 
335 335
             /* drop first item */
336
-            if (seg->list_size && seg->segment_count > seg->list_size) {
336
+            if (seg->list_size && seg->segment_count >= seg->list_size) {
337 337
                 entry = seg->segment_list_entries;
338 338
                 seg->segment_list_entries = seg->segment_list_entries->next;
339 339
                 av_free(entry->filename);