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

Side by Side Diff: webrtc/examples/objc/AppRTCDemo/ARDAppClient.m

Issue 2253013006: Adding AecDump functionality to AppRTCDemo for iOS (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Changes in response to reviewer comments Created 4 years, 4 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 unified diff | Download patch
OLDNEW
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
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
tkchin_webrtc 2016/08/24 00:42:20 nit: remove extra line
peah-webrtc 2016/08/25 09:25:08 Done.
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
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 shouldMakeAecDump:(BOOL)shouldMakeAecDump {
tkchin_webrtc 2016/08/24 00:42:20 nit: align :
peah-webrtc 2016/08/25 09:25:08 Done.
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 _shouldMakeAecDump = shouldMakeAecDump;
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
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 (_shouldMakeAecDump) {
tkchin_webrtc 2016/08/24 00:42:20 is this conditional useful? Could be that it faile
peah-webrtc 2016/08/25 09:25:08 The StopAecDump method does an internal check to s
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
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 (_shouldMakeAecDump) {
575 NSString *filePath = [self documentsFilePathForFileName:@"audio.aecdump"];
576 int fd = open(filePath.UTF8String, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S _IWUSR);
577 if (fd < 0) {
578 RTCLogError(@"Failed to create the aecdump file!");
579 }
tkchin_webrtc 2016/08/24 00:42:20 nit: else on same line as }
peah-webrtc 2016/08/25 09:25:08 Done.
580 else {
581 if (![_factory startAecDump:fd fileSizeLimitBytes:-1]) {
tkchin_webrtc 2016/08/24 00:42:20 nit: remove extra space after fd
peah-webrtc 2016/08/25 09:25:08 Done.
582 RTCLogError(@"Failed to create aecdump.");
583 }
584 }
585 }
565 #endif 586 #endif
566 } 587 }
567 588
568 // Processes the messages that we've received from the room server and the 589 // 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 590 // 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 591 // 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 592 // only processes pending messages if there is a peer connection object and
572 // if we have received either an offer or answer. 593 // if we have received either an offer or answer.
573 - (void)drainMessageQueueIfReady { 594 - (void)drainMessageQueueIfReady {
574 if (!_peerConnection || !_hasReceivedSdp) { 595 if (!_peerConnection || !_hasReceivedSdp) {
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 code:kARDAppClientErrorInvalidRoom 835 code:kARDAppClientErrorInvalidRoom
815 userInfo:@{ 836 userInfo:@{
816 NSLocalizedDescriptionKey: @"Invalid room.", 837 NSLocalizedDescriptionKey: @"Invalid room.",
817 }]; 838 }];
818 break; 839 break;
819 } 840 }
820 return error; 841 return error;
821 } 842 }
822 843
823 @end 844 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698