[vlc-commits] vout/gl: ensure that the GL context is attached

Thomas Guillem git at videolan.org
Tue Apr 25 13:54:46 CEST 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Apr 25 13:49:48 2017 +0200| [70b4891ec036d3038b21256d806171377b55e16d] | committer: Thomas Guillem

vout/gl: ensure that the GL context is attached

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

 modules/video_output/opengl/display.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/modules/video_output/opengl/display.c b/modules/video_output/opengl/display.c
index 281ed71f17..63376f1cd8 100644
--- a/modules/video_output/opengl/display.c
+++ b/modules/video_output/opengl/display.c
@@ -167,9 +167,8 @@ static picture_pool_t *Pool (vout_display_t *vd, unsigned count)
 {
     vout_display_sys_t *sys = vd->sys;
 
-    if (!sys->pool)
+    if (!sys->pool && vlc_gl_MakeCurrent (sys->gl) == VLC_SUCCESS)
     {
-        vlc_gl_MakeCurrent (sys->gl);
         sys->pool = vout_display_opengl_GetPool (sys->vgl, count);
         vlc_gl_ReleaseCurrent (sys->gl);
     }
@@ -180,8 +179,8 @@ static void PictureRender (vout_display_t *vd, picture_t *pic, subpicture_t *sub
 {
     vout_display_sys_t *sys = vd->sys;
 
-    vlc_gl_MakeCurrent (sys->gl);
-    vout_display_opengl_Prepare (sys->vgl, pic, subpicture);
+    if (vlc_gl_MakeCurrent (sys->gl) == VLC_SUCCESS)
+        vout_display_opengl_Prepare (sys->vgl, pic, subpicture);
     vlc_gl_ReleaseCurrent (sys->gl);
 }
 
@@ -189,9 +188,11 @@ static void PictureDisplay (vout_display_t *vd, picture_t *pic, subpicture_t *su
 {
     vout_display_sys_t *sys = vd->sys;
 
-    vlc_gl_MakeCurrent (sys->gl);
-    vout_display_opengl_Display (sys->vgl, &vd->source);
-    vlc_gl_ReleaseCurrent (sys->gl);
+    if (vlc_gl_MakeCurrent (sys->gl) == VLC_SUCCESS)
+    {
+        vout_display_opengl_Display (sys->vgl, &vd->source);
+        vlc_gl_ReleaseCurrent (sys->gl);
+    }
 
     picture_Release (pic);
     if (subpicture != NULL)
@@ -221,7 +222,8 @@ static int Control (vout_display_t *vd, int query, va_list ap)
 
         vout_display_PlacePicture (&place, src, c, false);
         vlc_gl_Resize (sys->gl, place.width, place.height);
-        vlc_gl_MakeCurrent (sys->gl);
+        if (vlc_gl_MakeCurrent (sys->gl) != VLC_SUCCESS)
+            return VLC_EGENERIC;
         vout_display_opengl_SetWindowAspectRatio(sys->vgl, (float)place.width / place.height);
         glViewport (place.x, place.y, place.width, place.height);
         vlc_gl_ReleaseCurrent (sys->gl);
@@ -236,7 +238,8 @@ static int Control (vout_display_t *vd, int query, va_list ap)
         vout_display_place_t place;
 
         vout_display_PlacePicture (&place, src, cfg, false);
-        vlc_gl_MakeCurrent (sys->gl);
+        if (vlc_gl_MakeCurrent (sys->gl) != VLC_SUCCESS)
+            return VLC_EGENERIC;
         vout_display_opengl_SetWindowAspectRatio(sys->vgl, (float)place.width / place.height);
         glViewport (place.x, place.y, place.width, place.height);
         vlc_gl_ReleaseCurrent (sys->gl);



More information about the vlc-commits mailing list