Code Block [avae] AVAudioEngine.mm:160 Engine@0x2833e1790: could not initialize, error = -10868 [avae] AVAEInternal.h:109 [AVAudioEngineGraph.mm:1397:Initialize: (err = AUGraphParser::InitializeActiveNodesInInputChain(ThisGraph, *GetInputNode())): error -10868 Error starting audio engine: The operation couldn’t be completed. (com.apple.coreaudio.avfaudio error -10868.)
I see that Error code -10878 is:
Code Block @constant kAudioUnitErr_FormatNotSupported Returned if an input or output format is not supported ... kAudioUnitErr_FormatNotSupported = -10868
but that doesn't seem like it can be quite correct. I know that the output format is supported because the same format works correctly when my headphones are not attached. And I am pretty sure that the input format is supported because I am able to simply hook up Headphones InputNode -> Mixer -> Headphones OutputNode and correctly hear the audio from the mic.
So I can only assume that this means the format conversion is not supported.
My Questions:
Is this a bug?
Is there any way I can work around this?
Notes:
My full audio graph looks like this, where all the "mixers" are just AVAudioMixerNodes:
Code Block // InputNode (Mic) -> Mic Mixer -\ // >-> WebRTC Mixer -> Tap -> WebRTC Framework // AudioPlayer 1 -> Player Mixer -/ // // AudioPlayer 2 -> Player Mixer -----> LocalOutputMixer -> OutputNode (Device Speakers/Headphones)
but the issue still happens even if I simplify down to this:
Code Block InputNode (Mic) -> Mixer -> Tap -> WebRTC Framework
Specifically it happens when a single mixer node is connected with an input format and output format as follows:
The input format is:
Code Block (lldb) po audioEngine.inputNode.inputFormat(forBus: 0).streamDescription.pointee ▿ AudioStreamBasicDescription - mSampleRate : 16000.0 - mFormatID : 1819304813 - mFormatFlags : 41 - mBytesPerPacket : 4 - mFramesPerPacket : 1 - mBytesPerFrame : 4 - mChannelsPerFrame : 1 - mBitsPerChannel : 32 - mReserved : 0
The output format WebRTC expects is:
Code Block ▿ AudioStreamBasicDescription - mSampleRate : 48000.0 - mFormatID : 1819304813 - mFormatFlags : 12 - mBytesPerPacket : 2 - mFramesPerPacket : 1 - mBytesPerFrame : 2 - mChannelsPerFrame : 1 - mBitsPerChannel : 16 - mReserved : 0
My headphones are Jaybird Freedom 2.