[FFmpeg-cvslog] avformat/mux: Remove unnecessary av_packet_unref()
Andreas Rheinhardt
git at videolan.org
Sun Oct 3 23:49:25 EEST 2021
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Mon Sep 6 03:29:19 2021 +0200| [5de6c9018792f79665ce50be8ed8b2f8a9c087a7] | committer: Andreas Rheinhardt
avformat/mux: Remove unnecessary av_packet_unref()
AVFormatInternal.parse_pkt is always blank after having been used.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5de6c9018792f79665ce50be8ed8b2f8a9c087a7
---
libavformat/mux.c | 10 ++++------
1 file 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) {
More information about the ffmpeg-cvslog
mailing list