Commit ccd2a9a1 authored by Felix Paul Kühne's avatar Felix Paul Kühne

vout iOS: reliability improvements

parent 18b21461
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment