[FFmpeg-devel] [PATCH 24/34] avcodec/zmbvenc: Avoid copying packet data

Tomas Härdin tjoppen at acc.umu.se
Wed Apr 28 11:01:04 EEST 2021


mån 2021-04-26 klockan 00:34 +0200 skrev Andreas Rheinhardt:
> Here the packet size is known before allocating the packet because
> the encoder itself works with an internal buffer, 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 at outlook.com>
> ---
>  libavcodec/zmbvenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/zmbvenc.c b/libavcodec/zmbvenc.c
> index 4b3416219b..8933d06ede 100644
> --- a/libavcodec/zmbvenc.c
> +++ b/libavcodec/zmbvenc.c
> @@ -281,7 +281,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
>      }
>  
>      pkt_size = c->zstream.total_out + 1 + 6*keyframe;
> -    if ((ret = ff_alloc_packet2(avctx, pkt, pkt_size, 0)) < 0)
> +    if ((ret = ff_alloc_packet2(avctx, pkt, pkt_size, pkt_size)) <
> 0)

Looks correct

/Tomas



More information about the ffmpeg-devel mailing list