[FFmpeg-devel] [PATCH v1 1/1] vaapi_encode: replace av_new_packet with ff_alloc_packet2

James Almer jamrial at gmail.com
Fri May 31 22:05:38 EEST 2019


On 5/31/2019 5:26 AM, Jing Sun wrote:
> ff_alloc_packet2 should be used if encode2 API

vaapi_encode seems to be using send/receive API, though, and not encode2.

I see ff_vaapi_encode_receive_packet() -> vaapi_encode_output(), and the
former is the callback function used in all vaapi encoders as
AVCodec.receive_packet, so this patch in not needed.

> 
> Signed-off-by: Jing Sun <jing.a.sun at intel.com>
> ---
>  libavcodec/vaapi_encode.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
> index 2dda451..98e3176 100644
> --- a/libavcodec/vaapi_encode.c
> +++ b/libavcodec/vaapi_encode.c
> @@ -26,6 +26,7 @@
>  
>  #include "vaapi_encode.h"
>  #include "avcodec.h"
> +#include "internal.h"
>  
>  static const char * const picture_type_name[] = { "IDR", "I", "P", "B" };
>  
> @@ -509,7 +510,7 @@ static int vaapi_encode_output(AVCodecContext *avctx,
>          av_log(avctx, AV_LOG_DEBUG, "Output buffer: %u bytes "
>                 "(status %08x).\n", buf->size, buf->status);
>  
> -        err = av_new_packet(pkt, buf->size);
> +        err = ff_alloc_packet2(avctx, pkt, buf->size, 0);
>          if (err < 0)
>              goto fail_mapped;
>  
> 



More information about the ffmpeg-devel mailing list