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 |
16 static CGFloat const kButtonPadding = 16; | 20 static CGFloat const kButtonPadding = 16; |
17 static CGFloat const kButtonSize = 48; | 21 static CGFloat const kButtonSize = 48; |
18 static CGFloat const kLocalVideoViewSize = 120; | 22 static CGFloat const kLocalVideoViewSize = 120; |
19 static CGFloat const kLocalVideoViewPadding = 8; | 23 static CGFloat const kLocalVideoViewPadding = 8; |
20 static CGFloat const kStatusBarHeight = 20; | 24 static CGFloat const kStatusBarHeight = 20; |
21 | 25 |
22 @interface ARDVideoCallView () <RTCEAGLVideoViewDelegate> | 26 @interface ARDVideoCallView () <RTCEAGLVideoViewDelegate> |
23 @end | 27 @end |
24 | 28 |
25 @implementation ARDVideoCallView { | 29 @implementation ARDVideoCallView { |
26 UIButton *_routeChangeButton; | 30 UIButton *_routeChangeButton; |
27 UIButton *_cameraSwitchButton; | 31 UIButton *_cameraSwitchButton; |
28 UIButton *_hangupButton; | 32 UIButton *_hangupButton; |
29 CGSize _remoteVideoSize; | 33 CGSize _remoteVideoSize; |
30 BOOL _useRearCamera; | 34 BOOL _useRearCamera; |
31 } | 35 } |
32 | 36 |
33 @synthesize statusLabel = _statusLabel; | 37 @synthesize statusLabel = _statusLabel; |
34 @synthesize localVideoView = _localVideoView; | 38 @synthesize localVideoView = _localVideoView; |
35 @synthesize remoteVideoView = _remoteVideoView; | 39 @synthesize remoteVideoView = _remoteVideoView; |
36 @synthesize statsView = _statsView; | 40 @synthesize statsView = _statsView; |
37 @synthesize delegate = _delegate; | 41 @synthesize delegate = _delegate; |
38 | 42 |
39 - (instancetype)initWithFrame:(CGRect)frame { | 43 - (instancetype)initWithFrame:(CGRect)frame { |
40 if (self = [super initWithFrame:frame]) { | 44 if (self = [super initWithFrame:frame]) { |
41 _remoteVideoView = [[RTCEAGLVideoView alloc] initWithFrame:CGRectZero]; | 45 |
42 _remoteVideoView.delegate = self; | 46 #if defined(RTC_SUPPORTS_METAL) |
| 47 _remoteVideoView = [[RTCMTLVideoView alloc] initWithFrame:CGRectZero]; |
| 48 #else |
| 49 RTCEAGLVideoView *remoteView = [[RTCEAGLVideoView alloc] initWithFrame:CGRec
tZero]; |
| 50 remoteView.delegate = self; |
| 51 _remoteVideoView = remoteView; |
| 52 #endif |
| 53 |
43 [self addSubview:_remoteVideoView]; | 54 [self addSubview:_remoteVideoView]; |
44 | 55 |
45 _localVideoView = [[RTCCameraPreviewView alloc] initWithFrame:CGRectZero]; | 56 _localVideoView = [[RTCCameraPreviewView alloc] initWithFrame:CGRectZero]; |
46 [self addSubview:_localVideoView]; | 57 [self addSubview:_localVideoView]; |
47 | 58 |
48 _statsView = [[ARDStatsView alloc] initWithFrame:CGRectZero]; | 59 _statsView = [[ARDStatsView alloc] initWithFrame:CGRectZero]; |
49 _statsView.hidden = YES; | 60 _statsView.hidden = YES; |
50 [self addSubview:_statsView]; | 61 [self addSubview:_statsView]; |
51 | 62 |
52 _routeChangeButton = [UIButton buttonWithType:UIButtonTypeCustom]; | 63 _routeChangeButton = [UIButton buttonWithType:UIButtonTypeCustom]; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 195 |
185 - (void)onHangup:(id)sender { | 196 - (void)onHangup:(id)sender { |
186 [_delegate videoCallViewDidHangup:self]; | 197 [_delegate videoCallViewDidHangup:self]; |
187 } | 198 } |
188 | 199 |
189 - (void)didTripleTap:(UITapGestureRecognizer *)recognizer { | 200 - (void)didTripleTap:(UITapGestureRecognizer *)recognizer { |
190 [_delegate videoCallViewDidEnableStats:self]; | 201 [_delegate videoCallViewDidEnableStats:self]; |
191 } | 202 } |
192 | 203 |
193 @end | 204 @end |
OLD | NEW |