vlc | branch: master | Marvin Scholz <[email protected]> | Fri Jan 18 18:52:37 
2019 +0100| [f9c4af6e89c9dca6bbe92b14623b74621976cd25] | committer: Thomas 
Guillem

vout/ios: Simplify makeCurrentWithGL:withGL:

Return early when setCurrentContext fails, this simplifies
the following code and makes it much easier to read.

Signed-off-by: Thomas Guillem <[email protected]>

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

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

diff --git a/modules/video_output/ios.m b/modules/video_output/ios.m
index feebab1c85..13484f0749 100644
--- a/modules/video_output/ios.m
+++ b/modules/video_output/ios.m
@@ -591,14 +591,19 @@ static void GLESSwap(vlc_gl_t *gl)
         vlc_mutex_unlock(&_mutex);
         return NO;
     }
-    assert(_eaglEnabled);
 
+    assert(_eaglEnabled);
     *previousEaglContext = [EAGLContext currentContext];
 
-    BOOL success = [EAGLContext setCurrentContext:_eaglContext];
+    if (![EAGLContext setCurrentContext:_eaglContext])
+    {
+        vlc_mutex_unlock(&_mutex);
+        return NO;
+    }
+
     BOOL resetBuffers = NO;
 
-    if (success && gl != NULL)
+    if (gl != NULL)
     {
         struct gl_sys *glsys = gl->sys;
 
@@ -620,8 +625,7 @@ static void GLESSwap(vlc_gl_t *gl)
         }
     }
 
-    if (success)
-        _gl_attached = YES;
+    _gl_attached = YES;
 
     vlc_mutex_unlock(&_mutex);
 
@@ -630,7 +634,7 @@ static void GLESSwap(vlc_gl_t *gl)
         [self releaseCurrent:*previousEaglContext];
         return NO;
     }
-    return success;
+    return YES;
 }
 
 - (void)releaseCurrent:(EAGLContext *)previousEaglContext

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to