segment: fix FPE when segment_list_size is 0

With the added benefit that allowing -segment_list_size 0 makes it
possible to keep all segment entries in the list file.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Nicolas Noirbent 2012-01-13 09:58:15 +01:00 committed by Michael Niedermayer
parent 645569e19f
commit 62a22b2865

View File

@ -206,7 +206,7 @@ static int seg_write_packet(AVFormatContext *s, AVPacket *pkt)
if (seg->list) {
avio_printf(seg->pb, "%s\n", oc->filename);
avio_flush(seg->pb);
if (!(seg->number % seg->size)) {
if (seg->size && !(seg->number % seg->size)) {
avio_close(seg->pb);
if ((ret = avio_open2(&seg->pb, seg->list, AVIO_FLAG_WRITE,
&s->interrupt_callback, NULL)) < 0)