1 Introduction
The multimedia engine of Android froyo has been changed. The stagefright framework has been added, and stagefright is selected for Android by default. The previous opencore is discarded and only the OMX-component part of opencore is referenced.
Stagefright is added only after android2.0. Its stability remains to be discussed and the existence of bugs remains unknown. opencore exists since Android was born and its stability is ensured. However, from the current androidCodeCheck that opencore has a tendency to be replaced by stagefright, so the work on opencore may not be followed. Development on opencore is more complex and time-consuming than on stagefright.
2. framework changes
Taking mediaplayer as an example, let's take a look at the simple multimedia framework.
It can be seen that stagefright is added to the mediaplayerservice layer, which is in parallel with opencore. It is also very easy to switch between opencore and stagefright code.
For details about the internal changes of stagefright, see the overview. Stagefright does not completely abandon opencore. It mainly creates an OMX layer to reference the OMX-component part of opencore. Stagefright is a completely different design from opencore internally.
3. Differences
3.1 supported file formats
The format supported by opencore.
The format supported by stagefright.
3.2 there are differences between parser and Codec Development
Opencore and stagefright are two sets of mechanisms. For our development, they are mainly reflected in parser and codec. In terms of opencore, the corresponding parser-node must be completed according to its specifications, and CODEC must implement the corresponding component according to the OMX specifications. In terms of stagefright, the corresponding extractor and decoder should be implemented according to its specifications.
The most basic implementation is that the two are the same and can be shared. The difference lies in encapsulation. opencore is difficult and requires a lot of work.
3.3 different data processing mechanisms
Shows the opencore processing process.
The engine creates audio/video datapath, and parser/DEC/sink are connected by their respective datapath nodes as node nodes. Subsequent node nodes are scheduled by the Unified scheduler.
The stagefright processing process is shown in.
Audioplayer is a member of awesomeplayer. audioplayer uses callback to drive data acquisition. awesomeplayer uses videoevent to drive data acquisition. There is a commonality between the two, that is, data acquisition is abstracted into msource-> Read (), and the parser and Dec are tied together inside the read.
Comparison between opencore and stagefright processing mechanisms:
(1) The Parser of opencore is separated from Dec, and each row has its own role. stagefright is bound together as an independent atomic operation.
(2) stagefright uses callback and videoevent to drive data output. opencore controls output through sink-node nodes.
(3) In opencore, Parser/DEC/sink is processed in parallel; In stagefright, Parser/DEC/sink is processed in serial mode.
3.4 AV Synchronization
Opencore has a primary clock, and audio/video are synchronized with the primary clock respectively, which serves as the basis for output determination, and audio will continuously calibrate the primary clock.
In the stagefright section, audio is completely callback-Driven Data streams, and the video section obtains the audio timestamp in onvideoevent, which is a traditional AV timestamp for synchronization.
3.5 Stability
Objectively speaking, opencore has existed for a long time and is relatively stable. stagefright is just launched, and there will certainly be unpredictable bugs.
4. Conclusion
1. opencore is relatively mature and stable, and is adopted as a framework with a low risk. parser/codec integration is relatively complicated. If opencore is switched to stagefright in later Android versions, the choice of multimedia engine is a problem.
2. stagefright is released, and there must be unpredictable bugs. Direct adoption has potential risks. parser/codec integration is relatively easy, and the architecture is simplified and easy to understand compared with opencore.
3. Currently, opencore supports more file formats.
4. There is a big difference between opencore and stagefright in terms of data processing mechanism and AV synchronization. You need to evaluate the performance difference on the actual board.
5. If you develop multimedia-related products in Android froyo, we recommend that you use the opencore framework. In this way, the results of the old opencore version can be used and the project time can be saved.
6. opencore supports more file formats than stagefright.
7. If a new Android version or stagefright is updated during project development, the opencore remains unchanged. The multimedia engine change issue will be discussed after the iPad. One option is to continue using opencore, or switch to stagefright when appropriate (think stagefright is stable enough.
Stagefright Reading Notes Appendix
In the comparison between the two solutions, the stagefright code is read and extracted as follows.
Overall stagefright diagram.
Awesomeplayer initialization process in stagefrightplayer
The awesomeplayer block diagram contains the main node elements.
Stagefrightrecorder
Mediaplayer diagram.
Mediarecorder diagram.
The libstagefright sketch covers the main node elements.
Turn: http://blogold.chinaunix.net/u2/61880/showart.php? Id = 2339481