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}
This commit is contained in:
henrika 2015-07-20 13:09:23 +02:00
parent f421bdc68d
commit 324d9c9a86

View File

@ -28,18 +28,6 @@ namespace webrtc {
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 @@ static void GetHardwareAudioParameters(AudioParameters* playout_parameters,
}
}
#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::InitPlayout() {
}
int32_t AudioDeviceIOS::InitRecording() {
LOGI() << "InitPlayout";
LOGI() << "InitRecording";
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(_initialized);
DCHECK(!_recIsInitialized);
@ -666,9 +666,6 @@ int32_t AudioDeviceIOS::InitPlayOrRecord() {
// files.
_audioInterruptionObserver = (__bridge_retained void*)observer;
// Deactivate the audio session.
ActivateAudioSession(session, false);
return 0;
}
@ -698,6 +695,10 @@ int32_t AudioDeviceIOS::ShutdownPlayOrRecord() {
_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;
}