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

Unified Diff: webrtc/modules/audio_device/ios/objc/RTCAudioSession.mm

Issue 2063733002: Resolves issue with bad audio using BT headsets on iOS (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Second attempt 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 | « webrtc/modules/audio_device/ios/audio_device_ios.mm ('k') | 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/RTCAudioSession.mm
diff --git a/webrtc/modules/audio_device/ios/objc/RTCAudioSession.mm b/webrtc/modules/audio_device/ios/objc/RTCAudioSession.mm
index 7ef5110f476a9cf950eaa3cda86dcb721e3ae6e1..acd4bc2429f0341c0b2a67218d75e88c0ac28244 100644
--- a/webrtc/modules/audio_device/ios/objc/RTCAudioSession.mm
+++ b/webrtc/modules/audio_device/ios/objc/RTCAudioSession.mm
@@ -636,6 +636,31 @@ NSInteger const kRTCAudioSessionErrorConfiguration = -2;
return NO;
}
+ // It can happen (e.g. in combination with BT devices) that the attempt to set
+ // the preferred sample rate for WebRTC (48kHz) fails. If so, make a new
+ // configuration attempt using the sample rate that worked using the active
+ // audio session. A typical case is that only 8 or 16kHz can be set, e.g. in
+ // combination with BT headsets. Using this "trick" seems to avoid a state
+ // where Core Audio asks for a different number of audio frames than what the
+ // session's I/O buffer duration corresponds to.
+ // TODO(henrika): this fix resolves bugs.webrtc.org/6004 but it has only been
+ // tested on a limited set of iOS devices and BT devices.
+ double session_sample_rate = self.sampleRate;
tkchin_webrtc 2016/06/15 21:21:46 in ObjC methods, use ObjC style rules. Camel case
henrika_webrtc 2016/06/16 12:12:26 Done.
+ double preferred_sample_rate = webRTCConfig.sampleRate;
+ if (session_sample_rate != preferred_sample_rate) {
+ RTCLogWarning(
tkchin_webrtc 2016/06/15 21:21:46 fyi I've made it to that ObjC files are now 100cha
henrika_webrtc 2016/06/16 12:12:26 Got it. Keeping 80 here to be consistent with the
+ @"Current sample rate (%.2f) is not the preferred rate (%.2f)",
+ session_sample_rate, preferred_sample_rate);
+ if (![self setPreferredSampleRate:session_sample_rate
+ error:&error]) {
+ RTCLogError(@"Failed to set preferred sample rate: %@",
+ error.localizedDescription);
+ if (outError) {
+ *outError = error;
+ }
+ }
+ }
+
return YES;
}
« no previous file with comments | « webrtc/modules/audio_device/ios/audio_device_ios.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698