OMX component Integration - Transition to Idle state from loaded state is failing

252 views
Skip to first unread message

guru

unread,
Dec 29, 2009, 11:26:01 PM12/29/09
to android-porting
Hi All,

I have integrated decoder component with OpenCore. If i try to play
audio file it is failing. when I saw the log it is failing when it
tries to change its state to Idle.

My understanding is :

Before it can change to idle state it has to allocate buffers to input
and output ports. then it should call event handler about the state
change.

But according to the log, before allocating the buffers it is trying
to check for buffers(whether allocated) then fails. after failure,
buffers are allocated.

It should be:

Buffer allocation
state transition to idle

but in my case

State transition to idle
Buffer allocation. is happening

What may be the reason?
Since state change is occuring in Component Thread and buffer
allocation in main thread, so is there any timing issue?

E/PV ( 878): PVLOG:TID
(0x5b950):Time=1150:PVMFOMXAudioDecNode::DoPrepare()
: Changing Component state Loaded -> Idle
E/ ( 878): ....Calling OMX_SendCommand
E/ ( 878): OMX_AACLC_COMP.c MySendCommand IN
E/ ( 878): .... State transition command start --> component
thread
E/ ( 878): .... case OMX_StateIdle
E/ ( 878): ........Inside StateIdle While Loop
E/ ( 878): ........Inside StateIdle While Loop
E/ ( 878): ........Inside StateIdle While Loop
E/ ( 878): ........Inside StateIdle While Loop
E/ ( 878): ........Inside StateIdle While Loop
E/ ( 878): ........Inside StateIdle While Loop
E/ ( 878): ........Inside StateIdle While Loop
E/ ( 878): ........Inside StateIdle While Loop
E/ ( 878): ........Inside StateIdle While Loop
E/ ( 878): ........Inside StateIdle While Loop
E/ ( 878): .... Calling Event Handler8
E/ ( 878): CallbackEventHandler Multithread IN
E/ ( 878): CallbackEventHandler Multithread OUT
E/ ( 878): Idle transition failed
E/ ( 878): .... State transition command end --> component
thread ends
E/ ( 878): OMX_AACLC_COMP.c MySendCommand OUT
E/ ( 878): ....Exiting in OMX_SenCommand
E/PV ( 878): PVLOG:TID
(0x5b950):Time=1152:PVMFOMXAudioDecNode::CreateInput
MemPool() start
E/PV ( 878): PVLOG:TID
(0x5b950):Time=1152:PVMFOMXAudioDecNode::CreateInput
MemPool() allocating buffer header pointers and shared media data
ptrs
E/PV ( 878): PVLOG:TID
(0x5b950):Time=1152:PVMFOMXAudioDecNode::CreateInput
MemPool() done
E/PV ( 878): PVLOG:TID
(0x5b950):Time=1152:PVMFOMXAudioDecNode::ProvideBuff
ersToComponent() enter
E/ ( 878): OMX_AACLC_COMP.c MyAllocateBuffer IN
E/ ( 878): OMX_AACLC_COMP.c MyAllocateBuffer OUT
E/PV ( 878): PVLOG:TID
(0x5b950):Time=1153:PVMFOMXAudioDecNode::ProvideBuff
ersToComponent() done
E/PV ( 878): PVLOG:TID
(0x5b950):Time=1153:PVMFOMXAudioDecNode::CreateOutMe
mPool() start
E/PV ( 878): PVLOG:TID
(0x5b950):Time=1153:PVMFOMXAudioDecNode::CreateOutMe
mPool() Allocating output buffer header pointers
E/PV ( 878): PVLOG:TID
(0x5b950):Time=1153:PVMFOMXAudioDecNode::CreateOutMe
mPool() done
E/PV ( 878): PVLOG:TID
(0x5b950):Time=1154:PVMFOMXAudioDecNode::ProvideBuff
ersToComponent() enter
E/ ( 878): OMX_AACLC_COMP.c MyAllocateBuffer IN
E/ ( 878): OMX_AACLC_COMP.c MyAllocateBuffer OUT
E/PV ( 878): PVLOG:TID
(0x5b950):Time=1154:PVMFOMXAudioDecNode::ProvideBuff
ersToComponent() done
E/PV ( 878): PVLOG:TID
(0x5b950):Time=1154:EventHandlerThreadSafeCallbackAO
::Run() In
E/PV ( 878): PVLOG:TID
(0x5b950):Time=1154:EventHandlerThreadSafeCallbackAO
::Run() - No more events, call PendForExec()
E/PV ( 878): PVLOG:TID
(0x5b950):Time=1155:EventHandlerThreadSafeCallbackAO
_Audio::Run() - Calling Process Event
E/PV ( 878): PVLOG:TID
(0x5b950):Time=1155:PVMFOMXAudioDecNode::EventHandle
rProcessing: Event Generated - 1
E/PV ( 878): PVLOG:TID
(0x5b950):Time=1155:PVMFOMXAudioDecNode::EventHandle
rProcessing: OMX_EventError


Thanks
Gururaja

guru

unread,
Dec 31, 2009, 7:32:07 AM12/31/09
to android-porting
HI Ravi

According to Omx call sequence doc for OMX Transition Loaded->Idle
State:

The buffer allocation is handled as part of the allocation to the Idle
state. During this transition,
PV Framework:
● Issues command to the OMX component to change state from
OMX_StateLoaded to
OMX_StateIdle via “OMX_SendCommand” call
● Issues a series of either “OMX_UseBuffer” calls or
“OMX_AllocateBuffer” calls to the
OMX component. The call is used NumInputBuffer times for input port,
and
NumOutputBuffers for the output port.
● Waits for the EventHandler callback to arrive from the component
which notifies the
framework that the component state transition is complete
(OMX_EventCmdComplete).

Since buffer allocation takes time,component has to wait for buffer to
be allocated so that it can go to Idle state.
What mechanism they are using to make component wait for buffers.

Are they using locking mechanism?. Please give me some inputs?

Regards
Gururaja B O

guru

unread,
Jan 3, 2010, 11:36:58 PM1/3/10
to android-porting
Can any one guide me on this? I am thinking to provide thread
synchronization mechanism! between state transition phase and buffer
allocation to I/O ports.

OR

Current implementation itself provides?

> > Gururaja- Hide quoted text -
>
> - Show quoted text -

RaviY

unread,
Jan 4, 2010, 4:29:59 AM1/4/10
to android-porting
"If the IL client requests a state transition from OMX_StateLoaded to
OMX_StateIdle, the
component shall acquire all of its static resources, including buffers
for all enabled ports,
before completing the transition. The component does not acquire
buffers for any
disabled ports. Furthermore, before the transition can complete, the
buffer supplier,
which is always the IL client when not tunneling, shall ensure that
the non-supplier
possesses all of its buffers."

>> What mechanism they are using to make component wait for buffers.

Whos is "they" here?

- Your description of the "transition" seems correct.
- The command to move the component from Loaded to Idle state is an
asynchronous call.
- The command to allocate buffers should be all syncrhonous. So, the
statement that "buffer allocation takes time" should not be relevant
here.

-Ravi

guru

unread,
Jan 4, 2010, 6:46:19 AM1/4/10
to android-porting
> Whos is "they" here?

> - The command to allocate buffers should be all syncrhonous. So, the
> statement that "buffer allocation takes time" should not be relevant
> here.
>>>
hi Ravi

What I mean is, in the log in posted, it is giving "Idle transition
failed " and then it is allocating buffers. My understading is
buffers were not allocated and so state transition is failing.

Since allocate buffers calls are synchronous, state transition should
follow buffer allocations. is it right?

In log SendCommand for state transition to idle is called before
buffer allocations ( as per the PV code path), state transition should
wait for buffer to get allocated!! How this "wait" is happening.?

Regards
Gururaja B O

> > > - Show quoted text -- Hide quoted text -

guru

unread,
Jan 5, 2010, 4:47:34 AM1/5/10
to android-porting
Hi Ravi,

I have gone through PV code base and what i understood is he is

When it sends command for state transition from Loaded to Idle through
SendCommand(), the request will be in pending state until buffers are
allocated. Then it will reschedule the command using RunIfNotReady().

I need one clarification on SendCommand: from OMX specification
document

"The OMX_SendCommand macro will invoke a command on the component.
This is a non-blocking call that should, at a minimum, validate
command parameters but return within five milliseconds." .

whether "five milliseconds" includes --
SendCommand issue, validate command parameters, allocation of buffers
and again rescheduling of the command"? -- Not correct.

just for "SendCommand issue, validate command parameters". I think
this one is correct.

Please clarify my doubt?

Regards
Gururaja B O

Reply all
Reply to author
Forward
0 new messages