[FFmpeg-cvslog] avformat/avienc: Avoid allocating AVPacket

Andreas Rheinhardt git at videolan.org
Sun Oct 3 23:48:56 EEST 2021


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Thu Mar 18 07:06:29 2021 +0100| [f660b8d1de81055df6b081bc910ef159c6ed2642] | committer: Andreas Rheinhardt

avformat/avienc: Avoid allocating AVPacket

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f660b8d1de81055df6b081bc910ef159c6ed2642
---

 libavformat/avienc.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 3b11841cd3..3fbde0be1e 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -272,9 +272,7 @@ static int avi_write_header(AVFormatContext *s)
         return AVERROR(EINVAL);
     }
 
-    avi->empty_packet = av_packet_alloc();
-    if (!avi->empty_packet)
-        return AVERROR(ENOMEM);
+    avi->empty_packet = ffformatcontext(s)->pkt;
 
     for (n = 0; n < s->nb_streams; n++) {
         s->streams[n]->priv_data = av_mallocz(sizeof(AVIStream));
@@ -972,10 +970,6 @@ static int avi_write_trailer(AVFormatContext *s)
 
 static void avi_deinit(AVFormatContext *s)
 {
-    AVIContext *avi = s->priv_data;
-
-    av_packet_free(&avi->empty_packet);
-
     for (int i = 0; i < s->nb_streams; i++) {
         AVIStream *avist = s->streams[i]->priv_data;
         if (!avist)



More information about the ffmpeg-cvslog mailing list