Objective-C: AudioOutputUnitStart takes a long time to start. Possible workaround?

試著忘記壹切 提交于 2019-12-12 05:57:55

问题


AudioOutputUnitStart function takes up to 1-2 seconds to start every time I call it. I use AudioOutputUnitStop to stop it, is there something like AudioOutputUnitPause so that it only takes this much to start first time? Or do I have to keep it all the time started and output silence when "stopped" (this doesn't seem right)

Thanks!

EDIT: The sound I play it's pretty short (under a second, streaming continuously ) so I don't think it's that, probably that's how much it usually takes no matter the sound size.


回答1:


Try to decrease your buffer size for your audio data. iOS will not begin playing until the first buffer is filled with data. If this buffer size is quite big, it might take 1-2 seconds.



来源:https://stackoverflow.com/questions/5690460/objective-c-audiooutputunitstart-takes-a-long-time-to-start-possible-workaroun

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