Software AAC codec stuck using Codec2 interface / Setting pipeline threshold

1,037 views
Skip to first unread message

NimeshChanchani

unread,
Feb 24, 2021, 11:47:01 AM2/24/21
to android-platform
Hi All,

My player application is using media codec NDK API's to  decode (H.264 video and AAC audio). 

After I pause for about 3.3 s , the software AAC decoder using Codec2 plugin errors out.
with the following message:
W/CCodec: previous call to queue exceeded timeout
E/MediaCodec: Codec reported err 0x80000000, actionCode 0, while in state 6

If I use OMX plugin instead , I don't get this error.

similar issue was faced by exoplayer team earlier:

current state of NDK application decoding/rendering threads is:

decoder thread ( no more input buffers to dequeue)
renererthread ( not dequeueing output buffer)

on investigation i found that :
there is a Watchdog timer that is started whenever CCodec executes a command.  
and this releases the codec if a particular frame spends more than threshold time (3.3s ) in the pipeline AND the no. of frames in the pipeline is Greater than the threshold (2 frames) . 
This threshold is derived from adding up (inputDelay+OutputDelay+pipelineDelay)

Now, when we pause:

In error case:

We constantly have 3 frames in the pipeline(PipelineWatcher logs enabled) , which is above threshold. So after 3.3 s codec is released by framework assuming that pipeline is stuck.

in OK case:

We constantly have 2 frames in the pipeline , and on pausing it remains 2 , hence the framework assumes we are not stuck.

On investigation looks like 

threshold values are part of codec configuration. in our case we have recd. 2:

CCodecConfig: c2::u32 output.delay.value = 2 
CCodecConfig: c2::u32 input.delay.value = 0

My questions are following:
1. My understanding is that  input/output and pipeline delay values are NOT part of Codec specific data of AAC and are CCodec configuration . Is this correct?
2. Who configures these values ( ? MediaCodec) 
3. What are the guidelines for setting   input/output and pipeline delay and how to decide what value to set?
4. if we want to change pipeline delay values where do we make the change?

Thanks&Regards
Nimesh

Glenn Kasten

unread,
Feb 25, 2021, 11:29:28 AM2/25/21
to android-platform
Please consider filing a bug here, with test case:
Reply all
Reply to author
Forward
0 new messages