Mercurial > libavformat.hg
diff mxfenc.c @ 5210:36d130853c9b libavformat
Improve amortized worst case speed of the muxers packet interleaving code
from O(packets_in_the_file) to O(num_of_streams).
author | michael |
---|---|
date | Wed, 16 Sep 2009 20:04:04 +0000 |
parents | d4cce49ac1f1 |
children | 16a2de6da57e |
line wrap: on
line diff
--- a/mxfenc.c Wed Sep 16 18:06:29 2009 +0000 +++ b/mxfenc.c Wed Sep 16 20:04:04 2009 +0000 @@ -1836,6 +1836,9 @@ // purge packet queue while (pktl) { AVPacketList *next = pktl->next; + + if(s->streams[pktl->pkt.stream_index]->last_in_packet_buffer == pktl) + s->streams[pktl->pkt.stream_index]->last_in_packet_buffer= NULL; av_free_packet(&pktl->pkt); av_freep(&pktl); pktl = next; @@ -1844,6 +1847,7 @@ last->next = NULL; else { s->packet_buffer = NULL; + s->packet_buffer_end= NULL; goto out; } pktl = s->packet_buffer; @@ -1852,6 +1856,10 @@ *out = pktl->pkt; //av_log(s, AV_LOG_DEBUG, "out st:%d dts:%lld\n", (*out).stream_index, (*out).dts); s->packet_buffer = pktl->next; + if(s->streams[pktl->pkt.stream_index]->last_in_packet_buffer == pktl) + s->streams[pktl->pkt.stream_index]->last_in_packet_buffer= NULL; + if(!s->packet_buffer) + s->packet_buffer_end= NULL; av_freep(&pktl); return 1; } else {