diff options
author | tkchin@webrtc.org <tkchin@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2014-05-30 22:26:06 +0000 |
---|---|---|
committer | tkchin@webrtc.org <tkchin@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2014-05-30 22:26:06 +0000 |
commit | 52348f6729702ec8888955b7aa5d6b47a4727e6a (patch) | |
tree | 7cf5a5016477b1d655e5fb79aefa26f9112f3918 /app/webrtc/objc/RTCEAGLVideoView.m | |
parent | b278723e592c1ab9fe0cf1552adffe33fd61444b (diff) | |
download | talk-52348f6729702ec8888955b7aa5d6b47a4727e6a.tar.gz |
Implement mac version of AppRTCDemo.
- Refactored and moved AppRTCDemo to support sharing AppRTC connection code between iOS and mac counterparts.
- Refactored OpenGL rendering code to be shared between iOS and mac counterparts.
- iOS AppRTCDemo now respects video aspect ratio.
BUG=2168
R=fischman@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/17589004
git-svn-id: http://webrtc.googlecode.com/svn/trunk/talk@6291 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'app/webrtc/objc/RTCEAGLVideoView.m')
-rw-r--r-- | app/webrtc/objc/RTCEAGLVideoView.m | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/app/webrtc/objc/RTCEAGLVideoView.m b/app/webrtc/objc/RTCEAGLVideoView.m index b970325..a919861 100644 --- a/app/webrtc/objc/RTCEAGLVideoView.m +++ b/app/webrtc/objc/RTCEAGLVideoView.m @@ -32,20 +32,21 @@ #import "RTCEAGLVideoView+Internal.h" #import <GLKit/GLKit.h> -#import <QuartzCore/QuartzCore.h> -#import "RTCEAGLVideoRenderer.h" +#import "RTCOpenGLVideoRenderer.h" #import "RTCVideoRenderer.h" #import "RTCVideoTrack.h" @interface RTCEAGLVideoView () <GLKViewDelegate> +// |i420Frame| is set when we receive a frame from a worker thread and is read +// from the display link callback so atomicity is required. @property(atomic, strong) RTCI420Frame* i420Frame; @end @implementation RTCEAGLVideoView { CADisplayLink* _displayLink; GLKView* _glkView; - RTCEAGLVideoRenderer* _glRenderer; + RTCOpenGLVideoRenderer* _glRenderer; RTCVideoRenderer* _videoRenderer; } @@ -53,7 +54,7 @@ if (self = [super initWithFrame:frame]) { EAGLContext* glContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; - _glRenderer = [[RTCEAGLVideoRenderer alloc] initWithContext:glContext]; + _glRenderer = [[RTCOpenGLVideoRenderer alloc] initWithContext:glContext]; // GLKView manages a framebuffer for us. _glkView = [[GLKView alloc] initWithFrame:CGRectZero @@ -175,7 +176,9 @@ // provide. This occurs on non-main thread. - (void)renderer:(RTCVideoRenderer*)renderer didSetSize:(CGSize)size { - // Size is checked in renderer as frames arrive, no need to do anything here. + dispatch_async(dispatch_get_main_queue(), ^{ + [self.delegate videoView:self didChangeVideoSize:size]; + }); } - (void)renderer:(RTCVideoRenderer*)renderer |