[FFmpeg-devel] [PATCH 27/34] avcodec/libcodec2: Avoid copying packet data

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Mon Apr 26 01:34:41 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/libcodec2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/libcodec2.c b/libavcodec/libcodec2.c
index 2164f36051..eadf3285f7 100644
--- a/libavcodec/libcodec2.c
+++ b/libavcodec/libcodec2.c
@@ -169,7 +169,7 @@ static int libcodec2_encode(AVCodecContext *avctx, AVPacket *avpkt,
     LibCodec2Context *c2 = avctx->priv_data;
     int16_t *samples = (int16_t *)frame->data[0];
 
-    int ret = ff_alloc_packet2(avctx, avpkt, avctx->block_align, 0);
+    int ret = ff_alloc_packet2(avctx, avpkt, avctx->block_align, avctx->block_align);
     if (ret < 0) {
         return ret;
     }
-- 
2.27.0



More information about the ffmpeg-devel mailing list