[FFmpeg-devel] [PATCH 02/34] avcodec/adxenc: Avoid copying packet data
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Mon Apr 26 01:34:16 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/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
More information about the ffmpeg-devel
mailing list