summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2011-08-21 21:55:32 +0300
committerUoti Urpala <uau@mplayer2.org>2011-08-21 21:55:32 +0300
commit2c5285c15106c65f161a220476a65d53e567ba96 (patch)
treeaabcdc0825186cbca5e650d8d3a3af33d6ac1084 /libmpdemux
parent47f5d53d85f77a714a76642a301a29a51a14e6f9 (diff)
downloadmpv-2c5285c15106c65f161a220476a65d53e567ba96.tar.bz2
mpv-2c5285c15106c65f161a220476a65d53e567ba96.tar.xz
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).
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/demux_lavf.c5
1 files changed, 5 insertions, 0 deletions
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;