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

Unified Diff: webrtc/sdk/objc/Framework/Classes/RTCPeerConnectionFactory.mm

Issue 2279293003: Update AecDump API to match RtcEventLog API signature. (Closed)
Patch Set: Fix rebase. 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/sdk/objc/Framework/Classes/RTCPeerConnectionFactory.mm
diff --git a/webrtc/sdk/objc/Framework/Classes/RTCPeerConnectionFactory.mm b/webrtc/sdk/objc/Framework/Classes/RTCPeerConnectionFactory.mm
index d5fd1df06727697d1e97374d68f6a43738020f39..9f24aec11daf611a1a90825d50b772f2580ef552 100644
--- a/webrtc/sdk/objc/Framework/Classes/RTCPeerConnectionFactory.mm
+++ b/webrtc/sdk/objc/Framework/Classes/RTCPeerConnectionFactory.mm
@@ -19,11 +19,13 @@
#import "RTCPeerConnection+Private.h"
#import "RTCVideoSource+Private.h"
#import "RTCVideoTrack+Private.h"
+#import "WebRTC/RTCLogging.h"
@implementation RTCPeerConnectionFactory {
std::unique_ptr<rtc::Thread> _networkThread;
std::unique_ptr<rtc::Thread> _workerThread;
std::unique_ptr<rtc::Thread> _signalingThread;
+ BOOL _hasStartedAecDump;
}
@synthesize nativeFactory = _nativeFactory;
@@ -50,19 +52,6 @@
return self;
}
-- (BOOL)startAecDumpWithFileDescriptor:(int)fileDescriptor
- maxFileSizeInBytes:(int)maxFileSizeInBytes {
- // Pass the file to the recorder. The file ownership
- // is passed to the recorder, and the recorder
- // closes the file when needed.
- return _nativeFactory->StartAecDump(fileDescriptor, maxFileSizeInBytes);
-}
-
-- (void)stopAecDump {
- // The file is closed by the call below.
- _nativeFactory->StopAecDump();
-}
-
- (RTCAudioSource *)audioSourceWithConstraints:(nullable RTCMediaConstraints *)constraints {
std::unique_ptr<webrtc::MediaConstraints> nativeConstraints;
if (constraints) {
@@ -115,4 +104,27 @@
delegate:delegate];
}
+- (BOOL)startAecDumpWithFilePath:(NSString *)filePath
+ maxSizeInBytes:(int64_t)maxSizeInBytes {
+ RTC_DCHECK(filePath.length);
+ RTC_DCHECK_GT(maxSizeInBytes, 0);
+
+ if (_hasStartedAecDump) {
+ RTCLogError(@"Aec dump 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;
+ }
+ _hasStartedAecDump = _nativeFactory->StartAecDump(fd, maxSizeInBytes);
+ return _hasStartedAecDump;
+}
+
+- (void)stopAecDump {
+ _nativeFactory->StopAecDump();
+ _hasStartedAecDump = NO;
+}
+
@end

Powered by Google App Engine
This is Rietveld 408576698