Improve amortized worst case speed of the muxers packet interleaving code

from O(packets_in_the_file) to O(num_of_streams).

Originally committed as revision 19887 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer 2009-09-16 20:04:04 +00:00
parent d25130eb23
commit e07b882b4d
4 changed files with 34 additions and 14 deletions

View file

@ -261,6 +261,12 @@ static int ogg_interleave_per_granule(AVFormatContext *s, AVPacket *out, AVPacke
OGGStreamContext *ogg = s->streams[out->stream_index]->priv_data;
ogg->eos = 1;
}
if(!s->packet_buffer)
s->packet_buffer_end= NULL;
if(s->streams[out->stream_index]->last_in_packet_buffer == pktl)
s->streams[out->stream_index]->last_in_packet_buffer= NULL;
av_freep(&pktl);
return 1;
} else {