[vlc-commits] gl: vaapi: check if a surface can be derived

Thomas Guillem git at videolan.org
Fri Jun 23 14:09:00 CEST 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Jun 23 13:06:17 2017 +0200| [5875099e5b739168759c65e7015d6a3e23ed2cb9] | committer: Thomas Guillem

gl: vaapi: check if a surface can be derived

This fixes the "invalid VASurfaceID" error with drivers that don't handle
interop.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5875099e5b739168759c65e7015d6a3e23ed2cb9
---

 modules/video_output/opengl/converter_vaapi.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/modules/video_output/opengl/converter_vaapi.c b/modules/video_output/opengl/converter_vaapi.c
index 665da25f09..83ef3c25d6 100644
--- a/modules/video_output/opengl/converter_vaapi.c
+++ b/modules/video_output/opengl/converter_vaapi.c
@@ -288,6 +288,7 @@ error:
 static picture_pool_t *
 tc_va_get_pool(const opengl_tex_converter_t *tc, unsigned requested_count)
 {
+    vlc_object_t *o = VLC_OBJECT(tc->gl);
     struct priv *priv = tc->priv;
 
     picture_pool_t *pool =
@@ -297,6 +298,16 @@ tc_va_get_pool(const opengl_tex_converter_t *tc, unsigned requested_count)
     if (!pool)
         return NULL;
 
+    /* Check if a surface from the pool can be derived */
+    VAImage va_image;
+    if (vlc_vaapi_DeriveImage(o, priv->vadpy, priv->va_surface_ids[0],
+                              &va_image))
+    {
+        picture_pool_Release(pool);
+        return NULL;
+    }
+
+    vlc_vaapi_DestroyImage(o, priv->vadpy, va_image.image_id);
     return pool;
 }
 



More information about the vlc-commits mailing list