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.rheinha...@outlook.com> --- libavcodec/libx264.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index 4ddc4973a4..b23471a809 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -144,7 +144,7 @@ static int encode_nals(AVCodecContext *ctx, AVPacket *pkt, for (i = 0; i < nnal; i++) size += nals[i].i_payload; - if ((ret = ff_alloc_packet2(ctx, pkt, size, 0)) < 0) + if ((ret = ff_alloc_packet2(ctx, pkt, size, size)) < 0) return ret; p = pkt->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".