Index: talk/app/webrtc/objc/RTCEAGLVideoView.m |
diff --git a/talk/app/webrtc/objc/RTCEAGLVideoView.m b/talk/app/webrtc/objc/RTCEAGLVideoView.m |
index 61040ba1025c2f23eed07f916df93d36b2955d76..961d809b47fc016866ca744492851a958a5d266c 100644 |
--- a/talk/app/webrtc/objc/RTCEAGLVideoView.m |
+++ b/talk/app/webrtc/objc/RTCEAGLVideoView.m |
@@ -137,6 +137,7 @@ |
_glkView.drawableMultisample = GLKViewDrawableMultisampleNone; |
_glkView.delegate = self; |
_glkView.layer.masksToBounds = YES; |
+ _glkView.enableSetNeedsDisplay = NO; |
[self addSubview:_glkView]; |
// Listen to application state in order to clean up OpenGL before app goes |
@@ -158,13 +159,7 @@ |
__weak RTCEAGLVideoView* weakSelf = self; |
_timer = [[RTCDisplayLinkTimer alloc] initWithTimerHandler:^{ |
RTCEAGLVideoView* strongSelf = weakSelf; |
- // Don't render if frame hasn't changed. |
- if (strongSelf.glRenderer.lastDrawnFrame == strongSelf.i420Frame) { |
- return; |
- } |
- // This tells the GLKView that it's dirty, which will then call the |
- // GLKViewDelegate method implemented below. |
- [strongSelf.glkView setNeedsDisplay]; |
+ [strongSelf displayLinkTimerDidFire]; |
}]; |
[self setupGL]; |
} |
@@ -213,6 +208,21 @@ |
#pragma mark - Private |
+- (void)displayLinkTimerDidFire { |
+ // Don't render if frame hasn't changed. |
+ if (_glRenderer.lastDrawnFrame == self.i420Frame) { |
+ return; |
+ } |
+ |
+ // Only call -[GLKView display] if the drawable size is |
+ // non-empty. Calling display will make the GLKView setup it's |
magjed_webrtc
2015/09/18 09:24:14
nit: s/it's/its/g
|
+ // render buffer if necessary, but that will fail with error |
+ // GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT if size is empty. |
+ if (self.bounds.size.width > 0 && self.bounds.size.height > 0) { |
+ [_glkView display]; |
magjed_webrtc
2015/09/18 09:24:14
It looks like you changed setNeedsDisplay to displ
|
+ } |
+} |
+ |
- (void)setupGL { |
self.i420Frame = nil; |
[_glRenderer setupGL]; |