Android O media difference(add HIDL)

1. In the initialization
of ACodec::UninitializedState::onAllocateComponent(…), client.connect(&trebleFlag) will be adjusted first, and the mechanism to be adopted will be selected according to property_get_bool("persist.media.treble_omx", true), if it is true, it will be new The Treble process is false, and the old Legacy process is used if it is false.
Legacy calls connectTreble(), the latter is the same as the original one, obtains MediaCodecService, and then obtains the entry of OMX through its getOMX. (New an OMX, which will also create a new OMXMaster)
Treble adjusts connectTreble(), and will take a new HAL interface, which is equivalent to a client of HAL:
a. First getService to get the IOmx service BpHwOmx
b provided by HAL, and then create a new one LWOmx (WOmx.cpp), and initialize its mBase to the IOmx service just obtained, so that the Omx entry on the HAL side is obtained. Later, ACodec gets this LWOmx through client.interface().


2. allocateNode
ACodec calls omx->allocateNode, which is transferred to LWOmx::allocateNode (WOmx.cpp), which will be transferred to Hal's BpHwOmx::allocateNode (OmxAll.cpp, and a new LWOmxNode will be added in the third parameter. mBase is initialized as the IOmxNode service, so it gets the OmxNode entry of the HAL), and then calls to _hidl_mImpl->allocateNode (where _hidl_mImpl is the pointer of Omx), so then it calls the function Omx::allocateNode (Omx.cpp), Among them:
new OMXNodeInstance, and pass in the parameter new LWOmxObserver(observer)
Call mMaster->makeComponentInstance which will take the same parameter &OMXNodeInstance::kCallbacks as 7 (OMXMaster is new in the constructor of Omx)
Next It also uses the original Legacy things. In
Omx ::allocateNode, the OmxNode will be obtained as TWOmxNode.


3. MediaCodecList (the same as N)
is obtained by parsing the following files
media_codecs.xml (/odm/etc, /vendor/etc, under /etc)
media_codecs_performance.xml (/odm/etc, /vendor/etc, under /etc) )
/data/misc/media/media_codecs_profiling_results.xml


4. Internal division of OMX

The OMX of the new Treble framework splits itself into two parts. Part of the control content does not involve node operation, and is finally transferred from Omx to OMXNodeInstance through HAL; the other part is node operation part, which is finally transferred from TWOmxNode to OMXNodeInstance through HAL. Further down is consistent with Legacy's.



5. Component loading

According to the name of the component, find the corresponding OMXPluginBase object, such as QComOMXPlugin for the hard solution. Then call the makeComponentInstance method of QComOMXPlugin to obtain the pointer of the OMX_COMPONENTTYPE object through the encapsulation of the actual component, and save the pointer of the OMX_COMPONENTTYPE object in the formal parameter to return.
 


6、 Calling Sequence(ACodec to OMX)

a. Initialization
 


b. Data processing 1 (input)

During initialization, qc_omx_component_set_callbacks in omx_core_cmp.cpp will also be called in the OMX_GetHandle(…) function of qc_omc_core.c, and then transferred to the set_callbacks of the actual component to complete the assignment of callbacks, and finally m_cb(callbacks) in the actual component corresponds to OMX_CALLBACKTYPE , which corresponds to OMXNodeInstance::kCallbacks.
 
The omx_message::EMPTY_BUFFER_DONE message will first go through OMXNodeInstance::onMessages, then to LWOmxObserver::onMessages, then to TWOmxObserver::onMessages, then to CodecObserver's onMessages, and finally to ACodec::BaseState::onOMXMessage for related processing.


c. Data processing 2 (output)
The related content of callbacks and Observer when emptybuffer is also involved here, and the relationship between them is the same.


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324608658&siteId=291194637