this crash only occus on iOS 17.0.
Crash Stack:
#136 Thread
SIGSEGV
SEGV_ACCERR
0 AudioToolbox AQ::API::V2Impl::AllocateBuffer(OpaqueAudioQueue*, void*, unsigned int, AudioStreamPacketDescription*, unsigned int, AudioQueueBuffer**) + 772
1 AudioToolbox AQ::API::V2Impl::AllocateBuffer(OpaqueAudioQueue*, void*, unsigned int, AudioStreamPacketDescription*, unsigned int, AudioQueueBuffer**) + 584
related codes:
- (instancetype)init {
if (self = [super init]) {
// settings
int Channels = 2;
int bytesPerFrame = 2 * Channels;
AudioStreamBasicDescription streamDesc;
streamDesc.mSampleRate = 44100;
streamDesc.mFormatID = kAudioFormatLinearPCM;
streamDesc.mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked;
streamDesc.mBytesPerPacket = bytesPerFrame;
streamDesc.mFramesPerPacket = 1;
streamDesc.mBytesPerFrame = bytesPerFrame;
streamDesc.mChannelsPerFrame = Channels;
streamDesc.mBitsPerChannel = 16;
streamDesc.mReserved = 0;
// queue
AudioQueueNewOutput(&streamDesc, AEAudioQueueOutputCallback, (__bridge void * _Nullable)(self), nil, nil, 0, &_playQueue);
AudioQueueSetParameter(_playQueue, kAudioQueueParam_Volume, 1.0);
// buffers
for (int i = 0; i < QUEUE_BUFFER_SIZE; i++) {
AudioQueueAllocateBuffer(_playQueue, MIN_SIZE_PER_FRAME, _bufferList+i);
}
}
return self;
}