diff mbox series

[FFmpeg-devel,29/34] avcodec/libvorbisenc: Avoid copying packet data

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


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
Here the packet size is known before allocating the packet because
the encoder provides said information (and works with internal buffers
itself), so one can pass this information to ff_alloc_packet2() to
avoid the implicit use of another intermediate buffer for the packet data.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
 libavcodec/libvorbisenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series


diff --git a/libavcodec/libvorbisenc.c b/libavcodec/libvorbisenc.c
index bf94764954..16b32631c2 100644
--- a/libavcodec/libvorbisenc.c
+++ b/libavcodec/libvorbisenc.c
@@ -349,7 +349,7 @@  static int libvorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
     av_fifo_generic_read(s->pkt_fifo, &op, sizeof(ogg_packet), NULL);
-    if ((ret = ff_alloc_packet2(avctx, avpkt, op.bytes, 0)) < 0)
+    if ((ret = ff_alloc_packet2(avctx, avpkt, op.bytes, op.bytes)) < 0)
         return ret;
     av_fifo_generic_read(s->pkt_fifo, avpkt->data, op.bytes, NULL);