android 拍照时强制开两个CPU
此问题发生的原因是在拍照期间概率性只有一颗CPU打开,而拍照时loading会比较重,导致一颗CPU处理不过来,所以会出现拍照动画和拍照声音卡顿的问题。
解决方法:拍照时强制开两颗CPU,足以处理拍照时的loading。
KK版本上可以按以下方法修改。
在photoactor.java中
1. 添加如下代码
import com.mediatek.common.MediatekClassFactory;
import com.mediatek.common.perfservice.IPerfServiceWrapper;
2. 添加如下变量
IPerfServiceWrapper mPerfService = null;
int mPerfServiceHandle = -1;
3. 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. 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;
}
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。