I'm experiencing an issue that occurs when the number of samples provided by the callback set using "kAudioOutputUnitProperty_SetInputCallback" in AudioUnit.set_input_callback increases.
On my device, this happens whenever a bluetooth headset is selected as the current audio device.
When switching from the speaker or earpeice (which provide 1024 samples), to a bluetooth headset, the change in the number of samples is detected and the buffer is resized using "vec.reserve_exact(data_byte_size - len);"
However, the mDataByteSize property of the buffer is not updated to reflect this change. This results in the framework printing the error:
3072 frames, 2 bytes/frame, expected 6144-byte buffer; ioData.mBuffers[0].mDataByteSize=2048; kAudio_ParamError
I tried updating this value and API worked for a few seconds before crashing with memory corruption.
e.g. malloc: Incorrect checksum for freed object 0x10700b800: probably modified after being freed.
I'm unsure how the corruption is occurring, and for now I have worked around this in our project by allocating a new buffer when the number of samples changes.
Hi!
I'm experiencing an issue that occurs when the number of samples provided by the callback set using "kAudioOutputUnitProperty_SetInputCallback" in AudioUnit.set_input_callback increases.
On my device, this happens whenever a bluetooth headset is selected as the current audio device.
When switching from the speaker or earpeice (which provide 1024 samples), to a bluetooth headset, the change in the number of samples is detected and the buffer is resized using "vec.reserve_exact(data_byte_size - len);"
However, the mDataByteSize property of the buffer is not updated to reflect this change. This results in the framework printing the error: 3072 frames, 2 bytes/frame, expected 6144-byte buffer; ioData.mBuffers[0].mDataByteSize=2048; kAudio_ParamError
I tried updating this value and API worked for a few seconds before crashing with memory corruption. e.g. malloc: Incorrect checksum for freed object 0x10700b800: probably modified after being freed.
I'm unsure how the corruption is occurring, and for now I have worked around this in our project by allocating a new buffer when the number of samples changes.
Any thoughts?
Thanks