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

Unified Diff: webrtc/modules/audio_device/ios/objc/RTCAudioSessionConfiguration.m

Issue 2066993005: (OBSOLETE) Increasing audio buffer on Iphone 4S. Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_device/ios/objc/RTCAudioSessionConfiguration.m
diff --git a/webrtc/modules/audio_device/ios/objc/RTCAudioSessionConfiguration.m b/webrtc/modules/audio_device/ios/objc/RTCAudioSessionConfiguration.m
index d2d04835499fe9ee990f546ddda01cc787d5cf39..05c0c2259d5028ddd4a54dd9221389ecd73aeb60 100644
--- a/webrtc/modules/audio_device/ios/objc/RTCAudioSessionConfiguration.m
+++ b/webrtc/modules/audio_device/ios/objc/RTCAudioSessionConfiguration.m
@@ -10,6 +10,8 @@
#import "webrtc/modules/audio_device/ios/objc/RTCAudioSessionConfiguration.h"
+#import <sys/utsname.h>
+
#import "WebRTC/RTCDispatcher.h"
#import "webrtc/modules/audio_device/ios/objc/RTCAudioSession.h"
@@ -44,6 +46,11 @@ const double kRTCAudioSessionLowComplexitySampleRate = 16000.0;
// sequence without bursts of callbacks back to back.
const double kRTCAudioSessionHighPerformanceIOBufferDuration = 0.01;
+// Use a larger buffer size on iphone 4S to allow it running complex tasks
+// e.g., encoding long frames with Opus codec.
henrika_webrtc 2016/06/17 07:37:37 nit, I would say large frames
minyue-webrtc 2016/06/23 11:35:07 Done.
+NSString* const kIphone4sDeviceTyp = @"iPhone4,1";
+const double kRTCAudioSessionHighPerformanceIOBufferDurationIphone4s = 0.02;
+
// Use a larger buffer size on devices with only one core (e.g. iPhone 4).
// It will result in a lower CPU consumption at the cost of a larger latency.
// The size of 60ms is based on instrumentation that shows a significant
@@ -80,11 +87,22 @@ static RTCAudioSessionConfiguration *gWebRTCConfiguration = nil;
// to ensure that the I/O unit does not have to do sample rate conversion.
// Set the preferred audio I/O buffer duration, in seconds.
NSUInteger processorCount = [NSProcessInfo processInfo].processorCount;
+
+ struct utsname systemInfo;
henrika_webrtc 2016/06/17 07:37:37 Please compare with existing methods in https://cs
minyue-webrtc 2016/06/23 11:35:07 Done.
+ uname(&systemInfo);
+ NSString *device_type = [NSString stringWithCString:systemInfo.machine
+ encoding:NSUTF8StringEncoding];
+
// Use best sample rate and buffer duration if the CPU has more than one
// core.
if (processorCount > 1) {
_sampleRate = kRTCAudioSessionHighPerformanceSampleRate;
- _ioBufferDuration = kRTCAudioSessionHighPerformanceIOBufferDuration;
+ if ([device_type isEqualToString:kIphone4sDeviceTyp]) {
+ _ioBufferDuration =
+ kRTCAudioSessionHighPerformanceIOBufferDurationIphone4s;
+ } else {
+ _ioBufferDuration = kRTCAudioSessionHighPerformanceIOBufferDuration;
+ }
} else {
_sampleRate = kRTCAudioSessionLowComplexitySampleRate;
_ioBufferDuration = kRTCAudioSessionLowComplexityIOBufferDuration;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698