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

Unified Diff: webrtc/modules/audio_device/ios/audio_device_ios.mm

Issue 1418483004: Deactivate the audio session after a call ends using the AVAudioSessionSetActiveOptionNotifyOthersO… (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 2 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/audio_device_ios.mm
diff --git a/webrtc/modules/audio_device/ios/audio_device_ios.mm b/webrtc/modules/audio_device/ios/audio_device_ios.mm
index f26e9f1cc7463657a2646aa28f4789cc9bbe73b2..b94ea17b7f62a96d78be7f2f85f92a18d8630edb 100644
--- a/webrtc/modules/audio_device/ios/audio_device_ios.mm
+++ b/webrtc/modules/audio_device/ios/audio_device_ios.mm
@@ -86,13 +86,21 @@ static void ActivateAudioSession(AVAudioSession* session, bool activate) {
NSError* error = nil;
BOOL success = NO;
- // Deactivate the audio session and return if |activate| is false.
if (!activate) {
- success = [session setActive:NO error:&error];
+ // Deactivate the audio session using an extra option and then return.
+ // AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation is used to
+ // ensure that other audio sessions that were interrupted by our session
+ // can return to their active state. It is recommended for VoIP apps to
+ // use this option.
+ success = [session
tkchin_webrtc 2015/11/16 21:40:34 nit: maybe just break it onto next line (you can
henrika_webrtc 2015/11/17 13:52:32 withOptions:AVAudioSessionSetActiveOptionNotifyOth
+ setActive:NO
+ withOptions:AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation
+ error:&error];
RTC_DCHECK(CheckAndLogError(success, error));
return;
}
+ // Go ahead and active our own audio session since |activate| is true.
// Use a category which supports simultaneous recording and playback.
// By default, using this category implies that our app’s audio is
// nonmixable, hence activating the session will interrupt any other
« 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