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

Unified Diff: webrtc/examples/objc/AppRTCMobile/mac/APPRTCViewController.m

Issue 2778693003: MacOS: Add metal renderer and view. (Closed)
Patch Set: Revert not needed change Created 3 years, 9 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 | webrtc/sdk/BUILD.gn » ('j') | webrtc/sdk/objc/Framework/Classes/Metal/RTCMTLI420Renderer.mm » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/examples/objc/AppRTCMobile/mac/APPRTCViewController.m
diff --git a/webrtc/examples/objc/AppRTCMobile/mac/APPRTCViewController.m b/webrtc/examples/objc/AppRTCMobile/mac/APPRTCViewController.m
index bcf26b258e745076693a60778653b98b5cc83dbf..28ac9e29321ab81a7fd151fa5bdc801747b138ec 100644
--- a/webrtc/examples/objc/AppRTCMobile/mac/APPRTCViewController.m
+++ b/webrtc/examples/objc/AppRTCMobile/mac/APPRTCViewController.m
@@ -12,6 +12,7 @@
#import <AVFoundation/AVFoundation.h>
+#import "WebRTC/RTCMTLNSVideoView.h"
#import "WebRTC/RTCNSGLVideoView.h"
#import "WebRTC/RTCVideoTrack.h"
@@ -35,7 +36,7 @@ static NSUInteger const kBottomViewHeight = 200;
@property(nonatomic, weak) id<APPRTCMainViewDelegate> delegate;
@property(nonatomic, readonly) RTCNSGLVideoView* localVideoView;
-@property(nonatomic, readonly) RTCNSGLVideoView* remoteVideoView;
+@property(nonatomic, readonly) NSView<RTCVideoRenderer>* remoteVideoView;
- (void)displayLogMessage:(NSString*)message;
@@ -177,7 +178,7 @@ static NSUInteger const kBottomViewHeight = 200;
#pragma mark - RTCNSGLVideoViewDelegate
- (void)videoView:(RTCNSGLVideoView*)videoView
- didChangeVideoSize:(NSSize)size {
+didChangeVideoSize:(NSSize)size {
magjed_webrtc 2017/03/28 11:20:29 Indentation must be wrong here?
daniela-webrtc 2017/03/28 14:58:05 Done.
if (videoView == _remoteVideoView) {
_remoteVideoSize = size;
} else if (videoView == _localVideoView) {
@@ -222,10 +223,24 @@ static NSUInteger const kBottomViewHeight = 200;
};
NSOpenGLPixelFormat* pixelFormat =
[[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
- _remoteVideoView = [[RTCNSGLVideoView alloc] initWithFrame:NSZeroRect
- pixelFormat:pixelFormat];
+
+// NOTE (daniela): Ignoring Clang diagonstic here.
+// We're performing run time check to make sure class is available on runtime.
+// If not we're providing sensible default.
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpartial-availability"
+ if ([RTCMTLNSVideoView class]) {
+ _remoteVideoView = [[RTCMTLNSVideoView alloc] initWithFrame:NSZeroRect];
+ } else {
+ RTCNSGLVideoView* remote =
+ [[RTCNSGLVideoView alloc] initWithFrame:NSZeroRect pixelFormat:pixelFormat];
+ remote.delegate = self;
+ _remoteVideoView = remote;
+ }
+#pragma clang diagnostic pop
+
[_remoteVideoView setTranslatesAutoresizingMaskIntoConstraints:NO];
- _remoteVideoView.delegate = self;
+
[self addSubview:_remoteVideoView];
_localVideoView = [[RTCNSGLVideoView alloc] initWithFrame:NSZeroRect
« no previous file with comments | « no previous file | webrtc/sdk/BUILD.gn » ('j') | webrtc/sdk/objc/Framework/Classes/Metal/RTCMTLI420Renderer.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698