AudioOutputUnitStart is slow on iphone simulator&device
<p>I work on custom voip application. It relies in audio input/output on CoreAudio.
I discovered a problem - when application calls AudioOutputUnitStart - it freezes for a few seconds. </p>

<pre><code>    OSStatus status;

InitializeAudioSession();
AudioComponentDescription desc;
desc.componentType = kAudioUnitType_Output;
desc.componentSubType = kAudioUnitSubType_RemoteIO;
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
desc.componentFlags = 0;
desc.componentFlagsMask = 0;
mVoiceUnitComponent = AudioComponentFindNext(NULL, &amp;desc);

status = AudioComponentInstanceNew(mVoiceUnitComponent, &amp;mVoiceUnit);
UInt32 enable = 1;
AudioUnitElement inputBus = 1, outputBus = 0;
status = AudioUnitSetProperty(mVoiceUnit, kAudioOutputUnitProperty_EnableIO, 
                                                            kAudioUnitScope_Input, inputBus, 
                                                            &amp;enable, sizeof(enable));
status = AudioUnitSetProperty(mVoiceUnit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Output,
                                                            outputBus, &amp;enable, sizeof(enable));

memset(&amp;mStreamDesc, 0, sizeof(mStreamDesc));
mStreamDesc.mSampleRate = SPK_SAMPLE_RATE;
mStreamDesc.mFormatID = kAudioFormatLinearPCM;
mStreamDesc.mFormatFlags = kAudioFormatFlagsCanonical;
mStreamDesc.mBitsPerChannel = 16;
mStreamDesc.mChannelsPerFrame = 1;
mStreamDesc.mBytesPerFrame = 2;
mStreamDesc.mFramesPerPacket = 1;
mStreamDesc.mBytesPerPacket = 2;
status = AudioUnitSetProperty(mVoiceUnit, kAudioUnitProperty_StreamFormat, 
                                                            kAudioUnitScope_Output, 
                                                            inputBus, &amp;mStreamDesc, sizeof(mStreamDesc));
StartAudioSession();

status = AudioUnitInitialize(mVoiceUnit);
status = AudioUnitSetProperty(mVoiceUnit, kAudioUnitProperty_StreamFormat, 
                                                            kAudioUnitScope_Input, 
                                                            outputBus, &amp;mStreamDesc, sizeof(mStreamDesc));


AURenderCallbackStruct outputCallback;
outputCallback.inputProc = IOSAudio::OutputRenderCallback;
outputCallback.inputProcRefCon = this;
status = AudioUnitSetProperty(mVoiceUnit, kAudioUnitProperty_SetRenderCallback,
                                                            kAudioUnitScope_Input, outputBus, 
                                                            &amp;outputCallback, sizeof(outputCallback));

AURenderCallbackStruct inputCallback;
inputCallback.inputProc = IOSAudio::InputRenderCallback;
inputCallback.inputProcRefCon = this;
status = AudioUnitSetProperty(mVoiceUnit, kAudioOutputUnitProperty_SetInputCallback, 
                                                            kAudioUnitScope_Global, inputBus, 
                                                            &amp;inputCallback, sizeof(inputCallback));


status = AudioOutputUnitStart(mVoiceUnit);

mActive = true;
</code></pre>

<p>The SPK_SAMPLE_RATE is 8000 or 32000 - I tested both of them.</p>

<p>May anyone give me advice?</p>
