The following is a brief diagram of the framework:
Call the method in mediarecorder. Java, such as the start method, and call JNI:
That is, the start method of android_media_recorder.cpp is called:
Go to mediarecorder. CPP and mediarecorder are created by mediaplayerservice, while mediarecoder. CPP and mediaplayerservice communicate between processes through the binder mechanism. In this case, the client controls the server by operating the imediarecorder returned by the server:
Here new mediarecorderclient is actually creating a stagefrightrecorder:
In fact, we call start at the Java layer to call the Strat method in stagefrightrecorder. here we can see that different encoding types will be selected based on the passed moutputformat value (output format:
If we output the 3GP format, we call the startmpeg4recording () method:
Call setupmpeg4recording: