如何从iOS远程端播放音频缓冲区?

时间:2012-11-18 09:35:05

标签: objective-c ios audio voip audioqueue

我发布了一个关于从Recorder中获取AudioBuffer的问题,

  

我的相关问题:   Is there any high level Audio Queue Record Service Library for iOS?

我可以从记录器中获取缓冲区并将其放入NSData,然后通过udp socket发送。

但如何在另一台iOS设备上使用缓冲区?

有没有办法播放缓冲区?

我研究了一些示例代码,但大多数只是在录音机录音时播放。

还有更多细节教程可以从远程播放缓冲区吗?

  

更新:我刚刚解决了它

关键功能是播放回调功能!

static OSStatus playbackCallback(void *inRefCon, 
                                  AudioUnitRenderActionFlags *ioActionFlags, 
                                  const AudioTimeStamp *inTimeStamp, 
                                  UInt32 inBusNumber, 
                                  UInt32 inNumberFrames, 
                                  AudioBufferList *ioData) {    
    // Notes: ioData contains buffers (may be more than one!)
    // Fill them up as much as you can. Remember to set the size value in each buffer to match how
    // much data is in the buffer.
    return noErr;
}
  

BTW,应该经常检查您使用的低级别内容!

     

例如: malloc memcpy free

1 个答案:

答案 0 :(得分:1)

如果我理解了您的问题,那么我认为此链接可以为您提供帮助:https://github.com/mattgallagher/AudioStreamer

AudioStreamer用于在流式传输时播放远程音频。

相关问题