Use new RTCCameraVideoCapturer in AppRTCMobile.
Because the new API doesn't use constraints, refactors settings to instead have a
video resolution setting.
BUG=webrtc:7177
Review-Url: https://codereview.webrtc.org/2778163005
Cr-Commit-Position: refs/heads/master@{#17545}
diff --git a/webrtc/examples/objc/AppRTCMobile/ARDAppClient.m b/webrtc/examples/objc/AppRTCMobile/ARDAppClient.m
index ef38138..7e06612 100644
--- a/webrtc/examples/objc/AppRTCMobile/ARDAppClient.m
+++ b/webrtc/examples/objc/AppRTCMobile/ARDAppClient.m
@@ -12,6 +12,7 @@
#import "WebRTC/RTCAVFoundationVideoSource.h"
#import "WebRTC/RTCAudioTrack.h"
+#import "WebRTC/RTCCameraVideoCapturer.h"
#import "WebRTC/RTCConfiguration.h"
#import "WebRTC/RTCFileLogger.h"
#import "WebRTC/RTCIceServer.h"
@@ -21,6 +22,7 @@
#import "WebRTC/RTCPeerConnectionFactory.h"
#import "WebRTC/RTCRtpSender.h"
#import "WebRTC/RTCTracing.h"
+#import "WebRTC/RTCVideoTrack.h"
#import "ARDAppEngineClient.h"
#import "ARDJoinResponse.h"
@@ -100,6 +102,7 @@
RTCFileLogger *_fileLogger;
ARDTimerProxy *_statsTimer;
ARDSettingsModel *_settings;
+ RTCVideoTrack *_localVideoTrack;
}
@synthesize shouldGetStats = _shouldGetStats;
@@ -305,6 +308,7 @@
_isInitiator = NO;
_hasReceivedSdp = NO;
_messageQueue = [NSMutableArray array];
+ _localVideoTrack = nil;
#if defined(WEBRTC_IOS)
[_factory stopAecDump];
[_peerConnection stopRtcEventLog];
@@ -666,10 +670,10 @@
RTCRtpSender *sender =
[_peerConnection senderWithKind:kRTCMediaStreamTrackKindVideo
streamId:kARDMediaStreamId];
- RTCVideoTrack *track = [self createLocalVideoTrack];
- if (track) {
- sender.track = track;
- [_delegate appClient:self didReceiveLocalVideoTrack:track];
+ _localVideoTrack = [self createLocalVideoTrack];
+ if (_localVideoTrack) {
+ sender.track = _localVideoTrack;
+ [_delegate appClient:self didReceiveLocalVideoTrack:_localVideoTrack];
}
return sender;
@@ -716,10 +720,9 @@
// trying to open a local stream.
#if !TARGET_IPHONE_SIMULATOR
if (!_isAudioOnly) {
- RTCMediaConstraints *cameraConstraints =
- [self cameraConstraints];
- RTCAVFoundationVideoSource *source =
- [_factory avFoundationVideoSourceWithConstraints:cameraConstraints];
+ RTCVideoSource *source = [_factory videoSource];
+ RTCCameraVideoCapturer *capturer = [[RTCCameraVideoCapturer alloc] initWithDelegate:source];
+ [_delegate appClient:self didCreateLocalCapturer:capturer];
localVideoTrack =
[_factory videoTrackWithSource:source
trackId:kARDVideoTrackId];
@@ -764,13 +767,6 @@
return constraints;
}
-- (RTCMediaConstraints *)cameraConstraints {
- RTCMediaConstraints *cameraConstraints = [[RTCMediaConstraints alloc]
- initWithMandatoryConstraints:nil
- optionalConstraints:[_settings currentMediaConstraintFromStoreAsRTCDictionary]];
- return cameraConstraints;
-}
-
- (RTCMediaConstraints *)defaultAnswerConstraints {
return [self defaultOfferConstraints];
}