summaryrefslogtreecommitdiff
path: root/libavformat/movenc.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-12-15 23:21:25 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-01-04 04:58:57 +0100
commit3485e79f07d74e47ff00b60a68d609d37d0129ba (patch)
treeadac3f5438c5d5637b5620e07d6742c50c286bdb /libavformat/movenc.c
parentf0fb005f59f6febcf2ffc8140bdb7f136ac56add (diff)
downloadffmpeg-3485e79f07d74e47ff00b60a68d609d37d0129ba.tar.gz
avformat/(aiff|flac|mov|mp3|tta)enc: Don't create unnecessary references
The packet given to muxers is not used afterwards; it is always unreferenced by libavformat. Ergo muxers are allowed to keep the references in the packets and e.g. move the ownership to a packet list. This is what this commit does. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavformat/movenc.c')
-rw-r--r--libavformat/movenc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 04cf2f777d..e5391bb80f 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -6187,9 +6187,11 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt)
return AVERROR(EINVAL);
}
+ /* The following will reset pkt and is only allowed to be used
+ * because we return immediately. afterwards. */
if ((ret = avpriv_packet_list_put(&trk->squashed_packet_queue,
&trk->squashed_packet_queue_end,
- pkt, av_packet_ref, 0)) < 0) {
+ pkt, NULL, 0)) < 0) {
return ret;
}