Note that there are some explanatory texts on larger screens.

plurals
  1. PORTP streaming using AudioQueue
    primarykey
    data
    text
    <p>I have set up an audioQueue with audio format kAudioFormatMPEG4AAC (which I believe is AAC-LC). I'm looking for some code to send those AAC packets over RTP (does I just need to add a header ?) and a tip to make a good SDP because I don't find any documentation about iphone AAC hardware encoder. I tried this without success :</p> <pre><code>-(OSStatus) initializeAQ{ aqData.mDataFormat.mSampleRate = 44100; aqData.mDataFormat.mFormatID = kAudioFormatMPEG4AAC; aqData.mDataFormat.mFormatFlags = 0; aqData.mDataFormat.mBytesPerPacket = 0; // 0 for VBR aqData.mDataFormat.mFramesPerPacket = 1024; aqData.mDataFormat.mBytesPerFrame = 0; // 0 for compressed format aqData.mDataFormat.mChannelsPerFrame = 1; aqData.mDataFormat.mBitsPerChannel = 0; // 0 for compressed format aqData.bufferByteSize = 0x1388; // quite random AudioQueueNewInput(&amp;aqData.mDataFormat, HandleInputBuffer, &amp;aqData, CFRunLoopGetMain(), kCFRunLoopCommonModes, 0, &amp;aqData.mQueue); aqData.mCurrentPacket = 0; aqData.mIsRunning = true; //--- prepare set of audio queue buffers ---// for(int i = 0 ; i &lt; nBuffer ; i++){ AudioQueueAllocateBuffer(aqData.mQueue, aqData.bufferByteSize, &amp;aqData.mBuffers[i]); AudioQueueEnqueueBuffer(aqData.mQueue, aqData.mBuffers[i], 0, NULL); } NSLog(@"starting audio queue"); //--- start ---// return AudioQueueStart(aqData.mQueue, NULL); } static void HandleInputBuffer( void *aqData, AudioQueueRef inAq, AudioQueueBufferRef inBuffer, const AudioTimeStamp *inStartTime, UInt32 inNumPackets, const AudioStreamPacketDescription *inPacketDesc ) { AQRecorderState *pAqData = (AQRecorderState*) aqData; if( inNumPackets == 0 &amp;&amp; pAqData-&gt;mDataFormat.mBytesPerPacket != 0 ){ inNumPackets = inBuffer-&gt;mAudioDataByteSize/pAqData-&gt;mDataFormat.mBytesPerPacket; } UInt32 x = 0; for(; x &lt; inNumPackets ; x++){ SInt64 offset = inPacketDesc[x].mStartOffset; UInt32 len = inPacketDesc[x].mDataByteSize; unsigned char *packet[len]; bzero(packet, len); memcpy(packet,(unsigned char*)(inBuffer-&gt;mAudioData)+offset,len); NSData* data = [[NSData alloc]initWithBytes:packet length:len]; //[s send:data]; [s send:data withTime:inStartTime-&gt;mHostTime]; } AudioQueueEnqueueBuffer(pAqData-&gt;mQueue,inBuffer,0,NULL); } </code></pre> <p>send() add a RTP header like <a href="http://www.siptutorial.net/RTP/header.html" rel="nofollow">this one</a> and send the packet over udp.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload