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

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


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Apr 25 13:51:24 2017 +0200| [da40c68c86b4e60de19c933dbd8c702a51dab272] | committer: Thomas Guillem

vout/ios: ensure that the GL context is attached

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

 modules/video_output/ios.m | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/modules/video_output/ios.m b/modules/video_output/ios.m
index 7777c2caea..ba54455128 100644
--- a/modules/video_output/ios.m
+++ b/modules/video_output/ios.m
@@ -189,7 +189,8 @@ static int Open(vlc_object_t *this)
         sys->gl->swap = OpenglESSwap;
         sys->gl->getProcAddress = OurGetProcAddress;
 
-        vlc_gl_MakeCurrent(sys->gl);
+        if (vlc_gl_MakeCurrent(sys->gl) != VLC_SUCCESS)
+            goto bailout;
         sys->vgl = vout_display_opengl_New(&vd->fmt, &subpicture_chromas,
                                            sys->gl, &vd->cfg->viewpoint);
         vlc_gl_ReleaseCurrent(sys->gl);
@@ -362,8 +363,8 @@ static void PictureDisplay(vout_display_t *vd, picture_t *pic, subpicture_t *sub
 {
     vout_display_sys_t *sys = vd->sys;
     @synchronized (sys->glESView) {
-        if (likely([sys->glESView isAppActive])) {
-            vlc_gl_MakeCurrent(sys->gl);
+        if (likely([sys->glESView isAppActive]) && vlc_gl_MakeCurrent(sys->gl) == VLC_SUCCESS)
+        {
             vout_display_opengl_Display(sys->vgl, &vd->source);
             vlc_gl_ReleaseCurrent(sys->gl);
         }
@@ -378,9 +379,8 @@ static void PictureDisplay(vout_display_t *vd, picture_t *pic, subpicture_t *sub
 static void PictureRender(vout_display_t *vd, picture_t *pic, subpicture_t *subpicture)
 {
     vout_display_sys_t *sys = vd->sys;
-    if (likely([sys->glESView isAppActive]))
+    if (likely([sys->glESView isAppActive]) && vlc_gl_MakeCurrent(sys->gl) == VLC_SUCCESS)
     {
-        vlc_gl_MakeCurrent(sys->gl);
         vout_display_opengl_Prepare(sys->vgl, pic, subpicture);
         vlc_gl_ReleaseCurrent(sys->gl);
     }
@@ -390,13 +390,11 @@ static picture_pool_t *PicturePool(vout_display_t *vd, unsigned requested_count)
 {
     vout_display_sys_t *sys = vd->sys;
 
-    if (!sys->picturePool)
+    if (!sys->picturePool && vlc_gl_MakeCurrent(sys->gl) == VLC_SUCCESS)
     {
-        vlc_gl_MakeCurrent(sys->gl);
         sys->picturePool = vout_display_opengl_GetPool(sys->vgl, requested_count);
         vlc_gl_ReleaseCurrent(sys->gl);
     }
-    assert(sys->picturePool);
     return sys->picturePool;
 }
 



More information about the vlc-commits mailing list