正在学习,FFMpeg解码后得到音频流,怎么填充到AudioUnit的播放回调函数中,现在还没有解决,如果有路过的大神,还望指教一二,小弟不胜感激...😆
static OSStatus playbackCallback(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumberFrames,
AudioBufferList *ioData) {
NSLog(@"sdsd");
HZAudioPlayTool *audioTool = [HZAudioPlayTool shareHZAudioPlayTool];
[audioTool ReceiveAudioWithAudio:^(char *pcm) {
AudioBuffer buffer ;
buffer.mNumberChannels = 1;
buffer.mDataByteSize = 320 ;
buffer.mData = malloc (320 );
NSLog(@"sss1-%d",pcm);
memcpy(buffer.mData, pcm, 320);
NSLog(@"buffer.mData-%d",buffer.mData);
NSLog(@"%d",memcmp(buffer.mData, pcm, 320));
AudioBufferList bufferList;
bufferList.mNumberBuffers = 1;
bufferList.mBuffers[0] = buffer;
OSStatus status;
status = AudioUnitRender(audioUnit,
ioActionFlags,
inTimeStamp,
inBusNumber,
inNumberFrames,
&bufferList);
NSLog(@"sss-%d", bufferList.mBuffers[0].mData);
}];
return noErr;
}