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

Unified Diff: webrtc/examples/objc/AppRTCDemo/ARDAppClient.m

Issue 1334003002: Loopback mode for AppRTCDemo on iOS. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Review Created 5 years, 3 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/AppRTCDemo/ARDAppClient.m
diff --git a/webrtc/examples/objc/AppRTCDemo/ARDAppClient.m b/webrtc/examples/objc/AppRTCDemo/ARDAppClient.m
index e53222e60e8414aeac386a5a2e6788b5afd1af2b..da05a2d010e10a8d27b8fd8ee76228d2e23a2711 100644
--- a/webrtc/examples/objc/AppRTCDemo/ARDAppClient.m
+++ b/webrtc/examples/objc/AppRTCDemo/ARDAppClient.m
@@ -99,6 +99,7 @@ static NSInteger const kARDAppClientErrorInvalidRoom = -6;
@synthesize delegate = _delegate;
@synthesize roomServerClient = _roomServerClient;
@synthesize channel = _channel;
+@synthesize loopbackChannel = _loopbackChannel;
@synthesize turnClient = _turnClient;
@synthesize peerConnection = _peerConnection;
@synthesize factory = _factory;
@@ -113,6 +114,8 @@ static NSInteger const kARDAppClientErrorInvalidRoom = -6;
@synthesize webSocketRestURL = _websocketRestURL;
@synthesize defaultPeerConnectionConstraints =
_defaultPeerConnectionConstraints;
+@synthesize isLoopback = _isLoopback;
+@synthesize isAudioOnly = _isAudioOnly;
- (instancetype)init {
if (self = [super init]) {
@@ -198,9 +201,13 @@ static NSInteger const kARDAppClientErrorInvalidRoom = -6;
}
- (void)connectToRoomWithId:(NSString *)roomId
+ isLoopback:(BOOL)isLoopback
+ isAudioOnly:(BOOL)isAudioOnly
options:(NSDictionary *)options {
NSParameterAssert(roomId.length);
NSParameterAssert(_state == kARDAppClientStateDisconnected);
+ _isLoopback = isLoopback;
+ _isAudioOnly = isAudioOnly;
self.state = kARDAppClientStateConnecting;
// Request TURN.
@@ -219,6 +226,7 @@ static NSInteger const kARDAppClientErrorInvalidRoom = -6;
// Join room on room server.
[_roomServerClient joinRoomWithRoomId:roomId
+ isLoopback:isLoopback
completionHandler:^(ARDJoinResponse *response, NSError *error) {
ARDAppClient *strongSelf = weakSelf;
if (error) {
@@ -579,14 +587,17 @@ static NSInteger const kARDAppClientErrorInvalidRoom = -6;
// TODO(tkchin): local video capture for OSX. See
// https://code.google.com/p/webrtc/issues/detail?id=3417.
#if !TARGET_IPHONE_SIMULATOR && TARGET_OS_IPHONE
- RTCMediaConstraints *mediaConstraints = [self defaultMediaStreamConstraints];
- RTCAVFoundationVideoSource *source =
- [[RTCAVFoundationVideoSource alloc] initWithFactory:_factory
- constraints:mediaConstraints];
- localVideoTrack =
- [[RTCVideoTrack alloc] initWithFactory:_factory
- source:source
- trackId:@"ARDAMSv0"];
+ if (!_isAudioOnly) {
henrika_webrtc 2015/09/14 08:31:20 Not sure what type of logging support we have but
Chuck 2015/09/28 16:26:40 it doesn't look like we do much logging at all in
+ RTCMediaConstraints *mediaConstraints =
+ [self defaultMediaStreamConstraints];
+ RTCAVFoundationVideoSource *source =
+ [[RTCAVFoundationVideoSource alloc] initWithFactory:_factory
+ constraints:mediaConstraints];
+ localVideoTrack =
+ [[RTCVideoTrack alloc] initWithFactory:_factory
+ source:source
+ trackId:@"ARDAMSv0"];
+ }
#endif
return localVideoTrack;
}
@@ -603,8 +614,16 @@ static NSInteger const kARDAppClientErrorInvalidRoom = -6;
[[ARDWebSocketChannel alloc] initWithURL:_websocketURL
restURL:_websocketRestURL
delegate:self];
+ if (_isLoopback) {
+ _loopbackChannel =
+ [[ARDLoopbackWebSocketChannel alloc] initWithURL:_websocketURL
+ restURL:_websocketRestURL];
+ }
}
[_channel registerForRoomId:_roomId clientId:_clientId];
+ if (_isLoopback) {
+ [_loopbackChannel registerForRoomId:_roomId clientId:@"LOOPBACk_CLIENT_ID"];
+ }
}
#pragma mark - Defaults
@@ -637,8 +656,9 @@ static NSInteger const kARDAppClientErrorInvalidRoom = -6;
if (_defaultPeerConnectionConstraints) {
return _defaultPeerConnectionConstraints;
}
+ NSString *value = _isLoopback ? @"false" : @"true";
NSArray *optionalConstraints = @[
- [[RTCPair alloc] initWithKey:@"DtlsSrtpKeyAgreement" value:@"true"]
+ [[RTCPair alloc] initWithKey:@"DtlsSrtpKeyAgreement" value:value]
];
RTCMediaConstraints* constraints =
[[RTCMediaConstraints alloc]

Powered by Google App Engine
This is Rietveld 408576698