In the android native Media Player, mediaplayerservice controls the Media Player. mediaplayerservice creates a mediaplayer and mediaplayer. the native method of Java calls the method in android_media_mediaplayer.cpp through JNI, and then calls mediaplayer. the method in CPP. mediaplayer calls the method in mediaplayerservice through the IPC Mechanism. mediaplayerservice selects a different player to play the music by judging the file format. When it is a MIDI format, sonivox is used to play the music, vorbris is used when the system configuration file allows the Ogg format to be played by vorbris; otherwise, stagefright is used for playback. The remaining formats are determined by the configuration file to determine whether stagefright is used for playing, but stagefright is used for playing, not pvplayer of opencore.
Stagefright is controlled by awesongplayer. It calls the setdatasource () method to load the audio file and selects different Resolvers based on different audio file header fields, this parser isolates audiotrack and videotrack from AV, and then selects different encoders for Encoding Based on the minetype type of audiotrack. This is decoded by audiosource, audiosource is an encapsulation of omxcodec, while audioplayer is used to control audiosource and audiotrack. Audioplayer calls the fillbuffer () method to write the decoded data into the data stream with the final de-code in the data, and finally transmits it to audiotrack. audiotrack then delivers the data to audioflinger. audiotrack calls creataudiotrack () to get the iaudiotrack returned by audioflinger, write the data stream into the iaudiotrack's shared buffer, and then audioflinger reads the data in the cache and submits it to playbacktread for mixing or directly outputting it to the cache and finally giving the data to audiooutput.