diff options
author | Philip Langdale <philipl@overt.org> | 2022-12-03 15:12:43 -0800 |
---|---|---|
committer | Philip Langdale <github.philipl@overt.org> | 2022-12-24 09:55:37 -0800 |
commit | cb15bc4324327bded956b2c9b78f09bdc2729d98 (patch) | |
tree | f6f129d880f62d61b75316e2736b71ebe93e9f4f /demux/demux_lavf.c | |
parent | 657fd2804c75fd4c838012ecbf5ce4536e4d487b (diff) | |
download | mpv-cb15bc4324327bded956b2c9b78f09bdc2729d98.tar.bz2 mpv-cb15bc4324327bded956b2c9b78f09bdc2729d98.tar.xz |
demux: replace deprecated usage of stack allocated AVPackets
In the previous change, I replaced the callsites that used
`av_init_packet`, but there are a handful of places that use stack
allocated packets with no initialisation.
In one case, I just switched to heap allocation as it's only done once
per stream at most.
In the other case, I removed our usage of the AVPackets as a
convenience mechanism to transfer data into a heap allocated packet.
Instead, I inlined the data copying.
Diffstat (limited to 'demux/demux_lavf.c')
-rw-r--r-- | demux/demux_lavf.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c index 2b65471b02..f4d3f96fdf 100644 --- a/demux/demux_lavf.c +++ b/demux/demux_lavf.c @@ -1307,10 +1307,11 @@ static void demux_seek_lavf(demuxer_t *demuxer, double seek_pts, int flags) if (priv->pcm_seek_hack && !priv->pcm_seek_hack_packet_size) { // This might for example be the initial seek. Fuck it up like the // bullshit it is. - AVPacket pkt = {0}; - if (av_read_frame(priv->avfc, &pkt) >= 0) - priv->pcm_seek_hack_packet_size = pkt.size; - av_packet_unref(&pkt); + AVPacket *pkt = av_packet_alloc(); + MP_HANDLE_OOM(pkt); + if (av_read_frame(priv->avfc, pkt) >= 0) + priv->pcm_seek_hack_packet_size = pkt->size; + av_packet_free(&pkt); add_new_streams(demuxer); } if (priv->pcm_seek_hack && priv->pcm_seek_hack_packet_size && |