2024年11月02日 第15讲 cameraserver进程启动之与CameraID和CameraDevice相关变量梳理 极客笔记
本讲是Android Camera Native Framework专题的第15讲,我们介绍cameraserver进程启动之与CameraID和CameraDevice相关变量梳理。
更多资源:
资源 | 描述 |
---|---|
在线课程 | 极客笔记在线课程 |
知识星球 | 星球名称:深入浅出Android Camera 星球ID: 17296815 |
极客笔记圈 |
相关代码(来自Android 13)
frameworks\av\services\camera\libcameraservice\common\CameraProviderManager.h
std::vector> mProviders;
struct ProviderInfo : public virtual RefBase {
std::vector> mDevices;
std::unordered_set mUniqueCameraIds;
std::vector mUniqueAPI1CompatibleCameraIds;
// The initial public camera IDs published by the camera provider.
// Currently logical multi-camera is not supported for hot-plug camera.
// And we use this list to keep track of initial public camera IDs
// advertised by the provider, and to distinguish against "hidden"
// physical camera IDs.
std::vector mProviderPublicCameraIds;
struct DeviceInfo {
const std::vector& mPublicCameraIds;
}
}
CameraService | CameraProviderManager |
---|---|
mNumberOfCameras mNumberOfCamerasWithoutSystemCamera |
所有Provider的mUniqueCameraIds总和 |
mNormalDeviceIds mNormalDeviceIdsWithoutSystemCamera |
所有Provider的mUniqueAPI1CompatibleCameraIds总和,剔除HIDDEN_SECURE_CAMERA,针对Logical Multi-Cam每个Facing只暴露一个logical camera ID出去 |
mCameraStates(camera ID -> camera state) | Logical device的onDeviceStatusChanged |
mTorchStatusMap(camera id -> torch status) -removeStates做remove -addStates做add | Logical device的onDeviceStatusChanged |
mPerfClassPrimaryCameraIds – 参考mNormalDeviceIdsWithoutSystemCamera | mUniqueCameraIds |
代码逻辑请参考视频讲解(来自Android 13)
// Number of camera devices (excluding hidden secure cameras)
int mNumberOfCameras;
// Number of camera devices (excluding hidden secure cameras and
// system cameras)
int mNumberOfCamerasWithoutSystemCamera;
std::vector mNormalDeviceIds;
std::vector mNormalDeviceIdsWithoutSystemCamera;
std::set mPerfClassPrimaryCameraIds;
// Mapping from camera ID -> state for each device, map is protected by mCameraStatesLock
std::map> mCameraStates;
// camera id -> torch status
KeyedVector mTorchStatusMap;
本文链接:http://so.lmcjl.com/news/16830/