Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6346501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:01:44+00:00 2026-05-24T21:01:44+00:00

I am trying to make an app that plays audio stream using ffmpeg, libmms.

  • 0

I am trying to make an app that plays audio stream using ffmpeg, libmms.
I can open mms server, get stream, and decode audio frame to raw frame using suitable codec.
However I don’t know how to do next.
I think I must use AudioToolbox/AudioToolbox.h and make audioqueue.
but however when I give audioqueuebuffer decode buffer’s memory and play, Only plays the white noise.
Here is my code.

What am i missing?
Any comment and hint is very appreciated.
Thanks very much.

while(av_read_frame(pFormatCtx, &pkt)>=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, &frame_decoded_len,
                                                pkt.data, pkt.size);
        if (pkt_decoded_len <0) break;
        AudioQueueAllocateBuffer(audioQueue, kBufferSize, &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->mAudioDataByteSize = inBuffer->mAudioDataBytesCapacity;
    memcpy((char*)inBuffer->mAudioData, (const char*)decode_buffer, copySize);

    AudioQueueEnqueueBuffer(inAQ, inBuffer, 0, NULL);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T21:01:46+00:00Added an answer on May 24, 2026 at 9:01 pm

    You called AQOutputCallback wrongly. You don’t have to necessarilly call that method.
    That method will be called automatically when audio buffers used by audio queue.
    And the prototype of AQOutputCallback was wrong.
    According to your code That method will not be called automatically I think.
    You can Override

    typedef void (*AudioQueueOutputCallback) (
       void                 *inUserData,
       AudioQueueRef        inAQ,
       AudioQueueBufferRef  inBuffer
    );
    

    like this

    void AudioQueueCallback(void* inUserData, AudioQueueRef inAQ, AudioQueueBufferRef 
                           inBuffer);
    

    And you should set the Audio Session When your app starts.
    The important references are here.

    However, What is the extension of Audio you are willing to decode?
    AudioStreamPacketDescription is important if the Audio is Variable Frame per packet.
    Otherwise, if One Frame per One Packet, AudioStreamPacketDescription is not significant.

    What you do next is
    To Set the audio session, To Get raw audio frame using decoder, To Put the frame into the Audio Buffer.
    Instead of you, Make the system to fill the empty buffer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a web app that will continually stream audio in real
I am a student who is trying to make mms stream audio app. I
I am trying to make an app that plays MP3 songs. My program flow
I'm trying to make an app that can play different midi files at the
I am trying to make an app that can shutdown/reboot your phone at the
Im trying to make an app that converts distance/area/volume using spinners as a unit
I'm trying to get smooth audio playback for an app that needs to play
I am trying to make an app that parses data from Twitter using JSON
I'm trying to make an app that can work on multiple devices. Desktop, Mobile
I am trying to make an app that will pass data between two servers

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.