Purge the contents of a data container in real time

冷暖自知 提交于 2019-12-02 10:31:07

Circular buffers aka ring buffers work nicely with NSMutableData since you can use the byte array directly as the buffer.

Looking at the design, I don't see why you need so many buffers. There appears to be one thread and two buffers too many. Why not just have one ring buffer, fill that up (it's 'self purging') and read from it in a separate thread? Is the design yours (ie can be changed) or has it been imposed on you?

In any event, try using a ring buffer for your audio pool.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!