play_and_record_with_coreaudio
play_and_record_with_coreaudio copied to clipboard
关于 AudioQueueBuffer 内存管理的问题
在 https://github.com/cz-it/play_and_record_with_coreaudio/blob/master/audiotoolbox/audioqueue/player.md#内存管理 这一节的最后,你提到:
创建Buffer对象并保存在 mBuffers 数组中。
其释放在调用Queue的Dispose的时候会自动进行释放。
也就是说 AudioQueueBuffer 对象的创建和释放是由 AudioQueue 控制,那么将其保存在 mBuffers 数组中是否没有必要?将 demo 中把 buffer 加入 mBuffers 数组的逻辑去掉(仅用 AudioQueueAllocateBuffer 创建3个 AudioQueueBufferRef 对象),编译运行并没有发生问题。