[PATCH] ios :lock the OpenGL context before applying changes

Carola Nitz nitz.carola at googlemail.com
Thu Sep 7 19:46:56 CEST 2017


---
 modules/video_output/ios.m | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/modules/video_output/ios.m b/modules/video_output/ios.m
index a22d281b4d..8d4ff15c8c 100644
--- a/modules/video_output/ios.m
+++ b/modules/video_output/ios.m
@@ -321,20 +321,28 @@ static int Control(vout_display_t *vd, int query, va_list ap)
                     sys->place = place;
                 }
 
-                if (sys->gl != NULL)
+                if (sys->gl != NULL) {
+                    vlc_gl_MakeCurrent(sys->gl);
                     vout_display_opengl_SetWindowAspectRatio(sys->vgl, (float)place.width / place.height);
+                }
 
                 // x / y are top left corner, but we need the lower left one
-                if (query != VOUT_DISPLAY_CHANGE_DISPLAY_SIZE)
+                if (query != VOUT_DISPLAY_CHANGE_DISPLAY_SIZE) {
                     glViewport(place.x, cfg_tmp.display.height - (place.y + place.height), place.width, place.height);
+                    vlc_gl_ReleaseCurrent(sys->gl);
+                }
             }
             return VLC_SUCCESS;
         }
 
         case VOUT_DISPLAY_CHANGE_VIEWPOINT:
-            if (sys->gl != NULL)
-                return vout_display_opengl_SetViewpoint(sys->vgl,
+            if (sys->gl != NULL) {
+                vlc_gl_MakeCurrent(sys->gl);
+                int viewport = vout_display_opengl_SetViewpoint(sys->vgl,
                     &va_arg (ap, const vout_display_cfg_t* )->viewpoint);
+                vlc_gl_ReleaseCurrent(sys->gl);
+                return viewport;
+            }
             else
                 return VLC_EGENERIC;
 
-- 
2.13.5 (Apple Git-94)



More information about the vlc-devel mailing list