[FFmpeg-cvslog] avformat/matroskaenc: Avoid allocation of AVPacket

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


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Thu Mar 18 07:12:05 2021 +0100| [9b41fddf3ebd23d465960b523ee34329a5f06c42] | committer: Andreas Rheinhardt

avformat/matroskaenc: Avoid allocation of AVPacket

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

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

 libavformat/matroskaenc.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index f17665b0c1..6945c26f5a 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -453,8 +453,6 @@ static void mkv_deinit(AVFormatContext *s)
 {
     MatroskaMuxContext *mkv = s->priv_data;
 
-    av_packet_free(&mkv->cur_audio_pkt);
-
     ffio_free_dyn_buf(&mkv->cluster_bc);
     ffio_free_dyn_buf(&mkv->info.bc);
     ffio_free_dyn_buf(&mkv->track.bc);
@@ -2682,9 +2680,8 @@ static int mkv_init(struct AVFormatContext *s)
     } else
         mkv->mode = MODE_MATROSKAv2;
 
-    mkv->cur_audio_pkt = av_packet_alloc();
-    if (!mkv->cur_audio_pkt)
-        return AVERROR(ENOMEM);
+    mkv->cur_audio_pkt = ffformatcontext(s)->pkt;
+
     mkv->tracks = av_calloc(s->nb_streams, sizeof(*mkv->tracks));
     if (!mkv->tracks)
         return AVERROR(ENOMEM);



More information about the ffmpeg-cvslog mailing list