Index: webrtc/modules/audio_device/ios/voice_processing_audio_unit.mm |
diff --git a/webrtc/modules/audio_device/ios/voice_processing_audio_unit.mm b/webrtc/modules/audio_device/ios/voice_processing_audio_unit.mm |
index 3701f3fee367d383be690fdad1c6effad6a20b0c..3427fbf636e2bca0397bb5c73ca2bb5bf56dee47 100644 |
--- a/webrtc/modules/audio_device/ios/voice_processing_audio_unit.mm |
+++ b/webrtc/modules/audio_device/ios/voice_processing_audio_unit.mm |
@@ -84,6 +84,7 @@ const UInt32 VoiceProcessingAudioUnit::kBytesPerSample = 2; |
bool VoiceProcessingAudioUnit::Init() { |
RTC_DCHECK_EQ(state_, kInitRequired); |
+ RTCLog(@"Init"); |
// Create an audio component description to identify the Voice Processing |
// I/O audio unit. |
@@ -107,19 +108,6 @@ bool VoiceProcessingAudioUnit::Init() { |
return false; |
} |
- // Enable input on the input scope of the input element. |
- UInt32 enable_input = 1; |
- result = AudioUnitSetProperty(vpio_unit_, kAudioOutputUnitProperty_EnableIO, |
- kAudioUnitScope_Input, kInputBus, &enable_input, |
- sizeof(enable_input)); |
- if (result != noErr) { |
- DisposeAudioUnit(); |
- RTCLogError(@"Failed to enable input on input scope of input element. " |
- "Error=%ld.", |
- (long)result); |
- return false; |
- } |
- |
// Enable output on the output scope of the output element. |
UInt32 enable_output = 1; |
result = AudioUnitSetProperty(vpio_unit_, kAudioOutputUnitProperty_EnableIO, |
@@ -194,6 +182,20 @@ bool VoiceProcessingAudioUnit::Initialize(Float64 sample_rate) { |
RTCLog(@"Initializing audio unit with sample rate: %f", sample_rate); |
OSStatus result = noErr; |
+ |
+ // Enable input on the input scope of the input element. |
+ UInt32 enable_input = 1; |
+ result = AudioUnitSetProperty(vpio_unit_, kAudioOutputUnitProperty_EnableIO, |
+ kAudioUnitScope_Input, kInputBus, &enable_input, |
+ sizeof(enable_input)); |
+ if (result != noErr) { |
+ DisposeAudioUnit(); |
+ RTCLogError(@"Failed to enable input on input scope of input element. " |
+ "Error=%ld.", |
+ (long)result); |
+ return false; |
+ } |
+ |
AudioStreamBasicDescription format = GetFormat(sample_rate); |
UInt32 size = sizeof(format); |
#if !defined(NDEBUG) |