[FFmpeg-devel] [PATCH 08/10] avcodec/avpacket: Improve allocating packets

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Wed Sep 18 06:26:05 EEST 2019


av_mallocz + av_init_packet leads to the same result as av_mallocz +
av_packet_unref, but faster.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
 libavcodec/avpacket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index 2b20067211..858f827a0a 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -54,7 +54,7 @@ AVPacket *av_packet_alloc(void)
     if (!pkt)
         return pkt;
 
-    av_packet_unref(pkt);
+    av_init_packet(pkt);
 
     return pkt;
 }
-- 
2.20.1



More information about the ffmpeg-devel mailing list