Index: webrtc/examples/objc/AppRTCMobile/ios/ARDVideoCallViewController.m |
diff --git a/webrtc/examples/objc/AppRTCMobile/ios/ARDVideoCallViewController.m b/webrtc/examples/objc/AppRTCMobile/ios/ARDVideoCallViewController.m |
index cd42514a9f930690df6a97deb5e807427250b9ea..fac02ed9f71e3e44c8347ae989a948a609c8c3ac 100644 |
--- a/webrtc/examples/objc/AppRTCMobile/ios/ARDVideoCallViewController.m |
+++ b/webrtc/examples/objc/AppRTCMobile/ios/ARDVideoCallViewController.m |
@@ -22,7 +22,7 @@ |
@interface ARDVideoCallViewController () <ARDAppClientDelegate, |
ARDVideoCallViewDelegate> |
-@property(nonatomic, strong) RTCVideoTrack *localVideoTrack; |
+@property(nonatomic, strong) RTCCameraVideoCapturer *localCapturer; |
@property(nonatomic, strong) RTCVideoTrack *remoteVideoTrack; |
@property(nonatomic, readonly) ARDVideoCallView *videoCallView; |
@end |
@@ -30,12 +30,12 @@ |
@implementation ARDVideoCallViewController { |
ARDAppClient *_client; |
RTCVideoTrack *_remoteVideoTrack; |
- RTCVideoTrack *_localVideoTrack; |
+ RTCCameraVideoCapturer *_localCapturer; |
AVAudioSessionPortOverride _portOverride; |
} |
+@synthesize localCapturer = _localCapturer; |
@synthesize videoCallView = _videoCallView; |
-@synthesize localVideoTrack = _localVideoTrack; |
@synthesize remoteVideoTrack = _remoteVideoTrack; |
@synthesize delegate = _delegate; |
@@ -97,8 +97,12 @@ |
} |
- (void)appClient:(ARDAppClient *)client |
+ didCreateLocalCapturer:(RTCCameraVideoCapturer *)localCapturer { |
+ self.localCapturer = localCapturer; |
+} |
+ |
+- (void)appClient:(ARDAppClient *)client |
didReceiveLocalVideoTrack:(RTCVideoTrack *)localVideoTrack { |
- self.localVideoTrack = localVideoTrack; |
} |
- (void)appClient:(ARDAppClient *)client |
@@ -130,7 +134,7 @@ |
- (void)videoCallViewDidSwitchCamera:(ARDVideoCallView *)view { |
// TODO(tkchin): Rate limit this so you can't tap continously on it. |
// Probably through an animation. |
- [self switchCamera]; |
+ [_client switchCamera]; |
} |
- (void)videoCallViewDidChangeRoute:(ARDVideoCallView *)view { |
@@ -160,18 +164,12 @@ |
#pragma mark - Private |
-- (void)setLocalVideoTrack:(RTCVideoTrack *)localVideoTrack { |
- if (_localVideoTrack == localVideoTrack) { |
+- (void)setLocalCapturer:(RTCCameraVideoCapturer *)localCapturer { |
+ if (_localCapturer == localCapturer) { |
return; |
} |
- _localVideoTrack = nil; |
- _localVideoTrack = localVideoTrack; |
- RTCAVFoundationVideoSource *source = nil; |
- if ([localVideoTrack.source |
- isKindOfClass:[RTCAVFoundationVideoSource class]]) { |
- source = (RTCAVFoundationVideoSource*)localVideoTrack.source; |
- } |
- _videoCallView.localVideoView.captureSession = source.captureSession; |
+ _localCapturer = localCapturer; |
+ _videoCallView.localVideoView.captureSession = localCapturer.captureSession; |
} |
- (void)setRemoteVideoTrack:(RTCVideoTrack *)remoteVideoTrack { |
@@ -187,19 +185,11 @@ |
- (void)hangup { |
self.remoteVideoTrack = nil; |
- self.localVideoTrack = nil; |
+ self.localCapturer = nil; |
[_client disconnect]; |
[_delegate viewControllerDidFinish:self]; |
} |
-- (void)switchCamera { |
- RTCVideoSource* source = self.localVideoTrack.source; |
- if ([source isKindOfClass:[RTCAVFoundationVideoSource class]]) { |
- RTCAVFoundationVideoSource* avSource = (RTCAVFoundationVideoSource*)source; |
- avSource.useBackCamera = !avSource.useBackCamera; |
- } |
-} |
- |
- (NSString *)statusTextForState:(RTCIceConnectionState)state { |
switch (state) { |
case RTCIceConnectionStateNew: |