diff mbox series

[FFmpeg-devel,31/34] avcodec/libgsmenc: Avoid copying packet data

Message ID HE1PR0301MB21549AF0FA6B4E717271A8D28F439@HE1PR0301MB2154.eurprd03.prod.outlook.com
State New
Headers show
Series [FFmpeg-devel,01/34] avcodec/adpcmenc: Avoid copying packet data
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate fail Make fate failed
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate warning Make fate failed

Commit Message

Andreas Rheinhardt April 25, 2021, 10:34 p.m. UTC
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@outlook.com>
---
These encoders have the most unorthodox way of using their private data
that I have ever seen. Will fix it later.

 libavcodec/libgsmenc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavcodec/libgsmenc.c b/libavcodec/libgsmenc.c
index fdb11c705e..eeaa5b2a10 100644
--- a/libavcodec/libgsmenc.c
+++ b/libavcodec/libgsmenc.c
@@ -98,7 +98,8 @@  static int libgsm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
     gsm_signal *samples = (gsm_signal *)frame->data[0];
     struct gsm_state *state = avctx->priv_data;
 
-    if ((ret = ff_alloc_packet2(avctx, avpkt, avctx->block_align, 0)) < 0)
+    if ((ret = ff_alloc_packet2(avctx, avpkt, avctx->block_align,
+                                              avctx->block_align)) < 0)
         return ret;
 
     switch(avctx->codec_id) {