[FFmpeg-devel] [PATCH 24/34] avcodec/zmbvenc: Avoid copying packet data

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Mon Apr 26 01:34:38 EEST 2021


Here the packet size is known before allocating the packet because
the encoder itself works with an internal buffer, so one can pass
this information to ff_alloc_packet2() to avoid the implicit use
of another intermediate buffer for the packet data.

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

diff --git a/libavcodec/zmbvenc.c b/libavcodec/zmbvenc.c
index 4b3416219b..8933d06ede 100644
--- a/libavcodec/zmbvenc.c
+++ b/libavcodec/zmbvenc.c
@@ -281,7 +281,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
     }
 
     pkt_size = c->zstream.total_out + 1 + 6*keyframe;
-    if ((ret = ff_alloc_packet2(avctx, pkt, pkt_size, 0)) < 0)
+    if ((ret = ff_alloc_packet2(avctx, pkt, pkt_size, pkt_size)) < 0)
         return ret;
     buf = pkt->data;
 
-- 
2.27.0



More information about the ffmpeg-devel mailing list