Why might my AudioQueueOutputCallback not be called?

前端 未结 2 992
离开以前
离开以前 2021-02-06 12:49

I\'m using the Audio Queue Services API to play audio streamed from a server over a TCP socket connection on an iPhone. I can play the buffers that were filled from the socket c

相关标签:
2条回答
  • 2021-02-06 13:17

    Try changing self for (void*)self. Like this:

    status = AudioQueueNewOutput(&_streamDescription, AQBufferCallback, (void*)self, CFRunLoopGetCurrent(), kCFRunLoopCommonModes, 0, &_audioQueue);

    0 讨论(0)
  • 2021-02-06 13:19

    Is this executed on the main thread or a background thread? probably not good if CFRunLoopGetCurrent() returns a run loop of a thread that could disappear (thread pool etc) or is a run loop that don't care about kCFRunLoopCommonModes.

    Try to change CFRunLoopGetCurrent() to CFRunLoopGetMain() or make sure AudioQueueNewOutput() and CFRunLoopGetCurrent() is executed on the main thread or a thread that you have control over and has a proper run loop.

    0 讨论(0)
提交回复
热议问题