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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 static NSInteger const kARDAppClientErrorInvalidRoom = -6; | 51 static NSInteger const kARDAppClientErrorInvalidRoom = -6; |
52 static NSString * const kARDMediaStreamId = @"ARDAMS"; | 52 static NSString * const kARDMediaStreamId = @"ARDAMS"; |
53 static NSString * const kARDAudioTrackId = @"ARDAMSa0"; | 53 static NSString * const kARDAudioTrackId = @"ARDAMSa0"; |
54 static NSString * const kARDVideoTrackId = @"ARDAMSv0"; | 54 static NSString * const kARDVideoTrackId = @"ARDAMSv0"; |
55 | 55 |
56 // TODO(tkchin): Remove guard once rtc_sdk_common_objc compiles on Mac. | 56 // TODO(tkchin): Remove guard once rtc_sdk_common_objc compiles on Mac. |
57 #if defined(WEBRTC_IOS) | 57 #if defined(WEBRTC_IOS) |
58 // TODO(tkchin): Add these as UI options. | 58 // TODO(tkchin): Add these as UI options. |
59 static BOOL const kARDAppClientEnableTracing = NO; | 59 static BOOL const kARDAppClientEnableTracing = NO; |
60 static BOOL const kARDAppClientEnableRtcEventLog = YES; | 60 static BOOL const kARDAppClientEnableRtcEventLog = YES; |
| 61 static int64_t const kARDAppClientAecDumpMaxSizeInBytes = 5e6; // 5 MB. |
61 static int64_t const kARDAppClientRtcEventLogMaxSizeInBytes = 5e6; // 5 MB. | 62 static int64_t const kARDAppClientRtcEventLogMaxSizeInBytes = 5e6; // 5 MB. |
62 #endif | 63 #endif |
63 | 64 |
64 // We need a proxy to NSTimer because it causes a strong retain cycle. When | 65 // We need a proxy to NSTimer because it causes a strong retain cycle. When |
65 // using the proxy, |invalidate| must be called before it properly deallocs. | 66 // using the proxy, |invalidate| must be called before it properly deallocs. |
66 @interface ARDTimerProxy : NSObject | 67 @interface ARDTimerProxy : NSObject |
67 | 68 |
68 - (instancetype)initWithInterval:(NSTimeInterval)interval | 69 - (instancetype)initWithInterval:(NSTimeInterval)interval |
69 repeats:(BOOL)repeats | 70 repeats:(BOOL)repeats |
70 timerHandler:(void (^)(void))timerHandler; | 71 timerHandler:(void (^)(void))timerHandler; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 @synthesize clientId = _clientId; | 124 @synthesize clientId = _clientId; |
124 @synthesize isInitiator = _isInitiator; | 125 @synthesize isInitiator = _isInitiator; |
125 @synthesize iceServers = _iceServers; | 126 @synthesize iceServers = _iceServers; |
126 @synthesize webSocketURL = _websocketURL; | 127 @synthesize webSocketURL = _websocketURL; |
127 @synthesize webSocketRestURL = _websocketRestURL; | 128 @synthesize webSocketRestURL = _websocketRestURL; |
128 @synthesize defaultPeerConnectionConstraints = | 129 @synthesize defaultPeerConnectionConstraints = |
129 _defaultPeerConnectionConstraints; | 130 _defaultPeerConnectionConstraints; |
130 @synthesize isLoopback = _isLoopback; | 131 @synthesize isLoopback = _isLoopback; |
131 @synthesize isAudioOnly = _isAudioOnly; | 132 @synthesize isAudioOnly = _isAudioOnly; |
132 @synthesize shouldMakeAecDump = _shouldMakeAecDump; | 133 @synthesize shouldMakeAecDump = _shouldMakeAecDump; |
133 @synthesize isAecDumpActive = _isAecDumpActive; | |
134 @synthesize shouldUseLevelControl = _shouldUseLevelControl; | 134 @synthesize shouldUseLevelControl = _shouldUseLevelControl; |
135 | 135 |
136 - (instancetype)init { | 136 - (instancetype)init { |
137 if (self = [super init]) { | 137 if (self = [super init]) { |
138 _roomServerClient = [[ARDAppEngineClient alloc] init]; | 138 _roomServerClient = [[ARDAppEngineClient alloc] init]; |
139 NSURL *turnRequestURL = [NSURL URLWithString:kARDTurnRequestUrl]; | 139 NSURL *turnRequestURL = [NSURL URLWithString:kARDTurnRequestUrl]; |
140 _turnClient = [[ARDCEODTURNClient alloc] initWithURL:turnRequestURL]; | 140 _turnClient = [[ARDCEODTURNClient alloc] initWithURL:turnRequestURL]; |
141 [self configure]; | 141 [self configure]; |
142 } | 142 } |
143 return self; | 143 return self; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 } | 309 } |
310 // Disconnect from collider. | 310 // Disconnect from collider. |
311 _channel = nil; | 311 _channel = nil; |
312 } | 312 } |
313 _clientId = nil; | 313 _clientId = nil; |
314 _roomId = nil; | 314 _roomId = nil; |
315 _isInitiator = NO; | 315 _isInitiator = NO; |
316 _hasReceivedSdp = NO; | 316 _hasReceivedSdp = NO; |
317 _messageQueue = [NSMutableArray array]; | 317 _messageQueue = [NSMutableArray array]; |
318 #if defined(WEBRTC_IOS) | 318 #if defined(WEBRTC_IOS) |
319 if (_isAecDumpActive) { | 319 [_factory stopAecDump]; |
320 [_factory stopAecDump]; | |
321 _isAecDumpActive = NO; | |
322 } | |
323 [_peerConnection stopRtcEventLog]; | 320 [_peerConnection stopRtcEventLog]; |
324 #endif | 321 #endif |
325 _peerConnection = nil; | 322 _peerConnection = nil; |
326 self.state = kARDAppClientStateDisconnected; | 323 self.state = kARDAppClientStateDisconnected; |
327 #if defined(WEBRTC_IOS) | 324 #if defined(WEBRTC_IOS) |
328 RTCStopInternalCapture(); | 325 RTCStopInternalCapture(); |
329 #endif | 326 #endif |
330 } | 327 } |
331 | 328 |
332 #pragma mark - ARDSignalingChannelDelegate | 329 #pragma mark - ARDSignalingChannelDelegate |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 if (kARDAppClientEnableRtcEventLog) { | 566 if (kARDAppClientEnableRtcEventLog) { |
570 NSString *filePath = [self documentsFilePathForFileName:@"webrtc-rtceventlog
"]; | 567 NSString *filePath = [self documentsFilePathForFileName:@"webrtc-rtceventlog
"]; |
571 if (![_peerConnection startRtcEventLogWithFilePath:filePath | 568 if (![_peerConnection startRtcEventLogWithFilePath:filePath |
572 maxSizeInBytes:kARDAppClientRtcEventLogMaxSizeI
nBytes]) { | 569 maxSizeInBytes:kARDAppClientRtcEventLogMaxSizeI
nBytes]) { |
573 RTCLogError(@"Failed to start event logging."); | 570 RTCLogError(@"Failed to start event logging."); |
574 } | 571 } |
575 } | 572 } |
576 | 573 |
577 // Start aecdump diagnostic recording. | 574 // Start aecdump diagnostic recording. |
578 if (_shouldMakeAecDump) { | 575 if (_shouldMakeAecDump) { |
579 _isAecDumpActive = YES; | 576 NSString *filePath = [self documentsFilePathForFileName:@"webrtc-audio.aecdu
mp"]; |
580 NSString *filePath = [self documentsFilePathForFileName:@"audio.aecdump"]; | 577 if (![_factory startAecDumpWithFilePath:filePath |
581 int fd = open(filePath.UTF8String, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S
_IWUSR); | 578 maxSizeInBytes:kARDAppClientAecDumpMaxSizeInBytes])
{ |
582 if (fd < 0) { | 579 RTCLogError(@"Failed to start aec dump."); |
583 RTCLogError(@"Failed to create the aecdump file!"); | |
584 _isAecDumpActive = NO; | |
585 } else { | |
586 if (![_factory startAecDumpWithFileDescriptor:fd maxFileSizeInBytes:-1]) { | |
587 RTCLogError(@"Failed to create aecdump."); | |
588 _isAecDumpActive = NO; | |
589 } | |
590 } | 580 } |
591 } | 581 } |
592 #endif | 582 #endif |
593 } | 583 } |
594 | 584 |
595 // Processes the messages that we've received from the room server and the | 585 // Processes the messages that we've received from the room server and the |
596 // signaling channel. The offer or answer message must be processed before other | 586 // signaling channel. The offer or answer message must be processed before other |
597 // signaling messages, however they can arrive out of order. Hence, this method | 587 // signaling messages, however they can arrive out of order. Hence, this method |
598 // only processes pending messages if there is a peer connection object and | 588 // only processes pending messages if there is a peer connection object and |
599 // if we have received either an offer or answer. | 589 // if we have received either an offer or answer. |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 code:kARDAppClientErrorInvalidRoom | 844 code:kARDAppClientErrorInvalidRoom |
855 userInfo:@{ | 845 userInfo:@{ |
856 NSLocalizedDescriptionKey: @"Invalid room.", | 846 NSLocalizedDescriptionKey: @"Invalid room.", |
857 }]; | 847 }]; |
858 break; | 848 break; |
859 } | 849 } |
860 return error; | 850 return error; |
861 } | 851 } |
862 | 852 |
863 @end | 853 @end |
OLD | NEW |