From 17aeee5832b9188b570c3d3de4197e4cdc54c634 Mon Sep 17 00:00:00 2001 From: Mark Thompson Date: Thu, 16 Feb 2017 00:02:29 +0000 Subject: [PATCH 1/2] vaapi_encode: Discard output buffer if picture submission fails Previously this was leaking, though it actually hit an assert making sure that the buffer had already been cleared when freeing the picture. --- libavcodec/vaapi_encode.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index c02b633b46..411d879091 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -428,6 +428,8 @@ fail: fail_at_end: av_freep(&pic->codec_picture_params); av_frame_free(&pic->recon_image); + av_buffer_unref(&pic->output_buffer_ref); + pic->output_buffer = VA_INVALID_ID; return err; } From 2d518aec4c781316092be65893b47922c8f71b67 Mon Sep 17 00:00:00 2001 From: Mark Thompson Date: Thu, 9 Feb 2017 19:26:11 +0000 Subject: [PATCH 2/2] vf_deinterlace_vaapi: Create filter buffer after context The Intel proprietary VAAPI driver enforces the restriction that a buffer must be created inside an existing context, so just ensure this is always true. --- libavfilter/vf_deinterlace_vaapi.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libavfilter/vf_deinterlace_vaapi.c b/libavfilter/vf_deinterlace_vaapi.c index 022baa11fc..ab2a432914 100644 --- a/libavfilter/vf_deinterlace_vaapi.c +++ b/libavfilter/vf_deinterlace_vaapi.c @@ -278,10 +278,6 @@ static int deint_vaapi_config_output(AVFilterLink *outlink) goto fail; } - err = deint_vaapi_build_filter_params(avctx); - if (err < 0) - goto fail; - ctx->output_frames_ref = av_hwframe_ctx_alloc(ctx->device_ref); if (!ctx->output_frames_ref) { av_log(avctx, AV_LOG_ERROR, "Failed to create HW frame context " @@ -319,9 +315,14 @@ static int deint_vaapi_config_output(AVFilterLink *outlink) if (vas != VA_STATUS_SUCCESS) { av_log(avctx, AV_LOG_ERROR, "Failed to create processing pipeline " "context: %d (%s).\n", vas, vaErrorStr(vas)); - return AVERROR(EIO); + err = AVERROR(EIO); + goto fail; } + err = deint_vaapi_build_filter_params(avctx); + if (err < 0) + goto fail; + outlink->w = ctx->output_width; outlink->h = ctx->output_height;