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

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, 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 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 @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 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 {
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 (_isAecDumpActive) {
317 [_factory stopAecDump];
318 _isAecDumpActive = NO;
319 }
312 [_peerConnection stopRtcEventLog]; 320 [_peerConnection stopRtcEventLog];
313 #endif 321 #endif
314 _peerConnection = nil; 322 _peerConnection = nil;
315 self.state = kARDAppClientStateDisconnected; 323 self.state = kARDAppClientStateDisconnected;
316 #if defined(WEBRTC_IOS) 324 #if defined(WEBRTC_IOS)
317 RTCStopInternalCapture(); 325 RTCStopInternalCapture();
318 #endif 326 #endif
319 } 327 }
320 328
321 #pragma mark - ARDSignalingChannelDelegate 329 #pragma mark - ARDSignalingChannelDelegate
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 } 563 }
556 #if defined(WEBRTC_IOS) 564 #if defined(WEBRTC_IOS)
557 // Start event log. 565 // Start event log.
558 if (kARDAppClientEnableRtcEventLog) { 566 if (kARDAppClientEnableRtcEventLog) {
559 NSString *filePath = [self documentsFilePathForFileName:@"webrtc-rtceventlog "]; 567 NSString *filePath = [self documentsFilePathForFileName:@"webrtc-rtceventlog "];
560 if (![_peerConnection startRtcEventLogWithFilePath:filePath 568 if (![_peerConnection startRtcEventLogWithFilePath:filePath
561 maxSizeInBytes:kARDAppClientRtcEventLogMaxSizeI nBytes]) { 569 maxSizeInBytes:kARDAppClientRtcEventLogMaxSizeI nBytes]) {
562 RTCLogError(@"Failed to start event logging."); 570 RTCLogError(@"Failed to start event logging.");
563 } 571 }
564 } 572 }
573
574 // Start aecdump diagnostic recording.
575 if (_shouldMakeAecDump) {
576 _isAecDumpActive = YES;
577 NSString *filePath = [self documentsFilePathForFileName:@"audio.aecdump"];
578 int fd = open(filePath.UTF8String, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S _IWUSR);
579 if (fd < 0) {
580 RTCLogError(@"Failed to create the aecdump file!");
581 _isAecDumpActive = NO;
582 } else {
583 if (![_factory startAecDumpWithFileDescriptor:fd maxFileSizeInBytes:-1]) {
584 RTCLogError(@"Failed to create aecdump.");
585 _isAecDumpActive = NO;
586 }
587 }
588 }
565 #endif 589 #endif
566 } 590 }
567 591
568 // Processes the messages that we've received from the room server and the 592 // 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 593 // 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 594 // 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 595 // only processes pending messages if there is a peer connection object and
572 // if we have received either an offer or answer. 596 // if we have received either an offer or answer.
573 - (void)drainMessageQueueIfReady { 597 - (void)drainMessageQueueIfReady {
574 if (!_peerConnection || !_hasReceivedSdp) { 598 if (!_peerConnection || !_hasReceivedSdp) {
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 code:kARDAppClientErrorInvalidRoom 838 code:kARDAppClientErrorInvalidRoom
815 userInfo:@{ 839 userInfo:@{
816 NSLocalizedDescriptionKey: @"Invalid room.", 840 NSLocalizedDescriptionKey: @"Invalid room.",
817 }]; 841 }];
818 break; 842 break;
819 } 843 }
820 return error; 844 return error;
821 } 845 }
822 846
823 @end 847 @end
OLDNEW
« no previous file with comments | « webrtc/examples/objc/AppRTCDemo/ARDAppClient.h ('k') | webrtc/examples/objc/AppRTCDemo/ARDAppClient+Internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698