Commit fe5a361c authored by Baptiste Coudurier's avatar Baptiste Coudurier
Browse files

fix mxf interleaving packet purge

Originally committed as revision 17359 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 6545996f
...@@ -1831,20 +1831,15 @@ static int mxf_interleave_get_packet(AVFormatContext *s, AVPacket *out, AVPacket ...@@ -1831,20 +1831,15 @@ static int mxf_interleave_get_packet(AVFormatContext *s, AVPacket *out, AVPacket
if (stream_count && (s->nb_streams == stream_count || flush)) { if (stream_count && (s->nb_streams == stream_count || flush)) {
pktl = s->packet_buffer; pktl = s->packet_buffer;
if (s->nb_streams != stream_count) { if (s->nb_streams != stream_count) {
AVPacketList *first = NULL;
AVPacketList *last = NULL; AVPacketList *last = NULL;
// find first packet in edit unit // find last packet in edit unit
while (pktl) { while (pktl) {
AVStream *st = s->streams[pktl->pkt.stream_index]; if (!stream_count || pktl->pkt.stream_index == 0)
if (st->index == 0)
break; break;
else if (!first)
first = pktl;
last = pktl; last = pktl;
pktl = pktl->next; pktl = pktl->next;
stream_count--;
} }
if (last)
last->next = NULL;
// purge packet queue // purge packet queue
while (pktl) { while (pktl) {
AVPacketList *next = pktl->next; AVPacketList *next = pktl->next;
...@@ -1852,9 +1847,13 @@ static int mxf_interleave_get_packet(AVFormatContext *s, AVPacket *out, AVPacket ...@@ -1852,9 +1847,13 @@ static int mxf_interleave_get_packet(AVFormatContext *s, AVPacket *out, AVPacket
av_freep(&pktl); av_freep(&pktl);
pktl = next; pktl = next;
} }
if (!first) if (last)
last->next = NULL;
else {
s->packet_buffer = NULL;
goto out; goto out;
pktl = first; }
pktl = s->packet_buffer;
} }
*out = pktl->pkt; *out = pktl->pkt;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment