From 2c5285c15106c65f161a220476a65d53e567ba96 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Sun, 21 Aug 2011 21:55:32 +0300 Subject: demux_lavf: Adding av_dup_packet() missing from recent 6e8d420a41 Commit 6e8d420a41 ("demux: avoid a copy of demux packets with lavf, reduce padding") was missing an av_dup_packet() line. As a result at least formats that use parsing on the lavf side could fail (with parsing the packet may contain pointers to temporary fields that will be overwritten/freed when reading further packets, and av_dup_packet() is required to allocate permanent storage). --- libmpdemux/demux_lavf.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libmpdemux/demux_lavf.c') diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c index 013db04170..3033af9918 100644 --- a/libmpdemux/demux_lavf.c +++ b/libmpdemux/demux_lavf.c @@ -800,6 +800,11 @@ static int demux_lavf_fill_buffer(demuxer_t *demux, demux_stream_t *dsds) return 1; } + // If the packet has pointers to temporary fields that could be + // overwritten/freed by next av_read_frame(), copy them to persistent + // allocations so we can safely queue the packet for any length of time. + if (av_dup_packet(pkt) < 0) + abort(); dp = new_demux_packet_fromdata(pkt->data, pkt->size); dp->avpacket = pkt; -- cgit v1.2.3