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 makeAecDump = _makeAecDump; | |
133 | |
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
213 - (void)setState:(ARDAppClientState)state { | 215 - (void)setState:(ARDAppClientState)state { |
214 if (_state == state) { | 216 if (_state == state) { |
215 return; | 217 return; |
216 } | 218 } |
217 _state = state; | 219 _state = state; |
218 [_delegate appClient:self didChangeState:_state]; | 220 [_delegate appClient:self didChangeState:_state]; |
219 } | 221 } |
220 | 222 |
221 - (void)connectToRoomWithId:(NSString *)roomId | 223 - (void)connectToRoomWithId:(NSString *)roomId |
222 isLoopback:(BOOL)isLoopback | 224 isLoopback:(BOOL)isLoopback |
223 isAudioOnly:(BOOL)isAudioOnly { | 225 isAudioOnly:(BOOL)isAudioOnly |
226 makeAecDump:(BOOL)makeAecDump { | |
224 NSParameterAssert(roomId.length); | 227 NSParameterAssert(roomId.length); |
225 NSParameterAssert(_state == kARDAppClientStateDisconnected); | 228 NSParameterAssert(_state == kARDAppClientStateDisconnected); |
226 _isLoopback = isLoopback; | 229 _isLoopback = isLoopback; |
227 _isAudioOnly = isAudioOnly; | 230 _isAudioOnly = isAudioOnly; |
231 _makeAecDump = makeAecDump; | |
228 self.state = kARDAppClientStateConnecting; | 232 self.state = kARDAppClientStateConnecting; |
229 | 233 |
230 #if defined(WEBRTC_IOS) | 234 #if defined(WEBRTC_IOS) |
231 if (kARDAppClientEnableTracing) { | 235 if (kARDAppClientEnableTracing) { |
232 NSString *filePath = [self documentsFilePathForFileName:@"webrtc-trace.txt"] ; | 236 NSString *filePath = [self documentsFilePathForFileName:@"webrtc-trace.txt"] ; |
233 RTCStartInternalCapture(filePath); | 237 RTCStartInternalCapture(filePath); |
234 } | 238 } |
235 #endif | 239 #endif |
236 | 240 |
237 // Request TURN. | 241 // Request TURN. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
302 } | 306 } |
303 // Disconnect from collider. | 307 // Disconnect from collider. |
304 _channel = nil; | 308 _channel = nil; |
305 } | 309 } |
306 _clientId = nil; | 310 _clientId = nil; |
307 _roomId = nil; | 311 _roomId = nil; |
308 _isInitiator = NO; | 312 _isInitiator = NO; |
309 _hasReceivedSdp = NO; | 313 _hasReceivedSdp = NO; |
310 _messageQueue = [NSMutableArray array]; | 314 _messageQueue = [NSMutableArray array]; |
311 #if defined(WEBRTC_IOS) | 315 #if defined(WEBRTC_IOS) |
316 if (_makeAecDump) { | |
317 [_factory stopAecDump]; | |
318 } | |
312 [_peerConnection stopRtcEventLog]; | 319 [_peerConnection stopRtcEventLog]; |
313 #endif | 320 #endif |
314 _peerConnection = nil; | 321 _peerConnection = nil; |
315 self.state = kARDAppClientStateDisconnected; | 322 self.state = kARDAppClientStateDisconnected; |
316 #if defined(WEBRTC_IOS) | 323 #if defined(WEBRTC_IOS) |
317 RTCStopInternalCapture(); | 324 RTCStopInternalCapture(); |
318 #endif | 325 #endif |
319 } | 326 } |
320 | 327 |
321 #pragma mark - ARDSignalingChannelDelegate | 328 #pragma mark - ARDSignalingChannelDelegate |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
555 } | 562 } |
556 #if defined(WEBRTC_IOS) | 563 #if defined(WEBRTC_IOS) |
557 // Start event log. | 564 // Start event log. |
558 if (kARDAppClientEnableRtcEventLog) { | 565 if (kARDAppClientEnableRtcEventLog) { |
559 NSString *filePath = [self documentsFilePathForFileName:@"webrtc-rtceventlog "]; | 566 NSString *filePath = [self documentsFilePathForFileName:@"webrtc-rtceventlog "]; |
560 if (![_peerConnection startRtcEventLogWithFilePath:filePath | 567 if (![_peerConnection startRtcEventLogWithFilePath:filePath |
561 maxSizeInBytes:kARDAppClientRtcEventLogMaxSizeI nBytes]) { | 568 maxSizeInBytes:kARDAppClientRtcEventLogMaxSizeI nBytes]) { |
562 RTCLogError(@"Failed to start event logging."); | 569 RTCLogError(@"Failed to start event logging."); |
563 } | 570 } |
564 } | 571 } |
572 | |
573 // Start aecdump diagnostic recording. | |
574 if (_makeAecDump) { | |
575 NSString *filePath = [self documentsFilePathForFileName:@"audio.aecdump"]; | |
576 if (![_factory startAecDump: filePath]) { | |
tkchin_webrtc
2016/08/19 17:31:42
nit: no space after :
peah-webrtc
2016/08/23 11:45:15
Done.
| |
577 RTCLogError(@"Failed to create aecdump."); | |
578 } | |
579 } | |
565 #endif | 580 #endif |
566 } | 581 } |
567 | 582 |
568 // Processes the messages that we've received from the room server and the | 583 // 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 | 584 // 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 | 585 // 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 | 586 // only processes pending messages if there is a peer connection object and |
572 // if we have received either an offer or answer. | 587 // if we have received either an offer or answer. |
573 - (void)drainMessageQueueIfReady { | 588 - (void)drainMessageQueueIfReady { |
574 if (!_peerConnection || !_hasReceivedSdp) { | 589 if (!_peerConnection || !_hasReceivedSdp) { |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
814 code:kARDAppClientErrorInvalidRoom | 829 code:kARDAppClientErrorInvalidRoom |
815 userInfo:@{ | 830 userInfo:@{ |
816 NSLocalizedDescriptionKey: @"Invalid room.", | 831 NSLocalizedDescriptionKey: @"Invalid room.", |
817 }]; | 832 }]; |
818 break; | 833 break; |
819 } | 834 } |
820 return error; | 835 return error; |
821 } | 836 } |
822 | 837 |
823 @end | 838 @end |
OLD | NEW |