Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2014 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2014 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 @synthesize roomId = _roomId; | 122 @synthesize roomId = _roomId; |
| 123 @synthesize clientId = _clientId; | 123 @synthesize clientId = _clientId; |
| 124 @synthesize isInitiator = _isInitiator; | 124 @synthesize isInitiator = _isInitiator; |
| 125 @synthesize iceServers = _iceServers; | 125 @synthesize iceServers = _iceServers; |
| 126 @synthesize webSocketURL = _websocketURL; | 126 @synthesize webSocketURL = _websocketURL; |
| 127 @synthesize webSocketRestURL = _websocketRestURL; | 127 @synthesize webSocketRestURL = _websocketRestURL; |
| 128 @synthesize defaultPeerConnectionConstraints = | 128 @synthesize defaultPeerConnectionConstraints = |
| 129 _defaultPeerConnectionConstraints; | 129 _defaultPeerConnectionConstraints; |
| 130 @synthesize isLoopback = _isLoopback; | 130 @synthesize isLoopback = _isLoopback; |
| 131 @synthesize isAudioOnly = _isAudioOnly; | 131 @synthesize isAudioOnly = _isAudioOnly; |
| 132 @synthesize shouldMakeAecDump = _shouldMakeAecDump; | |
| 133 @synthesize isAecDumpActive = _isAecDumpActive; | |
| 132 | 134 |
| 133 - (instancetype)init { | 135 - (instancetype)init { |
| 134 if (self = [super init]) { | 136 if (self = [super init]) { |
| 135 _roomServerClient = [[ARDAppEngineClient alloc] init]; | 137 _roomServerClient = [[ARDAppEngineClient alloc] init]; |
| 136 NSURL *turnRequestURL = [NSURL URLWithString:kARDTurnRequestUrl]; | 138 NSURL *turnRequestURL = [NSURL URLWithString:kARDTurnRequestUrl]; |
| 137 _turnClient = [[ARDCEODTURNClient alloc] initWithURL:turnRequestURL]; | 139 _turnClient = [[ARDCEODTURNClient alloc] initWithURL:turnRequestURL]; |
| 138 [self configure]; | 140 [self configure]; |
| 139 } | 141 } |
| 140 return self; | 142 return self; |
| 141 } | 143 } |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 165 _roomServerClient = rsClient; | 167 _roomServerClient = rsClient; |
| 166 _channel = channel; | 168 _channel = channel; |
| 167 _turnClient = turnClient; | 169 _turnClient = turnClient; |
| 168 _delegate = delegate; | 170 _delegate = delegate; |
| 169 [self configure]; | 171 [self configure]; |
| 170 } | 172 } |
| 171 return self; | 173 return self; |
| 172 } | 174 } |
| 173 | 175 |
| 174 - (void)configure { | 176 - (void)configure { |
| 177 _isAecDumpActive = NO; | |
|
tkchin_webrtc
2016/08/25 17:22:57
nit: not needed, BOOL ivars in ObjC are init-ed to
peah-webrtc
2016/08/25 21:23:36
Done.
| |
| 175 _factory = [[RTCPeerConnectionFactory alloc] init]; | 178 _factory = [[RTCPeerConnectionFactory alloc] init]; |
| 176 _messageQueue = [NSMutableArray array]; | 179 _messageQueue = [NSMutableArray array]; |
| 177 _iceServers = [NSMutableArray arrayWithObject:[self defaultSTUNServer]]; | 180 _iceServers = [NSMutableArray arrayWithObject:[self defaultSTUNServer]]; |
| 178 _fileLogger = [[RTCFileLogger alloc] init]; | 181 _fileLogger = [[RTCFileLogger alloc] init]; |
| 179 [_fileLogger start]; | 182 [_fileLogger start]; |
| 180 } | 183 } |
| 181 | 184 |
| 182 - (void)dealloc { | 185 - (void)dealloc { |
| 183 self.shouldGetStats = NO; | 186 self.shouldGetStats = NO; |
| 184 [self disconnect]; | 187 [self disconnect]; |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 213 - (void)setState:(ARDAppClientState)state { | 216 - (void)setState:(ARDAppClientState)state { |
| 214 if (_state == state) { | 217 if (_state == state) { |
| 215 return; | 218 return; |
| 216 } | 219 } |
| 217 _state = state; | 220 _state = state; |
| 218 [_delegate appClient:self didChangeState:_state]; | 221 [_delegate appClient:self didChangeState:_state]; |
| 219 } | 222 } |
| 220 | 223 |
| 221 - (void)connectToRoomWithId:(NSString *)roomId | 224 - (void)connectToRoomWithId:(NSString *)roomId |
| 222 isLoopback:(BOOL)isLoopback | 225 isLoopback:(BOOL)isLoopback |
| 223 isAudioOnly:(BOOL)isAudioOnly { | 226 isAudioOnly:(BOOL)isAudioOnly |
| 227 shouldMakeAecDump:(BOOL)shouldMakeAecDump { | |
| 224 NSParameterAssert(roomId.length); | 228 NSParameterAssert(roomId.length); |
| 225 NSParameterAssert(_state == kARDAppClientStateDisconnected); | 229 NSParameterAssert(_state == kARDAppClientStateDisconnected); |
| 226 _isLoopback = isLoopback; | 230 _isLoopback = isLoopback; |
| 227 _isAudioOnly = isAudioOnly; | 231 _isAudioOnly = isAudioOnly; |
| 232 _shouldMakeAecDump = shouldMakeAecDump; | |
| 228 self.state = kARDAppClientStateConnecting; | 233 self.state = kARDAppClientStateConnecting; |
| 229 | 234 |
| 230 #if defined(WEBRTC_IOS) | 235 #if defined(WEBRTC_IOS) |
| 231 if (kARDAppClientEnableTracing) { | 236 if (kARDAppClientEnableTracing) { |
| 232 NSString *filePath = [self documentsFilePathForFileName:@"webrtc-trace.txt"] ; | 237 NSString *filePath = [self documentsFilePathForFileName:@"webrtc-trace.txt"] ; |
| 233 RTCStartInternalCapture(filePath); | 238 RTCStartInternalCapture(filePath); |
| 234 } | 239 } |
| 235 #endif | 240 #endif |
| 236 | 241 |
| 237 // Request TURN. | 242 // Request TURN. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 302 } | 307 } |
| 303 // Disconnect from collider. | 308 // Disconnect from collider. |
| 304 _channel = nil; | 309 _channel = nil; |
| 305 } | 310 } |
| 306 _clientId = nil; | 311 _clientId = nil; |
| 307 _roomId = nil; | 312 _roomId = nil; |
| 308 _isInitiator = NO; | 313 _isInitiator = NO; |
| 309 _hasReceivedSdp = NO; | 314 _hasReceivedSdp = NO; |
| 310 _messageQueue = [NSMutableArray array]; | 315 _messageQueue = [NSMutableArray array]; |
| 311 #if defined(WEBRTC_IOS) | 316 #if defined(WEBRTC_IOS) |
| 317 if (_isAecDumpActive) { | |
| 318 [_factory stopAecDump]; | |
| 319 _isAecDumpActive = NO; | |
| 320 } | |
| 312 [_peerConnection stopRtcEventLog]; | 321 [_peerConnection stopRtcEventLog]; |
| 313 #endif | 322 #endif |
| 314 _peerConnection = nil; | 323 _peerConnection = nil; |
| 315 self.state = kARDAppClientStateDisconnected; | 324 self.state = kARDAppClientStateDisconnected; |
| 316 #if defined(WEBRTC_IOS) | 325 #if defined(WEBRTC_IOS) |
| 317 RTCStopInternalCapture(); | 326 RTCStopInternalCapture(); |
| 318 #endif | 327 #endif |
| 319 } | 328 } |
| 320 | 329 |
| 321 #pragma mark - ARDSignalingChannelDelegate | 330 #pragma mark - ARDSignalingChannelDelegate |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 555 } | 564 } |
| 556 #if defined(WEBRTC_IOS) | 565 #if defined(WEBRTC_IOS) |
| 557 // Start event log. | 566 // Start event log. |
| 558 if (kARDAppClientEnableRtcEventLog) { | 567 if (kARDAppClientEnableRtcEventLog) { |
| 559 NSString *filePath = [self documentsFilePathForFileName:@"webrtc-rtceventlog "]; | 568 NSString *filePath = [self documentsFilePathForFileName:@"webrtc-rtceventlog "]; |
| 560 if (![_peerConnection startRtcEventLogWithFilePath:filePath | 569 if (![_peerConnection startRtcEventLogWithFilePath:filePath |
| 561 maxSizeInBytes:kARDAppClientRtcEventLogMaxSizeI nBytes]) { | 570 maxSizeInBytes:kARDAppClientRtcEventLogMaxSizeI nBytes]) { |
| 562 RTCLogError(@"Failed to start event logging."); | 571 RTCLogError(@"Failed to start event logging."); |
| 563 } | 572 } |
| 564 } | 573 } |
| 574 | |
| 575 // Start aecdump diagnostic recording. | |
| 576 if (_shouldMakeAecDump) { | |
| 577 _isAecDumpActive = YES; | |
| 578 NSString *filePath = [self documentsFilePathForFileName:@"audio.aecdump"]; | |
| 579 int fd = open(filePath.UTF8String, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S _IWUSR); | |
| 580 if (fd < 0) { | |
| 581 RTCLogError(@"Failed to create the aecdump file!"); | |
| 582 _isAecDumpActive = NO; | |
| 583 } else { | |
| 584 if (![_factory startAecDumpWithFileDescriptor:fd maxFileSizeInBytes:-1]) { | |
| 585 RTCLogError(@"Failed to create aecdump."); | |
| 586 _isAecDumpActive = NO; | |
|
tkchin_webrtc
2016/08/25 17:22:57
nit: align
peah-webrtc
2016/08/25 21:23:36
Done.
| |
| 587 } | |
| 588 } | |
| 589 } | |
| 565 #endif | 590 #endif |
| 566 } | 591 } |
| 567 | 592 |
| 568 // Processes the messages that we've received from the room server and the | 593 // Processes the messages that we've received from the room server and the |
| 569 // signaling channel. The offer or answer message must be processed before other | 594 // signaling channel. The offer or answer message must be processed before other |
| 570 // signaling messages, however they can arrive out of order. Hence, this method | 595 // signaling messages, however they can arrive out of order. Hence, this method |
| 571 // only processes pending messages if there is a peer connection object and | 596 // only processes pending messages if there is a peer connection object and |
| 572 // if we have received either an offer or answer. | 597 // if we have received either an offer or answer. |
| 573 - (void)drainMessageQueueIfReady { | 598 - (void)drainMessageQueueIfReady { |
| 574 if (!_peerConnection || !_hasReceivedSdp) { | 599 if (!_peerConnection || !_hasReceivedSdp) { |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 814 code:kARDAppClientErrorInvalidRoom | 839 code:kARDAppClientErrorInvalidRoom |
| 815 userInfo:@{ | 840 userInfo:@{ |
| 816 NSLocalizedDescriptionKey: @"Invalid room.", | 841 NSLocalizedDescriptionKey: @"Invalid room.", |
| 817 }]; | 842 }]; |
| 818 break; | 843 break; |
| 819 } | 844 } |
| 820 return error; | 845 return error; |
| 821 } | 846 } |
| 822 | 847 |
| 823 @end | 848 @end |
| OLD | NEW |