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

Andreas Rheinhardt git at videolan.org
Sat Nov 27 14:19:28 EET 2021


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Thu Nov 18 23:16:12 2021 +0100| [2cddb2f7a8a98408e3f238933ebf1ae7280fa5fd] | committer: Andreas Rheinhardt

avformat/mpegtsenc: 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=2cddb2f7a8a98408e3f238933ebf1ae7280fa5fd
---

 libavformat/mpegtsenc.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 79ec1a7e5f..92b4cc8087 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -1140,9 +1140,7 @@ static int mpegts_init(AVFormatContext *s)
     ts->nit.write_packet = section_write_packet;
     ts->nit.opaque       = s;
 
-    ts->pkt = av_packet_alloc();
-    if (!ts->pkt)
-        return AVERROR(ENOMEM);
+    ts->pkt = ffformatcontext(s)->pkt;
 
     /* assign pids to each stream */
     for (i = 0; i < s->nb_streams; i++) {
@@ -2186,8 +2184,6 @@ static void mpegts_deinit(AVFormatContext *s)
     MpegTSService *service;
     int i;
 
-    av_packet_free(&ts->pkt);
-
     for (i = 0; i < s->nb_streams; i++) {
         AVStream *st = s->streams[i];
         MpegTSWriteStream *ts_st = st->priv_data;



More information about the ffmpeg-cvslog mailing list