Android7.0 Mediarecorder Source Analysis

Source: Internet
Author: User

Recently in the camera program (two-process open a camera), involving the use of Mediarecorder for video recording, or a new set of video system. Next I will record the source code analysis of the process.
Binder communication between client and server is analyzed in the next article
(Client)
STEP One (contructor)
1../base/media/java/android/media/mediarecorder.java

In the construction of Mediarecorder, the method of Native_setup () is used (native method).
One way to do this in Androidruntime Registernativemethods is to register the current method with androidruntime, eliminating our work on the load of so.

2../base/media/jni/android_media_mediarecorder.cpp:

One of the SP Mr = New Mediarecorder (String16 (Oppackagenamestr.c_str ())), the method is the key to our Mediarecorder creation. About SP WP suggested that you are interested in the students to see, here can be understood as smart pointers.

3.av/media/libmedia/mediarecorder.cpp

point{
(1) Const SP Service (Getmediaplayerservice ());
(2) Mmediarecorder = Service->createmediarecorder (oppackagename);
}

Getmediaplayerservice () gets to ServiceManager. Get to DISCROOPTOYONGSHIYULE178.COMR (Media.player) services through Servicemanagthd178.comer (this is also Mediarecorder ( jnihuarenyl.cn) did not go to the cause of bpmediaplayerservice.), and then by calling the service's Createmediarecorder () method to get a Mediarecorder object

(Server)
4../av/media/libmediaplayerservice/mediaplayerservice.cpp

An SP retriever = new Metadataretrieverclient (PID) was created in servicer;

5.av/media/libmediaplayerservice/mediarecorderclient.cpp

This way, an instance of Stagefrightrecorder is created, which is primarily performed by Mediarecorder, including {
Receive some camera,audio data, encode the data, write the video file.
}

Android7.0 Mediarecorder Source Analysis

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.