This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Issue about aac decoder in DVRRDK3.05

Hi,

I test the aac decoder provided in DVRRDK3.05 and find that the decoder consumes one frame of aac data each time. I comment the else branch in following codes in rpe_audio.c and the decoder could decode all the frames in the input file.

if (pPrm->inBuf.dataBufSize >= ctx->decMinInputBufSize)
{
pPrm->inBuf.dataBufSize = ctx->decMinInputBufSize;
}
else
{
pPrm->numSamples = 0;
pPrm->outBuf.dataBufSize = 0;
pPrm->inBuf.dataBufSize = 0;
return 0;
}

 I have question about the input buffer size of the decoder. In the audio_decode demo, the inBufSize is set to 3840 which is the minInBufSize of the decoder.( I use 2048/1024/768/640 as the inBufSize and find the mini number should be 640) I use davinci.aac as the input file and search the actual bytes feed to the decoder each time. I find the last time 223 bytes are fed to the decoder which is just the length of the last aac frame. So, I try to just read one acc frame each time and feed the data to the decoder. But I get "AUDIO: DEC -> AUDIO: Rpe process call failed, status: 1". I don't know why the decode fails to work in the way. It is just the same as the last time which the decoder do in audio_decode demo.

Could someone give me the answer? Thanks!

  • Hi Bing,

    Are you observing the error for only last frame or first frame?

    In davinci.aac, last frame has 223 bytes. But each frame is having variable frameSizes. As I mentioned, decoder expects one complete frame in input buffer. But first frame has 371 bytes. So if you feed only 223 bytes for first frame , decoder will fail and return INSUFFICIENTDATA error.

    Ram

  • Hi Ram,

    Thanks so much for your reply! Before I do the test, I get the frame length of all the frames in davinci.aac. Then I read one frame and feed it to the decoder. I get the error  "AUDIO: DEC -> AUDIO: Rpe process call failed, status: 1" every time after calling Adec_process() function. I don't see the INSUFFICIENTDATA error.

  • Hi Ram,

    I want to receive aduio stream from internet. The src will send one frame per socket, so I try to test getting data from local file firstly. As read one frame each time and feed the data to the decoder does not work, I try another way:

    0. alloc 2560 bytes for the inBuf 

    1. if(!feof(infile))

          read one frame each time to the inBuf ;

        else

        {

         if(current data in inBuf<=0)

            exit ;

         }

    2.if(current data in inBuf> 1536)

          feed the data to the decoder ;

          update the current data in inBuf ;

          go to 1;

       else if( the infile is to the end )

         feed the data to the decoder ;

         update the current data in inBuf ;

         go to 1;

       else

          go to 1;

    The infile has 433 frames and for the first 429 times the decoder works well. But when it does the 430 time decode, I get the error "AUDIO: DEC -> AUDIO: Rpe process call failed, status: 1" just as before. I just don't know why error occurs. I could not find differences between the 430 time and all the 429 times before. I attach the infile test.aac, the framelengh.txt and the info during the task running. 

    Thanks !

  • Hi Bing,

    Is it possible to get the information inArgs.numBytes, outArgs.bytesconsumed and outArgs.extendedError ?

    This will help in root-causing the issue.

    Ram

  • Hi Ram,

    Sorry for reply so late. I make some mistakes in the codes and now the program could run successfully. I cache 5 aac frames into the inBuf before starting decode, and the decoder do the decode task with no problem. When the input audio stream is stopped, the decoder continues to decode the last 5 frames. But if I do not cache frames before starting decode, the decoder will give errors. So I think maybe there is some limitation when starting the decoder.

  • Hi Bing,

    If there is no data in input buffer before you start decode means there is no valid data in the input buffer, hence decoder throws error. This is expected.

    Can you check one thing When you accumulate 5 frames in input buffer,  outArgs.byteConsumed for 5 process calls is matching with what you fed to decoder before you start decoding.

    Ram

  • Hi Ram,

    What do you mean by 'When you accumulate 5 frames in input buffer,  outArgs.byteConsumed for 5 process calls is matching with what you fed to decoder before you start decoding“? I don't quite understand. Do you mean after the decoder starts to work, in the first 5 processes, if it consumes the 5 frames which I accumulate in the input buffer?  I want to know why the decoder could not work when I don't accumulate frames and just feed the frame received to the decoder. Which means I receive one frame and put it to the inbuf of the decoder, then call the Adec_process. There is valid data in the input buffer.

  • Hi Bing,

    From your statement "But if I do not cache frames before starting decode, the decoder will give errors", I assumed you are not filling any data in input buffer.

    If there is valid data of one complete in input buffer, decoder should be able to decoder.

    Can you try to get the information of bytesConsumed and extendedError returned from the decoder? 

    This may help in understanding the scenario.

    Ram

  • Hi Ram,

    Sorry for mislead you. I print the current bytes in the input buffer and the actual bytes consumed after decode process. The following are the results:

    currentBytes is 371 The actual bytes consumed is 371
    currentBytes is 372 The actual bytes consumed is 372
    currentBytes is 371 The actual bytes consumed is 371
    currentBytes is 372 The actual bytes consumed is 372

    ......

    currentBytes is 376 The actual bytes consumed is 376
    currentBytes is 382 The actual bytes consumed is 382
    currentBytes is 385 AUDIO: DEC -> AUDIO: Rpe process call failed, status: 1
    The actual bytes consumed is 385
    currentBytes is 382 AUDIO: DEC -> AUDIO: Rpe process call failed, status: 1
    The actual bytes consumed is 382
    currentBytes is 373 AUDIO: DEC -> AUDIO: Rpe process call failed, status: 1
    The actual bytes consumed is 373

    ......

    You could see that although the error occurs the actual bytes consumed is just the same as the bytes in the input buffer. I also check the output pcm file and find that even after the error shows up the output pcm data is right. I mean I open the pcm file in cooledit and the audio is right both for contents and length. So I don't know what the error indicates. Could I just ignore it?