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

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

Issue 2778693003: MacOS: Add metal renderer and view. (Closed)
Patch Set: Address comments 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.h » ('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..fea16d20aa47cd8e617cb7ca0b594e1ae1be39af 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"
@@ -34,8 +35,8 @@ static NSUInteger const kBottomViewHeight = 200;
@interface APPRTCMainView : NSView
@property(nonatomic, weak) id<APPRTCMainViewDelegate> delegate;
-@property(nonatomic, readonly) RTCNSGLVideoView* localVideoView;
-@property(nonatomic, readonly) RTCNSGLVideoView* remoteVideoView;
+@property(nonatomic, readonly) NSView<RTCVideoRenderer>* localVideoView;
+@property(nonatomic, readonly) NSView<RTCVideoRenderer>* remoteVideoView;
- (void)displayLogMessage:(NSString*)message;
@@ -168,10 +169,10 @@ static NSUInteger const kBottomViewHeight = 200;
roomString = [NSUUID UUID].UUIDString;
roomString = [roomString stringByReplacingOccurrencesOfString:@"-" withString:@""];
}
-
[self.delegate appRTCMainView:self
didEnterRoomId:roomString
loopback:_loopbackButton.intValue];
+ [self setNeedsUpdateConstraints:YES];
}
#pragma mark - RTCNSGLVideoViewDelegate
@@ -213,25 +214,41 @@ static NSUInteger const kBottomViewHeight = 200;
[_scrollView setDocumentView:_logView];
[self addSubview:_scrollView];
- NSOpenGLPixelFormatAttribute attributes[] = {
- NSOpenGLPFADoubleBuffer,
- NSOpenGLPFADepthSize, 24,
- NSOpenGLPFAOpenGLProfile,
- NSOpenGLProfileVersion3_2Core,
- 0
- };
- 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];
+ _localVideoView = [[RTCMTLNSVideoView alloc] initWithFrame:NSZeroRect];
+ } else {
+ NSOpenGLPixelFormatAttribute attributes[] = {
+ NSOpenGLPFADoubleBuffer,
+ NSOpenGLPFADepthSize, 24,
+ NSOpenGLPFAOpenGLProfile,
+ NSOpenGLProfileVersion3_2Core,
+ 0
+ };
+ NSOpenGLPixelFormat* pixelFormat =
+ [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
+
+ RTCNSGLVideoView* remote =
+ [[RTCNSGLVideoView alloc] initWithFrame:NSZeroRect pixelFormat:pixelFormat];
+ remote.delegate = self;
+ _remoteVideoView = remote;
+
+ RTCNSGLVideoView* local =
+ [[RTCNSGLVideoView alloc] initWithFrame:NSZeroRect pixelFormat:pixelFormat];
+ local.delegate = self;
+ _localVideoView = local;
+ }
+#pragma clang diagnostic pop
+
[_remoteVideoView setTranslatesAutoresizingMaskIntoConstraints:NO];
- _remoteVideoView.delegate = self;
[self addSubview:_remoteVideoView];
-
- _localVideoView = [[RTCNSGLVideoView alloc] initWithFrame:NSZeroRect
- pixelFormat:pixelFormat];
[_localVideoView setTranslatesAutoresizingMaskIntoConstraints:NO];
- _localVideoView.delegate = self;
[self addSubview:_localVideoView];
}
« no previous file with comments | « no previous file | webrtc/sdk/BUILD.gn » ('j') | webrtc/sdk/objc/Framework/Classes/Metal/RTCMTLI420Renderer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698