AgoraIO / API-Examples

Play with AgoraSDK and have fun! Everything you need to start learning Agora.
304 stars 218 forks source link

音频自采集(PCM) 报错 push result: -2 #237

Closed 673697831 closed 2 years ago

673697831 commented 2 years ago

API-Examles中音频自采集(PCM)报错,onAudioFrame回调后,agoraKit.pushExternalAudioFrameRawData返回值为-2.控制台一直输出

push result: -2 push result: -2 push result: -2 push result: -2 push result: -2 push result: -2

yoreland commented 2 years ago

是iOS还是macOS的示例呢?

673697831 commented 2 years ago

iOS的,在这个git上面close了在master不行。在官网上下载的zip包也不行。

673697831 commented 2 years ago

token用的是临时的,有关系吗。

673697831 commented 2 years ago

还有在真机上,好像没声音,滑动的ui也有bug,布局也报错了。image1891638970467_ pic

yoreland commented 2 years ago

修复的代码: func onAudioFrame(data: UnsafeMutablePointer, samples: UInt) { let frame = AgoraAudioFrame() frame.buffer = UnsafeMutableRawPointer(data) frame.samplesPerSec = Int(sampleRate) frame.channels = Int(channel) frame.bytesPerSample = 2 frame.samplesPerChannel = self.samples / 2 let ret = agoraKit.pushExternalAudioFrameRawData(pushPos, frame: frame) print("push result: (ret)") }

会马上更新一下分支