[FFmpeg-devel] [PATCH] lavc/vaapi: release buffer before destroy context.

Jun Zhao mypopydev at gmail.com
Thu Feb 8 05:08:23 EET 2018



On 2018/2/8 9:35, Ruiling Song wrote:
> The common way to use libVA was first destroy the buffer, then the
> context. I am not sure whether libVA has clear statement on this.
> This patch just make things simple. This would fix an segmentation
> fault issue against iHD open source driver.
>
> Signed-off-by: Ruiling Song <ruiling.song 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 550ea47..607e3ab 100644
> --- a/libavcodec/vaapi_encode.c
> +++ b/libavcodec/vaapi_encode.c
> @@ -1562,6 +1562,8 @@ av_cold int ff_vaapi_encode_close(AVCodecContext *avctx)
>          vaapi_encode_free(avctx, pic);
>      }
>  
> +    av_buffer_pool_uninit(&ctx->output_buffer_pool);
> +
>      if (ctx->va_context != VA_INVALID_ID) {
>          vaDestroyContext(ctx->hwctx->display, ctx->va_context);
>          ctx->va_context = VA_INVALID_ID;
> @@ -1572,7 +1574,6 @@ av_cold int ff_vaapi_encode_close(AVCodecContext *avctx)
>          ctx->va_config = VA_INVALID_ID;
>      }
>  
> -    av_buffer_pool_uninit(&ctx->output_buffer_pool);
>  
>      av_freep(&ctx->codec_sequence_params);
>      av_freep(&ctx->codec_picture_params);
I think Mark have submit this patch in Libav: 
https://patches.libav.org/patch/64112/


More information about the ffmpeg-devel mailing list