AudioComponentInstanceNew takes up to five seconds to complete

We are using a VoiceProcessingIO audio unit in our VoIP application on Mac. In certain scenarios, the AudioComponentInstanceNew call blocks for up to five seconds (at least two). We are using the following code to initialize the audio unit:

OSStatus status;
AudioComponentDescription desc;
AudioComponent inputComponent;
desc.componentType = kAudioUnitType_Output;
desc.componentSubType = kAudioUnitSubType_VoiceProcessingIO;
desc.componentFlags = 0;
desc.componentFlagsMask = 0;
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
inputComponent = AudioComponentFindNext(NULL, &desc);
status = AudioComponentInstanceNew(inputComponent, &unit);

We are having the issue with current MacOS versions on a host of different Macs (x86 and x64 alike). It takes two to three seconds until AudioComponentInstanceNew returns.

We also see the following errors in the log multiple times:

AUVPAggregate.cpp:2560 AggInpStreamsChanged wait failed

and those right after (which I don't know if they matter to this issue):

KeystrokeSuppressorCore.cpp:44 ERROR: KeystrokeSuppressor initialization was unsuccessful. Invalid or no plist was provided. AU will be bypassed. vpStrategyManager.mm:486 Error code 2003332927 reported at GetPropertyInfo
Answered by Engineer in 790464022

Thank you for sharing a code snippet. I don't see anything wrong with your code. Please use Feedback Assistant to submit a bug report, and please post here the ID generated by Feedback Assistant. If possible, please capture a sysdiagnose with the exact time you were able to reproduce the issue and attach it to your bug report.

Thank you for sharing a code snippet. I don't see anything wrong with your code. Please use Feedback Assistant to submit a bug report, and please post here the ID generated by Feedback Assistant. If possible, please capture a sysdiagnose with the exact time you were able to reproduce the issue and attach it to your bug report.

Thank you. The ID generated by Feedback Assistant is FB13879429

I am also seeing this with the AVAudioEngine APIs.

@oliverpahl-mitel did you ever hear back from Apple on your feedback assistant post?

At runtime here are the errors that get dumped to console (I get the KeystrokeSuppressorCore.cpp:44 ERROR, but I don't see the AggInpStreamsChanged wait failed you are getting).

If I setup an input node with inputNode.setVoiceProcessingEnabled(true), here are the errors that get dumped to console:

AddInstanceForFactory: No factory registered for id <CFUUID 0x60000300f780> F8BB1C28-BAE8-11D6-9C31-00039315CD46
throwing -10877
throwing -10877
        vpPlatformUtil.mm:312   Cannot retrieve theDeviceBoardID string...
        vpPlatformUtil.mm:312   Cannot retrieve theDeviceBoardID string...
AudioHardware-mac-imp.cpp:409    AudioObjectHasProperty: no object with given ID 0
        AUVPAggregate.cpp:4929  Failed to get current tap stream physical format, err=2003332927
vpSetupUplinkDSPChain.cpp:124    >vp> skip reference mixer setup because reference channel count is 0
KeystrokeSuppressorCore.cpp:44    ERROR: KeystrokeSuppressor initialization was unsuccessful. Invalid or no plist was provided. AU will be bypassed.
vpSetupUplinkDSPChain.cpp:124    >vp> skip reference mixer setup because reference channel count is 0
     vpStrategyManager.mm:486   Error code 2003332927 reported at GetPropertyInfo
vpSetupUplinkDSPChain.cpp:124    >vp> skip reference mixer setup because reference channel count is 0
KeystrokeSuppressorCore.cpp:44    ERROR: KeystrokeSuppressor initialization was unsuccessful. Invalid or no plist was provided. AU will be bypassed.
vpSetupUplinkDSPChain.cpp:124    >vp> skip reference mixer setup because reference channel count is 0
KeystrokeSuppressorCore.cpp:44    ERROR: KeystrokeSuppressor initialization was unsuccessful. Invalid or no plist was provided. AU will be bypassed.
vpSetupUplinkDSPChain.cpp:124    >vp> skip reference mixer setup because reference channel count is 0
     vpStrategyManager.mm:486   Error code 2003332927 reported at GetPropertyInfo
vpSetupUplinkDSPChain.cpp:124    >vp> skip reference mixer setup because reference channel count is 0
KeystrokeSuppressorCore.cpp:44    ERROR: KeystrokeSuppressor initialization was unsuccessful. Invalid or no plist was provided. AU will be bypassed.
vpSetupUplinkDSPChain.cpp:124    >vp> skip reference mixer setup because reference channel count is 0
KeystrokeSuppressorCore.cpp:44    ERROR: KeystrokeSuppressor initialization was unsuccessful. Invalid or no plist was provided. AU will be bypassed.
vpSetupUplinkDSPChain.cpp:124    >vp> skip reference mixer setup because reference channel count is 0
     vpStrategyManager.mm:486   Error code 2003332927 reported at GetPropertyInfo
vpSetupUplinkDSPChain.cpp:124    >vp> skip reference mixer setup because reference channel count is 0
KeystrokeSuppressorCore.cpp:44    ERROR: KeystrokeSuppressor initialization was unsuccessful. Invalid or no plist was provided. AU will be bypassed.
vpSetupUplinkDSPChain.cpp:124    >vp> skip reference mixer setup because reference channel count is 0
KeystrokeSuppressorCore.cpp:44    ERROR: KeystrokeSuppressor initialization was unsuccessful. Invalid or no plist was provided. AU will be bypassed.
vpSetupUplinkDSPChain.cpp:124    >vp> skip reference mixer setup because reference channel count is 0
     vpStrategyManager.mm:486   Error code 2003332927 reported at GetPropertyInfo
        HALB_IOThread.cpp:326    HALB_IOThread::_Start: there already is a thread
        HALB_IOThread.cpp:326    HALB_IOThread::_Start: there already is a thread

For reference, if I switch inputNode.setVoiceProcessingEnabled(false) and keep all of my surrounding code the same, the following messages are dumped to console:

AddInstanceForFactory: No factory registered for id <CFUUID 0x600003ff2500> F8BB1C28-BAE8-11D6-9C31-00039315CD46
throwing -10877
throwing -10877
AudioComponentInstanceNew takes up to five seconds to complete
 
 
Q