OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2014 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2014 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #import "APPRTCViewController.h" | 11 #import "APPRTCViewController.h" |
12 | 12 |
13 #import <AVFoundation/AVFoundation.h> | 13 #import <AVFoundation/AVFoundation.h> |
14 | 14 |
15 #import "WebRTC/RTCMTLNSVideoView.h" | |
15 #import "WebRTC/RTCNSGLVideoView.h" | 16 #import "WebRTC/RTCNSGLVideoView.h" |
16 #import "WebRTC/RTCVideoTrack.h" | 17 #import "WebRTC/RTCVideoTrack.h" |
17 | 18 |
18 #import "ARDAppClient.h" | 19 #import "ARDAppClient.h" |
19 | 20 |
20 static NSUInteger const kContentWidth = 900; | 21 static NSUInteger const kContentWidth = 900; |
21 static NSUInteger const kRoomFieldWidth = 200; | 22 static NSUInteger const kRoomFieldWidth = 200; |
22 static NSUInteger const kActionItemHeight = 30; | 23 static NSUInteger const kActionItemHeight = 30; |
23 static NSUInteger const kBottomViewHeight = 200; | 24 static NSUInteger const kBottomViewHeight = 200; |
24 | 25 |
25 @class APPRTCMainView; | 26 @class APPRTCMainView; |
26 @protocol APPRTCMainViewDelegate | 27 @protocol APPRTCMainViewDelegate |
27 | 28 |
28 - (void)appRTCMainView:(APPRTCMainView*)mainView | 29 - (void)appRTCMainView:(APPRTCMainView*)mainView |
29 didEnterRoomId:(NSString*)roomId | 30 didEnterRoomId:(NSString*)roomId |
30 loopback:(BOOL)isLoopback; | 31 loopback:(BOOL)isLoopback; |
31 | 32 |
32 @end | 33 @end |
33 | 34 |
34 @interface APPRTCMainView : NSView | 35 @interface APPRTCMainView : NSView |
35 | 36 |
36 @property(nonatomic, weak) id<APPRTCMainViewDelegate> delegate; | 37 @property(nonatomic, weak) id<APPRTCMainViewDelegate> delegate; |
37 @property(nonatomic, readonly) RTCNSGLVideoView* localVideoView; | 38 @property(nonatomic, readonly) RTCNSGLVideoView* localVideoView; |
38 @property(nonatomic, readonly) RTCNSGLVideoView* remoteVideoView; | 39 @property(nonatomic, readonly) NSView<RTCVideoRenderer>* remoteVideoView; |
39 | 40 |
40 - (void)displayLogMessage:(NSString*)message; | 41 - (void)displayLogMessage:(NSString*)message; |
41 | 42 |
42 @end | 43 @end |
43 | 44 |
44 @interface APPRTCMainView () <NSTextFieldDelegate, RTCNSGLVideoViewDelegate> | 45 @interface APPRTCMainView () <NSTextFieldDelegate, RTCNSGLVideoViewDelegate> |
45 @end | 46 @end |
46 @implementation APPRTCMainView { | 47 @implementation APPRTCMainView { |
47 NSScrollView* _scrollView; | 48 NSScrollView* _scrollView; |
48 NSView* _actionItemsView; | 49 NSView* _actionItemsView; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 } | 171 } |
171 | 172 |
172 [self.delegate appRTCMainView:self | 173 [self.delegate appRTCMainView:self |
173 didEnterRoomId:roomString | 174 didEnterRoomId:roomString |
174 loopback:_loopbackButton.intValue]; | 175 loopback:_loopbackButton.intValue]; |
175 } | 176 } |
176 | 177 |
177 #pragma mark - RTCNSGLVideoViewDelegate | 178 #pragma mark - RTCNSGLVideoViewDelegate |
178 | 179 |
179 - (void)videoView:(RTCNSGLVideoView*)videoView | 180 - (void)videoView:(RTCNSGLVideoView*)videoView |
180 didChangeVideoSize:(NSSize)size { | 181 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.
| |
181 if (videoView == _remoteVideoView) { | 182 if (videoView == _remoteVideoView) { |
182 _remoteVideoSize = size; | 183 _remoteVideoSize = size; |
183 } else if (videoView == _localVideoView) { | 184 } else if (videoView == _localVideoView) { |
184 _localVideoSize = size; | 185 _localVideoSize = size; |
185 } else { | 186 } else { |
186 return; | 187 return; |
187 } | 188 } |
188 | 189 |
189 [self setNeedsUpdateConstraints:YES]; | 190 [self setNeedsUpdateConstraints:YES]; |
190 } | 191 } |
(...skipping 15 matching lines...) Expand all Loading... | |
206 [_logView setEditable:NO]; | 207 [_logView setEditable:NO]; |
207 | 208 |
208 [self setupActionItemsView]; | 209 [self setupActionItemsView]; |
209 | 210 |
210 _scrollView = [[NSScrollView alloc] initWithFrame:NSZeroRect]; | 211 _scrollView = [[NSScrollView alloc] initWithFrame:NSZeroRect]; |
211 [_scrollView setTranslatesAutoresizingMaskIntoConstraints:NO]; | 212 [_scrollView setTranslatesAutoresizingMaskIntoConstraints:NO]; |
212 [_scrollView setHasVerticalScroller:YES]; | 213 [_scrollView setHasVerticalScroller:YES]; |
213 [_scrollView setDocumentView:_logView]; | 214 [_scrollView setDocumentView:_logView]; |
214 [self addSubview:_scrollView]; | 215 [self addSubview:_scrollView]; |
215 | 216 |
216 NSOpenGLPixelFormatAttribute attributes[] = { | 217 NSOpenGLPixelFormatAttribute attributes[] = { |
magjed_webrtc
2017/03/28 11:20:29
Move this and |pixelFormat| into the else-statemen
daniela-webrtc
2017/03/28 14:58:05
Done.
| |
217 NSOpenGLPFADoubleBuffer, | 218 NSOpenGLPFADoubleBuffer, |
218 NSOpenGLPFADepthSize, 24, | 219 NSOpenGLPFADepthSize, 24, |
219 NSOpenGLPFAOpenGLProfile, | 220 NSOpenGLPFAOpenGLProfile, |
220 NSOpenGLProfileVersion3_2Core, | 221 NSOpenGLProfileVersion3_2Core, |
221 0 | 222 0 |
222 }; | 223 }; |
223 NSOpenGLPixelFormat* pixelFormat = | 224 NSOpenGLPixelFormat* pixelFormat = |
224 [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes]; | 225 [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes]; |
225 _remoteVideoView = [[RTCNSGLVideoView alloc] initWithFrame:NSZeroRect | 226 |
226 pixelFormat:pixelFormat]; | 227 // NOTE (daniela): Ignoring Clang diagonstic here. |
228 // We're performing run time check to make sure class is available on runtime. | |
229 // If not we're providing sensible default. | |
230 #pragma clang diagnostic push | |
231 #pragma clang diagnostic ignored "-Wpartial-availability" | |
232 if ([RTCMTLNSVideoView class]) { | |
233 _remoteVideoView = [[RTCMTLNSVideoView alloc] initWithFrame:NSZeroRect]; | |
234 } else { | |
235 RTCNSGLVideoView* remote = | |
236 [[RTCNSGLVideoView alloc] initWithFrame:NSZeroRect pixelFormat:pixelForm at]; | |
237 remote.delegate = self; | |
238 _remoteVideoView = remote; | |
239 } | |
240 #pragma clang diagnostic pop | |
241 | |
227 [_remoteVideoView setTranslatesAutoresizingMaskIntoConstraints:NO]; | 242 [_remoteVideoView setTranslatesAutoresizingMaskIntoConstraints:NO]; |
228 _remoteVideoView.delegate = self; | 243 |
229 [self addSubview:_remoteVideoView]; | 244 [self addSubview:_remoteVideoView]; |
230 | 245 |
231 _localVideoView = [[RTCNSGLVideoView alloc] initWithFrame:NSZeroRect | 246 _localVideoView = [[RTCNSGLVideoView alloc] initWithFrame:NSZeroRect |
232 pixelFormat:pixelFormat]; | 247 pixelFormat:pixelFormat]; |
233 [_localVideoView setTranslatesAutoresizingMaskIntoConstraints:NO]; | 248 [_localVideoView setTranslatesAutoresizingMaskIntoConstraints:NO]; |
234 _localVideoView.delegate = self; | 249 _localVideoView.delegate = self; |
235 [self addSubview:_localVideoView]; | 250 [self addSubview:_localVideoView]; |
236 } | 251 } |
237 | 252 |
238 - (void)setupActionItemsView { | 253 - (void)setupActionItemsView { |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
399 [self.mainView.remoteVideoView renderFrame:nil]; | 414 [self.mainView.remoteVideoView renderFrame:nil]; |
400 [self.mainView.localVideoView renderFrame:nil]; | 415 [self.mainView.localVideoView renderFrame:nil]; |
401 } | 416 } |
402 | 417 |
403 - (void)disconnect { | 418 - (void)disconnect { |
404 [self resetUI]; | 419 [self resetUI]; |
405 [_client disconnect]; | 420 [_client disconnect]; |
406 } | 421 } |
407 | 422 |
408 @end | 423 @end |
OLD | NEW |