diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-09-06 03:29:19 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-10-03 20:56:12 +0200 |
commit | 5de6c9018792f79665ce50be8ed8b2f8a9c087a7 (patch) | |
tree | 31ac5b1433e8a1550320a80525632d3da6792a3d /libavformat | |
parent | c012fc34df040378450ec333f522bfa781a574d8 (diff) | |
download | ffmpeg-5de6c9018792f79665ce50be8ed8b2f8a9c087a7.tar.gz |
avformat/mux: Remove unnecessary av_packet_unref()
AVFormatInternal.parse_pkt is always blank after having been used.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/mux.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/libavformat/mux.c b/libavformat/mux.c index be9ba88365..a6e1a08be0 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -1210,8 +1210,6 @@ int av_write_frame(AVFormatContext *s, AVPacket *in) * The following avoids copying in's data unnecessarily. * Copying side data is unavoidable as a bitstream filter * may change it, e.g. free it on errors. */ - av_packet_unref(pkt); - pkt->buf = NULL; pkt->data = in->data; pkt->size = in->size; ret = av_packet_copy_props(pkt, in); @@ -1255,10 +1253,11 @@ int av_write_trailer(AVFormatContext *s) AVPacket *const pkt = si->parse_pkt; int ret1, ret = 0; - av_packet_unref(pkt); for (unsigned i = 0; i < s->nb_streams; i++) { - if (ffstream(s->streams[i])->bsfc) { - ret1 = write_packets_from_bsfs(s, s->streams[i], pkt, 1/*interleaved*/); + AVStream *const st = s->streams[i]; + FFStream *const sti = ffstream(st); + if (sti->bsfc) { + ret1 = write_packets_from_bsfs(s, st, pkt, 1/*interleaved*/); if (ret1 < 0) av_packet_unref(pkt); if (ret >= 0) @@ -1361,7 +1360,6 @@ static int write_uncoded_frame_internal(AVFormatContext *s, int stream_index, if (!framep) goto fail; - av_packet_unref(pkt); pkt->buf = av_buffer_create((void *)framep, bufsize, uncoded_frame_free, NULL, 0); if (!pkt->buf) { |