Force two CPU on Android when taking a photo

Source: Internet
Author: User

Entering the camera to take pictures, taking pictures of the animation and taking pictures of the sound will be probabilistic.
This problem occurs because of the probability that only one CPU is opened during the photo shoot, and the loading will be heavier when taking a picture, resulting in a CPU not being processed, so there will be problems with photo animation and photo lag.
Workaround: Force two CPUs on the photo, enough to handle the loading when taking pictures.
The KK version can be modified as follows.
In the Photoactor.java
1. Add the following code
Import Com.mediatek.common.MediatekClassFactory;
Import Com.mediatek.common.perfservice.IPerfServiceWrapper;
2. Add the following variables
Iperfservicewrapper mperfservice = null;
int mperfservicehandle =-1;
3. Make the following changes in public Photoactor (Camera context)
if (Mwfdmanager! = null) {
Mwfdmanager.addlistener (Mwfdlistener);
}
Add start
Mperfservice = Mediatekclassfactory.createinstance (iperfservicewrapper.class, context);
LOG.D (TAG, "mperfservice =" + Mperfservice);
if (mperfservice! = null && Mperfservicehandle = =-1)
Mperfservicehandle = Mperfservice.userreg (2, 0);
Add End

Mcamerasound = new Mediaactionsound ();
4. Make the following changes in public boolean capture ()
if (mcontinuousshotperformed) {
Mstreamid = 0;
}
Add start
if (mperfservicehandle! =-1 && mperfservice! = null)
{
LOG.D (TAG, "mperfservice.userenabletimeout");
Mperfservice.userenabletimeout (Mperfservicehandle, 10);
}
LOG.D (TAG, "mperfservicehandle =" + Mperfservicehandle);
Add End
Synchronized (Sfacedetectionsync) {
if (!mcameracategory.applyspecialcapture ()) {
Mcontext.getcameradevice (). Takepicture (Getshuttercallback (), Mrawpicturecallback,
Mpostviewpicturecallback, Mcameracategory.getjpegpicturecallback ());
}
sfacedetectionstarted = false;
}

Force two CPU on Android when taking a photo

Related Article

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.