2

I implemented QuickBlox into my app and audio chats via Mic worked but I would like to send an AudioBuffer from a audio unit render callback of an mp3. I thought it had to do with the format so I set the format of my audio player to:

AudioStreamBasicDescription inputASBL = {0};

inputASBL.mSampleRate =          static_cast<Float64>(8000);
inputASBL.mFormatID =            kAudioFormatLinearPCM;
inputASBL.mFormatFlags =         kAudioFormatFlagIsPacked | kAudioFormatFlagIsSignedInteger,
inputASBL.mFramesPerPacket =     1;
inputASBL.mChannelsPerFrame =    2;
inputASBL.mBitsPerChannel =      sizeof(short) * 8;
inputASBL.mBytesPerPacket =      sizeof(short) * 2;
inputASBL.mBytesPerFrame =       sizeof(short) * 2;
inputASBL.mReserved =            0;
[ioNode setStreamFormat:&inputASBL scope:kAudioUnitScope_Input bus:0];

I send the AudioBuffer Like this:

OSStatus MyAURenderCallback(void *inRefCon,
                        AudioUnitRenderActionFlags *actionFlags,
                        const AudioTimeStamp *inTimeStamp,
                        UInt32 inBusNumber,
                        UInt32 inNumberFrames,
                        AudioBufferList *ioData) {

    AudioUnit mixerUnit = mixerNode.audioUnit;
    AudioUnitRender(mixerUnit,actionFlags,inTimeStamp,inBusNumber,inNumberFrames,ioData);

if(isStreaming){
    AudioBufferList ab = *ioData;
    [[AppDelegate del].videoChat processVideoChatCaptureAudioBuffer:ab.mBuffers[0]];
}
    //renderCoundt++;

return noErr;
}

The receiving device isn't getting anything, but I know it's setup correctly because when I switch out for the microphone it plays fine.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
keji
  • 5,947
  • 3
  • 31
  • 47

0 Answers0