[FFmpeg-devel] [PATCH 26/34] avcodec/libxavs: Avoid copying packet data

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Mon Apr 26 01:34:40 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>
---
ff_alloc_packet2() call (for the actual packets, not this end-of-stream
packet), yet the size known in advance is not exact.

 libavcodec/libxavs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/libxavs.c b/libavcodec/libxavs.c
index a83b93b836..6be3d02be8 100644
--- a/libavcodec/libxavs.c
+++ b/libavcodec/libxavs.c
@@ -150,7 +150,7 @@ static int XAVS_frame(AVCodecContext *avctx, AVPacket *pkt,
 
     if (!ret) {
         if (!frame && !(x4->end_of_stream)) {
-            if ((ret = ff_alloc_packet2(avctx, pkt, 4, 0)) < 0)
+            if ((ret = ff_alloc_packet2(avctx, pkt, 4, 4)) < 0)
                 return ret;
 
             pkt->data[0] = 0x0;
-- 
2.27.0



More information about the ffmpeg-devel mailing list