Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Unified Diff: webrtc/sdk/objc/Framework/Classes/UI/RTCEAGLVideoView.m

Issue 2991863002: ObjC RTCEAGLVideoVideo: Check GL context is non-nil in constructor (Closed)
Patch Set: RTCLogError Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/sdk/objc/Framework/Classes/UI/RTCEAGLVideoView.m
diff --git a/webrtc/sdk/objc/Framework/Classes/UI/RTCEAGLVideoView.m b/webrtc/sdk/objc/Framework/Classes/UI/RTCEAGLVideoView.m
index 89b7dfcc2ebe637ee3869c1e3b2d1380b1bf95a0..80282f0b0b49dfefa1d59ec7a22caf2f9e5b5364 100644
--- a/webrtc/sdk/objc/Framework/Classes/UI/RTCEAGLVideoView.m
+++ b/webrtc/sdk/objc/Framework/Classes/UI/RTCEAGLVideoView.m
@@ -121,7 +121,9 @@
- (instancetype)initWithFrame:(CGRect)frame shader:(id<RTCVideoViewShading>)shader {
if (self = [super initWithFrame:frame]) {
_shader = shader;
- [self configure];
+ if (![self configure]) {
+ return nil;
+ }
}
return self;
}
@@ -129,17 +131,23 @@
- (instancetype)initWithCoder:(NSCoder *)aDecoder shader:(id<RTCVideoViewShading>)shader {
if (self = [super initWithCoder:aDecoder]) {
_shader = shader;
- [self configure];
+ if (![self configure]) {
+ return nil;
+ }
}
return self;
}
-- (void)configure {
+- (BOOL)configure {
EAGLContext *glContext =
[[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3];
if (!glContext) {
glContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
}
+ if (!glContext) {
+ RTCLogError(@"Failed to create EAGLContext");
+ return NO;
+ }
_glContext = glContext;
// GLKView manages a framebuffer for us.
@@ -176,6 +184,7 @@
[strongSelf displayLinkTimerDidFire];
}];
[self setupGL];
+ return YES;
}
- (void)dealloc {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698