[vlc-commits] caopengllayer: Use the same gl context during modules lifetime

David Fuhrmann git at videolan.org
Thu Feb 6 12:08:31 CET 2014


vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Thu Feb  6 12:04:17 2014 +0100| [06e24490ebe21179827dceba9b50b0d8b673286c] | committer: David Fuhrmann

caopengllayer: Use the same gl context during modules lifetime

Fixes broken playback after switching to fullscreen for some browsers.

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

 modules/video_output/caopengllayer.m |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/modules/video_output/caopengllayer.m b/modules/video_output/caopengllayer.m
index 7d30580..4ff6e7e 100644
--- a/modules/video_output/caopengllayer.m
+++ b/modules/video_output/caopengllayer.m
@@ -232,6 +232,9 @@ static void Close (vlc_object_t *p_this)
     if (sys->gl.sys != NULL)
         vout_display_opengl_Delete(sys->vgl);
 
+    if (sys->glContext)
+        CGLReleaseContext(sys->glContext);
+
     free(sys);
 }
 
@@ -442,6 +445,12 @@ static void *OurGetProcAddress (vlc_gl_t *gl, const char *name)
 
 - (CGLContextObj)copyCGLContextForPixelFormat:(CGLPixelFormatObj)pixelFormat
 {
+    // Only one opengl context is allowed for the module lifetime
+    if(_vd->sys->glContext) {
+        msg_Dbg(_vd, "Return existing context: %p", _vd->sys->glContext);
+        return _vd->sys->glContext;
+    }
+
     CGLContextObj context = [super copyCGLContextForPixelFormat:pixelFormat];
 
     // Swap buffers only during the vertical retrace of the monitor.
@@ -461,9 +470,7 @@ static void *OurGetProcAddress (vlc_gl_t *gl, const char *name)
 
 - (void)releaseCGLContext:(CGLContextObj)glContext
 {
-    @synchronized(self) {
-        _vd->sys->glContext = nil;
-    }
+    // do not release anything here, we do that when closing the module
 }
 
 @end



More information about the vlc-commits mailing list