[vlc-commits] vout iOS: reliability improvements

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


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

vout iOS: reliability improvements

(cherry picked from commit ccd2a9a1408843ed57521eb7149df806d3d9d3d2)

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

 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 da8f5e3..feb18c4 100644
--- a/modules/video_output/ios2.m
+++ b/modules/video_output/ios2.m
@@ -135,7 +135,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]])
@@ -406,21 +409,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