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

Unified Diff: webrtc/examples/objc/AppRTCMobile/ios/ARDVideoCallViewController.m

Issue 2778163005: Use new RTCCameraVideoCapturer in AppRTCMobile. (Closed)
Patch Set: Rename remaining media constraint references. 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
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..fa53b3d0c6d7f25144ca9dbf2614afc8224c2b07 100644
--- a/webrtc/examples/objc/AppRTCMobile/ios/ARDVideoCallViewController.m
+++ b/webrtc/examples/objc/AppRTCMobile/ios/ARDVideoCallViewController.m
@@ -13,6 +13,7 @@
#import "webrtc/modules/audio_device/ios/objc/RTCAudioSession.h"
#import "ARDAppClient.h"
+#import "ARDCaptureController.h"
#import "ARDSettingsModel.h"
#import "ARDVideoCallView.h"
#import "WebRTC/RTCAVFoundationVideoSource.h"
@@ -22,7 +23,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 +31,12 @@
@implementation ARDVideoCallViewController {
ARDAppClient *_client;
RTCVideoTrack *_remoteVideoTrack;
- RTCVideoTrack *_localVideoTrack;
+ ARDCaptureController *_captureController;
AVAudioSessionPortOverride _portOverride;
}
+@synthesize localCapturer = _localCapturer;
@synthesize videoCallView = _videoCallView;
-@synthesize localVideoTrack = _localVideoTrack;
@synthesize remoteVideoTrack = _remoteVideoTrack;
@synthesize delegate = _delegate;
@@ -48,6 +49,7 @@
if (self = [super init]) {
ARDSettingsModel *settingsModel = [[ARDSettingsModel alloc] init];
_delegate = delegate;
+
_client = [[ARDAppClient alloc] initWithDelegate:self];
[_client connectToRoomWithId:room
settings:settingsModel
@@ -97,8 +99,15 @@
}
- (void)appClient:(ARDAppClient *)client
+ didCreateLocalCapturer:(RTCCameraVideoCapturer *)localCapturer {
+ ARDSettingsModel *settingsModel = [[ARDSettingsModel alloc] init];
+ _captureController =
+ [[ARDCaptureController alloc] initWithCapturer:localCapturer settings:settingsModel];
+ [_captureController startCapture];
daniela-webrtc 2017/04/04 12:25:21 I'd add [_capturerController stopCapture] in [self
sakal 2017/04/05 12:35:49 Done.
+}
+
+- (void)appClient:(ARDAppClient *)client
didReceiveLocalVideoTrack:(RTCVideoTrack *)localVideoTrack {
- self.localVideoTrack = localVideoTrack;
}
- (void)appClient:(ARDAppClient *)client
@@ -130,7 +139,7 @@
- (void)videoCallViewDidSwitchCamera:(ARDVideoCallView *)view {
// TODO(tkchin): Rate limit this so you can't tap continously on it.
// Probably through an animation.
- [self switchCamera];
+ [_captureController switchCamera];
}
- (void)videoCallViewDidChangeRoute:(ARDVideoCallView *)view {
@@ -160,18 +169,12 @@
#pragma mark - Private
-- (void)setLocalVideoTrack:(RTCVideoTrack *)localVideoTrack {
- if (_localVideoTrack == localVideoTrack) {
+- (void)setLocalCapturer:(RTCCameraVideoCapturer *)localCapturer {
daniela-webrtc 2017/04/04 12:25:20 I don't see this being called anywhere except on 1
daniela-webrtc 2017/04/04 12:25:21 Also, we don't need to keep reference to the RTCCa
sakal 2017/04/05 12:35:49 Done.
+ 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 +190,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:
« no previous file with comments | « webrtc/examples/objc/AppRTCMobile/ios/ARDVideoCallView.m ('k') | webrtc/examples/objc/AppRTCMobile/mac/APPRTCViewController.m » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698