Note that there are some explanatory texts on larger screens.

plurals
  1. POIphone Streaming and playing Audio Problem
    primarykey
    data
    text
    <p>I am trying to make an app that plays audio stream using ffmpeg, libmms.<br> I can open mms server, get stream, and decode audio frame to raw frame using suitable codec.<br> However I don't know how to do next.<br> I think I must use <code>AudioToolbox/AudioToolbox.h</code> and make audioqueue.<br> but however when I give audioqueuebuffer decode buffer's memory and play, Only plays the white noise.<br> Here is my code.</p> <p>What am i missing?<br> Any comment and hint is very appreciated.<br> Thanks very much.</p> <pre><code>while(av_read_frame(pFormatCtx, &amp;pkt)&gt;=0) { int pkt_decoded_len = 0; int frame_decoded_len; int decode_buff_remain=AVCODEC_MAX_AUDIO_FRAME_SIZE * 5; if(pkt.stream_index==audiostream) { frame_decoded_len=decode_buff_remain; int16_t *decode_buff_ptr = decode_buffer; int decoded_tot_len=0; pkt_decoded_len = avcodec_decode_audio2(pCodecCtx, decode_buff_ptr, &amp;frame_decoded_len, pkt.data, pkt.size); if (pkt_decoded_len &lt;0) break; AudioQueueAllocateBuffer(audioQueue, kBufferSize, &amp;buffers[i]); AQOutputCallback(self, audioQueue, buffers[i], pkt_decoded_len); if(i == 1){ AudioQueueSetParameter(audioQueue, kAudioQueueParam_Volume, 1.0); AudioQueueStart(audioQueue, NULL); } i++; } } void AQOutputCallback(void *inData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer, int copySize) { mmsDemoViewController *staticApp = (mmsDemoViewController *)inData; [staticApp handleBufferCompleteForQueue:inAQ buffer:inBuffer size:copySize]; } - (void)handleBufferCompleteForQueue:(AudioQueueRef)inAQ buffer:(AudioQueueBufferRef)inBuffer size:(int)copySize { inBuffer-&gt;mAudioDataByteSize = inBuffer-&gt;mAudioDataBytesCapacity; memcpy((char*)inBuffer-&gt;mAudioData, (const char*)decode_buffer, copySize); AudioQueueEnqueueBuffer(inAQ, inBuffer, 0, NULL); } </code></pre>
    singulars
    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