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

Unified Diff: webrtc/examples/objc/AppRTCMobile/ARDAppClient.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/ARDAppClient.m
diff --git a/webrtc/examples/objc/AppRTCMobile/ARDAppClient.m b/webrtc/examples/objc/AppRTCMobile/ARDAppClient.m
index ef38138319ac56b2e9655eaec5cedef932cbd2f7..50d9f3d4b596c89c1c8a85a9db26a632d2d426cc 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,8 @@ static int const kKbpsMultiplier = 1000;
RTCFileLogger *_fileLogger;
ARDTimerProxy *_statsTimer;
ARDSettingsModel *_settings;
+ RTCCameraVideoCapturer *_capturer;
+ RTCVideoTrack *_localVideoTrack;
}
@synthesize shouldGetStats = _shouldGetStats;
@@ -300,11 +304,16 @@ static int const kKbpsMultiplier = 1000;
// Disconnect from collider.
_channel = nil;
}
+ if (_capturer) {
+ [_capturer stopCapture];
+ _capturer = nil;
+ }
_clientId = nil;
_roomId = nil;
_isInitiator = NO;
_hasReceivedSdp = NO;
_messageQueue = [NSMutableArray array];
+ _localVideoTrack = nil;
#if defined(WEBRTC_IOS)
[_factory stopAecDump];
[_peerConnection stopRtcEventLog];
@@ -666,10 +675,10 @@ static int const kKbpsMultiplier = 1000;
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 +725,9 @@ static int const kKbpsMultiplier = 1000;
// 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];
+ _capturer = [[RTCCameraVideoCapturer alloc] initWithDelegate:source];
+ [_delegate appClient:self didCreateLocalCapturer:_capturer];
localVideoTrack =
[_factory videoTrackWithSource:source
trackId:kARDVideoTrackId];
@@ -764,13 +772,6 @@ static int const kKbpsMultiplier = 1000;
return constraints;
}
-- (RTCMediaConstraints *)cameraConstraints {
- RTCMediaConstraints *cameraConstraints = [[RTCMediaConstraints alloc]
- initWithMandatoryConstraints:nil
- optionalConstraints:[_settings currentMediaConstraintFromStoreAsRTCDictionary]];
- return cameraConstraints;
-}
-
- (RTCMediaConstraints *)defaultAnswerConstraints {
return [self defaultOfferConstraints];
}

Powered by Google App Engine
This is Rietveld 408576698