[FFmpeg-devel] [PATCH 07/34] avcodec/dvenc: Avoid copying packet data

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


When the packet size is known in advance like here, one can avoid
an intermediate buffer for the packet data.

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

diff --git a/libavcodec/dvenc.c b/libavcodec/dvenc.c
index e0679c538c..337bc326ef 100644
--- a/libavcodec/dvenc.c
+++ b/libavcodec/dvenc.c
@@ -1164,7 +1164,8 @@ static int dvvideo_encode_frame(AVCodecContext *c, AVPacket *pkt,
     DVVideoContext *s = c->priv_data;
     int ret;
 
-    if ((ret = ff_alloc_packet2(c, pkt, s->sys->frame_size, 0)) < 0)
+    if ((ret = ff_alloc_packet2(c, pkt, s->sys->frame_size,
+                                        s->sys->frame_size)) < 0)
         return ret;
 
     c->pix_fmt                = s->sys->pix_fmt;
-- 
2.27.0



More information about the ffmpeg-devel mailing list