diff mbox series

[FFmpeg-devel,3/5] avformat/movenc: Avoid allocation of AVPacket

Message ID AM7PR03MB6660FAC5A3CBCD183AE3C8D28F9C9@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit a81e0ee21f64213e750ccb10128775337c73431d
Headers show
Series [FFmpeg-devel,1/5] avformat/avformat: Add AVStream parameter to check_bitstream() sig | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Nov. 19, 2021, 7:16 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/movenc.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index fec467979a..caccf18dea 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -6458,8 +6458,6 @@  static void mov_free(AVFormatContext *s)
     MOVMuxContext *mov = s->priv_data;
     int i;
 
-    av_packet_free(&mov->pkt);
-
     if (!mov->tracks)
         return;
 
@@ -6569,6 +6567,7 @@  static int mov_init(AVFormatContext *s)
     int i, ret;
 
     mov->fc = s;
+    mov->pkt = ffformatcontext(s)->pkt;
 
     /* Default mode == MP4 */
     mov->mode = MODE_MP4;
@@ -6714,10 +6713,6 @@  static int mov_init(AVFormatContext *s)
         mov->nb_streams += mov->nb_meta_tmcd;
     }
 
-    mov->pkt = av_packet_alloc();
-    if (!mov->pkt)
-        return AVERROR(ENOMEM);
-
     // Reserve an extra stream for chapters for the case where chapters
     // are written in the trailer
     mov->tracks = av_calloc(mov->nb_streams + 1, sizeof(*mov->tracks));