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

Ruiling Song ruiling.song at intel.com
Thu Feb 8 03:35:14 EET 2018


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);
-- 
2.7.4



More information about the ffmpeg-devel mailing list