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

Submitted by Andreas Rheinhardt on Sept. 18, 2019, 3:26 a.m.

Details

Message ID 20190918032607.11774-8-andreas.rheinhardt@gmail.com
State Accepted
Commit e12a2a2d73436e1514293367ec662562df1780e3
Headers show

Commit Message

Andreas Rheinhardt Sept. 18, 2019, 3:26 a.m.
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>
---
 libavcodec/avpacket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer Sept. 18, 2019, 9:01 p.m.
On Wed, Sep 18, 2019 at 05:26:05AM +0200, Andreas Rheinhardt wrote:
> 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>
> ---
>  libavcodec/avpacket.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

thx

[...]

Patch hide | download patch | download mbox

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;
 }