Chromium Code Reviews| Index: webrtc/sdk/objc/Framework/Classes/RTCPeerConnection.mm |
| diff --git a/webrtc/sdk/objc/Framework/Classes/RTCPeerConnection.mm b/webrtc/sdk/objc/Framework/Classes/RTCPeerConnection.mm |
| index 68d23874bd3b41408ded8f313cd8f282b74ab202..a5278b948ee505c3f46a8e8960ac2f974808fd1f 100644 |
| --- a/webrtc/sdk/objc/Framework/Classes/RTCPeerConnection.mm |
| +++ b/webrtc/sdk/objc/Framework/Classes/RTCPeerConnection.mm |
| @@ -207,6 +207,7 @@ void PeerConnectionDelegateAdapter::OnIceCandidatesRemoved( |
| NSMutableArray *_localStreams; |
| std::unique_ptr<webrtc::PeerConnectionDelegateAdapter> _observer; |
| rtc::scoped_refptr<webrtc::PeerConnectionInterface> _peerConnection; |
| + BOOL _hasStartedRtcEventLog; |
| } |
| @synthesize delegate = _delegate; |
| @@ -356,6 +357,31 @@ void PeerConnectionDelegateAdapter::OnIceCandidatesRemoved( |
| _peerConnection->SetRemoteDescription(observer, sdp.nativeDescription); |
| } |
| +- (BOOL)startRtcEventLogWithFilePath:(NSString*)filePath |
|
tkchin_webrtc
2016/06/29 23:02:08
NSString *)
ivoc
2016/06/30 06:56:42
Done.
|
| + maxSizeInBytes:(int64_t)maxSizeInBytes { |
| + RTC_DCHECK(filePath.length); |
| + RTC_DCHECK_GT(maxSizeInBytes, 0); |
| + RTC_DCHECK(!_hasStartedRtcEventLog); |
| + if (_hasStartedRtcEventLog) { |
| + RTCLogError(@"Event logging already started."); |
| + return NO; |
| + } |
| + int fd = open(filePath.UTF8String, O_WRONLY | O_CREAT | O_TRUNC, |
| + S_IRUSR | S_IWUSR); |
| + if (fd < 0) { |
| + RTCLogError(@"Error opening file: %@. Error: %d", filePath, errno); |
| + return NO; |
| + } |
| + _hasStartedRtcEventLog = |
| + _peerConnection->StartRtcEventLog(fd, maxSizeInBytes); |
| + return _hasStartedRtcEventLog; |
| +} |
| + |
| +- (void)stopRtcEventLog { |
| + _peerConnection->StopRtcEventLog(); |
| + _hasStartedRtcEventLog = NO; |
| +} |
| + |
| - (RTCRtpSender *)senderWithKind:(NSString *)kind |
| streamId:(NSString *)streamId { |
| std::string nativeKind = [NSString stdStringForString:kind]; |