diff mbox series

[FFmpeg-devel,v5,4/8] lavc/vaapi_encode: Init pic at the beginning of API

Message ID 20230911075232.797886-4-fei.w.wang@intel.com
State New
Headers show
Series [FFmpeg-devel,v5,1/8] avcodec/cbs_av1: Add tx mode enum values | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Wang, Fei W Sept. 11, 2023, 7:52 a.m. UTC
From: Fei Wang <fei.w.wang@intel.com>

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
---
 libavcodec/vaapi_encode.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Neal Gompa Sept. 20, 2023, 12:43 a.m. UTC | #1
On Mon, Sep 11, 2023 at 3:53 AM <fei.w.wang-at-intel.com@ffmpeg.org> wrote:
>
> From: Fei Wang <fei.w.wang@intel.com>
>
> Signed-off-by: Fei Wang <fei.w.wang@intel.com>
> ---
>  libavcodec/vaapi_encode.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
> index 0316fe5c18..5ae63c9f25 100644
> --- a/libavcodec/vaapi_encode.c
> +++ b/libavcodec/vaapi_encode.c
> @@ -1205,7 +1205,7 @@ fail:
>  int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
>  {
>      VAAPIEncodeContext *ctx = avctx->priv_data;
> -    VAAPIEncodePicture *pic;
> +    VAAPIEncodePicture *pic = NULL;
>      AVFrame *frame = ctx->frame;
>      int err;
>
> @@ -1228,8 +1228,6 @@ int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
>      }
>
>      if (ctx->has_sync_buffer_func) {
> -        pic = NULL;
> -
>          if (av_fifo_can_write(ctx->encode_fifo)) {
>              err = vaapi_encode_pick_next(avctx, &pic);
>              if (!err) {
> @@ -1255,7 +1253,6 @@ int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
>          av_fifo_read(ctx->encode_fifo, &pic, 1);
>          ctx->encode_order = pic->encode_order + 1;
>      } else {
> -        pic = NULL;
>          err = vaapi_encode_pick_next(avctx, &pic);
>          if (err < 0)
>              return err;
> --
> 2.25.1
>

LGTM and existing VAAPI stuff works.

Reviewed-by: Neal Gompa <ngompa13@gmail.com>
diff mbox series

Patch

diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 0316fe5c18..5ae63c9f25 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -1205,7 +1205,7 @@  fail:
 int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
 {
     VAAPIEncodeContext *ctx = avctx->priv_data;
-    VAAPIEncodePicture *pic;
+    VAAPIEncodePicture *pic = NULL;
     AVFrame *frame = ctx->frame;
     int err;
 
@@ -1228,8 +1228,6 @@  int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
     }
 
     if (ctx->has_sync_buffer_func) {
-        pic = NULL;
-
         if (av_fifo_can_write(ctx->encode_fifo)) {
             err = vaapi_encode_pick_next(avctx, &pic);
             if (!err) {
@@ -1255,7 +1253,6 @@  int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
         av_fifo_read(ctx->encode_fifo, &pic, 1);
         ctx->encode_order = pic->encode_order + 1;
     } else {
-        pic = NULL;
         err = vaapi_encode_pick_next(avctx, &pic);
         if (err < 0)
             return err;