diff mbox series

[FFmpeg-devel,4/5] avformat/mpegtsenc: Avoid allocation of AVPacket

Message ID AM7PR03MB666081D390AC5F8F1712FCE58F9C9@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit 2cddb2f7a8a98408e3f238933ebf1ae7280fa5fd
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/mpegtsenc.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
diff mbox series

Patch

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;