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/libtheoraenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/libtheoraenc.c b/libavcodec/libtheoraenc.c index 16966ed433..5dd8c2084f 100644 --- a/libavcodec/libtheoraenc.c +++ b/libavcodec/libtheoraenc.c @@ -339,7 +339,8 @@ static int encode_frame(AVCodecContext* avc_context, AVPacket *pkt, } /* Copy ogg_packet content out to buffer */ - if ((ret = ff_alloc_packet2(avc_context, pkt, o_packet.bytes, 0)) < 0) + if ((ret = ff_alloc_packet2(avc_context, pkt, o_packet.bytes, + o_packet.bytes)) < 0) return ret; memcpy(pkt->data, o_packet.packet, o_packet.bytes); -- 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".