第15讲 cameraserver进程启动之与CameraID和CameraDevice相关变量梳理 - Android Camera Native Framework

本讲是Android Camera Native Framework专题的第15讲,我们介绍cameraserver进程启动之与CameraID和CameraDevice相关变量梳理。

更多资源:

资源 描述
在线课程 极客笔记在线课程
知识星球 星球名称:深入浅出Android Camera 星球ID: 17296815
Wechat 极客笔记圈

CameraProviderManager与Camera ID和Device相关的变量梳理

CameraProviderManager与Camera ID和Device相关的变量梳理

相关代码(来自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与Camera ID和Device相关的变量梳理

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;

Camera课程

Python教程

Java教程

Web教程

数据库教程

图形图像教程

办公软件教程

Linux教程

计算机教程

大数据教程

开发工具教程

Android Camera Native Framework