[FFmpeg-cvslog] Revert "avutil/hwcontext_vaapi: fix SEGV in vaTerminate when vaInitialize fails"

Mark Thompson git at videolan.org
Sun Feb 5 17:41:48 EET 2017

ffmpeg | branch: master | Mark Thompson <sw at jkqxz.net> | Sun Feb  5 14:58:06 2017 +0000| [3420b34a8a63c89d748abe8e99e7acf4c2408a81] | committer: Mark Thompson

Revert "avutil/hwcontext_vaapi: fix SEGV in vaTerminate when vaInitialize fails"

The original code is correctly following the API - vaTerminate() must
be called to free the resources of a VADisplay after it is created by
any of the vaGetDisplay*() calls; it is not necessary to have
successfully called vaInitialize() on it.  The segfaults which
prompted this change must therefore be bugs in libva or the driver it

This reverts commit 3606602f1137552ea54f2c259eb140c1e3c026d4.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3420b34a8a63c89d748abe8e99e7acf4c2408a81

 libavutil/hwcontext_vaapi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index 0051acb..6176bdc 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -961,13 +961,14 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, const char *device,
         return AVERROR(EINVAL);
+    hwctx->display = display;
     vas = vaInitialize(display, &major, &minor);
     if (vas != VA_STATUS_SUCCESS) {
         av_log(ctx, AV_LOG_ERROR, "Failed to initialise VAAPI "
                "connection: %d (%s).\n", vas, vaErrorStr(vas));
         return AVERROR(EIO);
-    hwctx->display = display;
     av_log(ctx, AV_LOG_VERBOSE, "Initialised VAAPI connection: "
            "version %d.%d\n", major, minor);

More information about the ffmpeg-cvslog mailing list