diff options
author | Fei Wang <fei.w.wang@intel.com> | 2023-09-11 15:52:28 +0800 |
---|---|---|
committer | Haihao Xiang <haihao.xiang@intel.com> | 2023-09-22 13:15:00 +0800 |
commit | 4a4400709ccfc026c19028f4b2d798eed9322f64 (patch) | |
tree | 9a06da536fcd0bcabc428989978db051de44f174 | |
parent | 695477a1c7d3dd5ad249442b0770ad0acd99dd87 (diff) | |
download | ffmpeg-4a4400709ccfc026c19028f4b2d798eed9322f64.tar.gz |
lavc/vaapi_encode: Init pic at the beginning of API
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
-rw-r--r-- | libavcodec/vaapi_encode.c | 5 |
1 files changed, 1 insertions, 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; |