]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/avpacket: Improve allocating packets
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Wed, 18 Sep 2019 03:26:05 +0000 (05:26 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 18 Sep 2019 20:53:00 +0000 (22:53 +0200)
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@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/avpacket.c

index 2b20067211baf1d7497310e660cb47a09f7b31b2..858f827a0aa2cc61276fd6e8c04e68987ed8ad9c 100644 (file)
@@ -54,7 +54,7 @@ AVPacket *av_packet_alloc(void)
     if (!pkt)
         return pkt;
 
-    av_packet_unref(pkt);
+    av_init_packet(pkt);
 
     return pkt;
 }