[vlc-commits] vout iOS: reliability improvements

Felix Paul Kühne git at videolan.org
Wed Jul 1 14:18:25 CEST 2015


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Wed Jul  1 13:50:54 2015 +0200| [ccd2a9a1408843ed57521eb7149df806d3d9d3d2] | committer: Felix Paul Kühne

vout iOS: reliability improvements

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

 modules/video_output/ios2.m |   31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/modules/video_output/ios2.m b/modules/video_output/ios2.m
index 07d53a1..68a35fa 100644
--- a/modules/video_output/ios2.m
+++ b/modules/video_output/ios2.m
@@ -139,7 +139,10 @@ static int Open(vlc_object_t *this)
 
     /* get the object we will draw into */
     UIView* viewContainer = var_CreateGetAddress (vd, "drawable-nsobject");
-    if (!viewContainer)
+    if (unlikely(viewContainer == nil))
+        goto bailout;
+
+    if (unlikely(![viewContainer respondsToSelector:@selector(isKindOfClass:)]))
         goto bailout;
 
     if (![viewContainer isKindOfClass:[UIView class]])
@@ -400,21 +403,23 @@ static void OpenglESSwap(vlc_gl_t *gl)
     if (!self)
         return nil;
 
-    CAEAGLLayer * layer = (CAEAGLLayer *)self.layer;
-    layer.drawableProperties = [NSDictionary dictionaryWithObject:kEAGLColorFormatRGBA8 forKey: kEAGLDrawablePropertyColorFormat];
-    layer.opaque = YES;
+    @synchronized (self) {
+        _appActive = ([UIApplication sharedApplication].applicationState == UIApplicationStateActive);
+        if (unlikely(!_appActive))
+            return nil;
 
-    _eaglContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
-    if (!_eaglContext)
-        return nil;
-    [EAGLContext setCurrentContext:_eaglContext];
+        CAEAGLLayer * layer = (CAEAGLLayer *)self.layer;
+        layer.drawableProperties = [NSDictionary dictionaryWithObject:kEAGLColorFormatRGBA8 forKey: kEAGLDrawablePropertyColorFormat];
+        layer.opaque = YES;
 
-    [self performSelectorOnMainThread:@selector(createBuffers) withObject:nil waitUntilDone:YES];
-    [self performSelectorOnMainThread:@selector(reshape) withObject:nil waitUntilDone:NO];
-    [self setAutoresizingMask: UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
+        _eaglContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
+        if (!_eaglContext)
+            return nil;
+        [EAGLContext setCurrentContext:_eaglContext];
 
-    @synchronized (self) {
-        _appActive = ([UIApplication sharedApplication].applicationState == UIApplicationStateActive);
+        [self performSelectorOnMainThread:@selector(createBuffers) withObject:nil waitUntilDone:YES];
+        [self performSelectorOnMainThread:@selector(reshape) withObject:nil waitUntilDone:NO];
+        [self setAutoresizingMask: UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
     }
 
     return self;



More information about the vlc-commits mailing list