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.rheinha...@outlook.com>
---
 libavcodec/adxenc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/adxenc.c b/libavcodec/adxenc.c
index 93b902b0e1..fabbc00aa6 100644
--- a/libavcodec/adxenc.c
+++ b/libavcodec/adxenc.c
@@ -148,7 +148,7 @@ static int adx_encode_frame(AVCodecContext *avctx, AVPacket 
*avpkt,
     if (!samples) {
         if (c->eof)
             return 0;
-        if ((ret = ff_alloc_packet2(avctx, avpkt, 18, 0)) < 0)
+        if ((ret = ff_alloc_packet2(avctx, avpkt, 18, 18)) < 0)
             return ret;
         c->eof = 1;
         dst = avpkt->data;
@@ -162,7 +162,7 @@ static int adx_encode_frame(AVCodecContext *avctx, AVPacket 
*avpkt,
     }
 
     out_size = BLOCK_SIZE * avctx->channels + !c->header_parsed * HEADER_SIZE;
-    if ((ret = ff_alloc_packet2(avctx, avpkt, out_size, 0)) < 0)
+    if ((ret = ff_alloc_packet2(avctx, avpkt, out_size, out_size)) < 0)
         return ret;
     dst = avpkt->data;
 
-- 
2.27.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to