Avoids error message about unknown selected data source for Port iPhone Microphone
TBR=tkchin
BUG=webrtc:4845
TEST=modules_unittests
Review URL: https://codereview.webrtc.org/1237233003 .
Cr-Commit-Position: refs/heads/master@{#9602}
diff --git a/webrtc/modules/audio_device/ios/audio_device_ios.mm b/webrtc/modules/audio_device/ios/audio_device_ios.mm
index cb15032..1d3c8e3 100644
--- a/webrtc/modules/audio_device/ios/audio_device_ios.mm
+++ b/webrtc/modules/audio_device/ios/audio_device_ios.mm
@@ -28,18 +28,6 @@
using ios::CheckAndLogError;
-#if !defined(NDEBUG)
-static void LogDeviceInfo() {
- LOG(LS_INFO) << "LogDeviceInfo";
- @autoreleasepool {
- LOG(LS_INFO) << " system name: " << ios::GetSystemName();
- LOG(LS_INFO) << " system version: " << ios::GetSystemVersion();
- LOG(LS_INFO) << " device type: " << ios::GetDeviceType();
- LOG(LS_INFO) << " device name: " << ios::GetDeviceName();
- }
-}
-#endif
-
static void ActivateAudioSession(AVAudioSession* session, bool activate) {
LOG(LS_INFO) << "ActivateAudioSession(" << activate << ")";
@autoreleasepool {
@@ -121,6 +109,18 @@
}
}
+#if !defined(NDEBUG)
+static void LogDeviceInfo() {
+ LOG(LS_INFO) << "LogDeviceInfo";
+ @autoreleasepool {
+ LOG(LS_INFO) << " system name: " << ios::GetSystemName();
+ LOG(LS_INFO) << " system version: " << ios::GetSystemVersion();
+ LOG(LS_INFO) << " device type: " << ios::GetDeviceType();
+ LOG(LS_INFO) << " device name: " << ios::GetDeviceName();
+ }
+}
+#endif
+
AudioDeviceIOS::AudioDeviceIOS()
: audio_device_buffer_(nullptr),
_critSect(*CriticalSectionWrapper::CreateCriticalSection()),
@@ -249,7 +249,7 @@
}
int32_t AudioDeviceIOS::InitRecording() {
- LOGI() << "InitPlayout";
+ LOGI() << "InitRecording";
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(_initialized);
DCHECK(!_recIsInitialized);
@@ -666,9 +666,6 @@
// files.
_audioInterruptionObserver = (__bridge_retained void*)observer;
- // Deactivate the audio session.
- ActivateAudioSession(session, false);
-
return 0;
}
@@ -698,6 +695,10 @@
_auVoiceProcessing = nullptr;
}
+ // All I/O should be stopped or paused prior to deactivating the audio
+ // session, hence we deactivate as last action.
+ AVAudioSession* session = [AVAudioSession sharedInstance];
+ ActivateAudioSession(session, false);
return 0;
}