Android4.4 Camera镜像问题
所谓的镜像问题,就和我们手机上的镜子道理一样,手机上的镜子打开的是前置摄像头,然后手机上显示的方向和我们的实际方向应当一致(左边是左边,右边是右边)如果发现不一致,则在框架层做如下修改。
修改 framework\av\services\camera\libcameraservice\apil 目录下的CameraClient.cpp
status_t CameraClient::sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) {
LOG1("sendCommand (pid %d)", getCallingPid());
int orientation;
Mutex::Autolock lock(mLock);
status_t result = checkPidAndHardware();
if (result != NO_ERROR) return result;
if (cmd == CAMERA_CMD_SET_DISPLAY_ORIENTATION) {
// Mirror the preview if the camera is front-facing.
orientation = getOrientation(arg1, mCameraFacing == CAMERA_FACING_FRONT);
// 新添加
if(mCameraFacing == CAMERA_FACING_FRONT)
orientation = 0;
...
return mHardware->sendCommand(cmd, arg1, arg2);
}
================================================================================================
欢迎关注我的个人微信公众号,公众号会记录自己开发的点滴,还有日常的生活,希望和更多的小伙伴一起交流~~