OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2015 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 "ARDVideoCallView.h" | 11 #import "ARDVideoCallView.h" |
12 | 12 |
13 #import <AVFoundation/AVFoundation.h> | 13 #import <AVFoundation/AVFoundation.h> |
14 | |
15 #import <WebRTC/RTCEAGLVideoView.h> | |
16 #import <WebRTC/RTCMTLVideoView.h> | |
17 | |
14 #import "UIImage+ARDUtilities.h" | 18 #import "UIImage+ARDUtilities.h" |
15 | 19 |
20 | |
kthelgason
2017/02/28 10:03:10
nit: empty line
| |
16 static CGFloat const kButtonPadding = 16; | 21 static CGFloat const kButtonPadding = 16; |
17 static CGFloat const kButtonSize = 48; | 22 static CGFloat const kButtonSize = 48; |
18 static CGFloat const kLocalVideoViewSize = 120; | 23 static CGFloat const kLocalVideoViewSize = 120; |
19 static CGFloat const kLocalVideoViewPadding = 8; | 24 static CGFloat const kLocalVideoViewPadding = 8; |
20 static CGFloat const kStatusBarHeight = 20; | 25 static CGFloat const kStatusBarHeight = 20; |
21 | 26 |
22 @interface ARDVideoCallView () <RTCEAGLVideoViewDelegate> | 27 @interface ARDVideoCallView () <RTCEAGLVideoViewDelegate> |
23 @end | 28 @end |
24 | 29 |
25 @implementation ARDVideoCallView { | 30 @implementation ARDVideoCallView { |
26 UIButton *_routeChangeButton; | 31 UIButton *_routeChangeButton; |
27 UIButton *_cameraSwitchButton; | 32 UIButton *_cameraSwitchButton; |
28 UIButton *_hangupButton; | 33 UIButton *_hangupButton; |
29 CGSize _remoteVideoSize; | 34 CGSize _remoteVideoSize; |
30 BOOL _useRearCamera; | 35 BOOL _useRearCamera; |
31 } | 36 } |
32 | 37 |
33 @synthesize statusLabel = _statusLabel; | 38 @synthesize statusLabel = _statusLabel; |
34 @synthesize localVideoView = _localVideoView; | 39 @synthesize localVideoView = _localVideoView; |
35 @synthesize remoteVideoView = _remoteVideoView; | 40 @synthesize remoteVideoView = _remoteVideoView; |
36 @synthesize statsView = _statsView; | 41 @synthesize statsView = _statsView; |
37 @synthesize delegate = _delegate; | 42 @synthesize delegate = _delegate; |
38 | 43 |
39 - (instancetype)initWithFrame:(CGRect)frame { | 44 - (instancetype)initWithFrame:(CGRect)frame { |
40 if (self = [super initWithFrame:frame]) { | 45 if (self = [super initWithFrame:frame]) { |
41 _remoteVideoView = [[RTCEAGLVideoView alloc] initWithFrame:CGRectZero]; | 46 |
42 _remoteVideoView.delegate = self; | 47 #if defined(RTC_SUPPORTS_METAL) && RTC_SUPPORTS_METAL |
kthelgason
2017/02/28 10:03:10
just #if RTC_SUPPORTS_METAL should be enough.
| |
48 _remoteVideoView = [[RTCMTLVideoView alloc] initWithFrame:CGRectZero]; | |
49 #else | |
50 RTCEAGLVideoView *remoteView = [[RTCEAGLVideoView alloc] initWithFrame:CGRec tZero]; | |
kthelgason
2017/02/28 10:03:10
this temp variable looks unnecessary, can we assig
daniela-webrtc
2017/02/28 14:27:12
The temp is to avoid casting.
| |
51 remoteView.delegate = self; | |
52 _remoteVideoView = remoteView; | |
53 #endif | |
54 | |
43 [self addSubview:_remoteVideoView]; | 55 [self addSubview:_remoteVideoView]; |
44 | 56 |
45 _localVideoView = [[RTCCameraPreviewView alloc] initWithFrame:CGRectZero]; | 57 _localVideoView = [[RTCCameraPreviewView alloc] initWithFrame:CGRectZero]; |
46 [self addSubview:_localVideoView]; | 58 [self addSubview:_localVideoView]; |
47 | 59 |
48 _statsView = [[ARDStatsView alloc] initWithFrame:CGRectZero]; | 60 _statsView = [[ARDStatsView alloc] initWithFrame:CGRectZero]; |
49 _statsView.hidden = YES; | 61 _statsView.hidden = YES; |
50 [self addSubview:_statsView]; | 62 [self addSubview:_statsView]; |
51 | 63 |
52 _routeChangeButton = [UIButton buttonWithType:UIButtonTypeCustom]; | 64 _routeChangeButton = [UIButton buttonWithType:UIButtonTypeCustom]; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
184 | 196 |
185 - (void)onHangup:(id)sender { | 197 - (void)onHangup:(id)sender { |
186 [_delegate videoCallViewDidHangup:self]; | 198 [_delegate videoCallViewDidHangup:self]; |
187 } | 199 } |
188 | 200 |
189 - (void)didTripleTap:(UITapGestureRecognizer *)recognizer { | 201 - (void)didTripleTap:(UITapGestureRecognizer *)recognizer { |
190 [_delegate videoCallViewDidEnableStats:self]; | 202 [_delegate videoCallViewDidEnableStats:self]; |
191 } | 203 } |
192 | 204 |
193 @end | 205 @end |
OLD | NEW |