Chromium Code Reviews| Index: webrtc/examples/objc/AppRTCDemo/ARDAppClient.m |
| diff --git a/webrtc/examples/objc/AppRTCDemo/ARDAppClient.m b/webrtc/examples/objc/AppRTCDemo/ARDAppClient.m |
| index 8fb1841e391a16eb814235c21abd7a4dcc781eda..eb4ff5302f99b270011e24a09ac07cc747100d3f 100644 |
| --- a/webrtc/examples/objc/AppRTCDemo/ARDAppClient.m |
| +++ b/webrtc/examples/objc/AppRTCDemo/ARDAppClient.m |
| @@ -55,8 +55,10 @@ static NSString * const kARDVideoTrackId = @"ARDAMSv0"; |
| // TODO(tkchin): Remove guard once rtc_sdk_common_objc compiles on Mac. |
| #if defined(WEBRTC_IOS) |
| -// TODO(tkchin): Add this as a UI option. |
| +// TODO(tkchin): Add these as UI options. |
| static BOOL const kARDAppClientEnableTracing = NO; |
| +static BOOL const kARDAppClientEnableRtcEventLog = YES; |
| +static int64_t const kARDAppClientRtcEventLogMaxSizeInBytes = 5e6; // 5 MB. |
| #endif |
| // We need a proxy to NSTimer because it causes a strong retain cycle. When |
| @@ -227,11 +229,7 @@ static BOOL const kARDAppClientEnableTracing = NO; |
| #if defined(WEBRTC_IOS) |
| if (kARDAppClientEnableTracing) { |
| - NSArray *paths = NSSearchPathForDirectoriesInDomains( |
| - NSDocumentDirectory, NSUserDomainMask, YES); |
| - NSString *documentsDirPath = paths.firstObject; |
| - NSString *filePath = |
| - [documentsDirPath stringByAppendingPathComponent:@"webrtc-trace.txt"]; |
| + NSString *filePath = [self documentsFilePathForFileName:@"webrtc-trace.txt"]; |
| RTCStartInternalCapture(filePath); |
| } |
| #endif |
| @@ -314,6 +312,7 @@ static BOOL const kARDAppClientEnableTracing = NO; |
| self.state = kARDAppClientStateDisconnected; |
| #if defined(WEBRTC_IOS) |
| RTCStopInternalCapture(); |
| + [_factory stopRtcEventLog]; |
|
Chuck
2016/06/14 14:01:17
Do you need the #if guards here?
tkchin_webrtc
2016/06/14 17:40:59
Prob not.
Chuck
2016/06/14 19:36:44
I think I confused myself, I didn't see them in th
|
| #endif |
| } |
| @@ -498,6 +497,20 @@ static BOOL const kARDAppClientEnableTracing = NO; |
| #pragma mark - Private |
| +#if defined(WEBRTC_IOS) |
| + |
| +- (NSString *)documentsFilePathForFileName:(NSString *)fileName { |
| + NSParameterAssert(fileName.length); |
| + NSArray *paths = NSSearchPathForDirectoriesInDomains( |
| + NSDocumentDirectory, NSUserDomainMask, YES); |
| + NSString *documentsDirPath = paths.firstObject; |
| + NSString *filePath = |
| + [documentsDirPath stringByAppendingPathComponent:fileName]; |
| + return filePath; |
| +} |
| + |
| +#endif |
| + |
| - (BOOL)hasJoinedRoomServerRoom { |
| return _clientId.length; |
| } |
| @@ -513,6 +526,15 @@ static BOOL const kARDAppClientEnableTracing = NO; |
| } |
| self.state = kARDAppClientStateConnected; |
| +#if defined(WEBRTC_IOS) |
| + // Start event log. |
| + if (kARDAppClientEnableRtcEventLog) { |
| + NSString *filePath = [self documentsFilePathForFileName:@"webrtc-rtceventlog"]; |
| + [_factory startRtcEventLogWithFilePath:filePath |
|
Chuck
2016/06/14 14:01:17
Your comment suggests this is temporary, but shoul
tkchin_webrtc
2016/06/14 17:40:59
Done.
|
| + maxSizeInBytes:kARDAppClientRtcEventLogMaxSizeInBytes]; |
| + } |
| +#endif |
| + |
| // Create peer connection. |
| RTCMediaConstraints *constraints = [self defaultPeerConnectionConstraints]; |
| RTCConfiguration *config = [[RTCConfiguration alloc] init]; |