本讲是Android Camera Native Framework专题的第33讲,我们介绍Camera Native FW的Open Camera之CameraDeviceClient成员变量详解。
更多资源:
资源 | 描述 |
---|---|
在线课程 | 极客笔记在线课程 |
知识星球 | 星球名称:深入浅出Android Camera 星球ID: 17296815 |
极客笔记圈 |
Camera API2 makeClient流程
Camera API2 Client 类图
Camera 各Client的职责
Category | Camera Client | 职责 |
---|---|---|
API2 | CameraDeviceClient | 负责处理与API2相关的业务逻辑 |
API2 | CameraDeviceClientBase | 负责继承API2的ICameraDeviceUser |
API1/API2 | Camera2ClientBase | 负责处理API1和API2共用的逻辑且与Camera Device有关 |
API1/API2 | CameraService::BasicClient | 负责处理API1和API2共用的逻辑且与Camera Device无关 |
API1 | Camera2Client | 负责处理与API1相关的业务逻辑 |
API1 | CameraService::Client | 负责继承API1的ICamera(BnCamera) |
CameraDeviceClient成员变量详解
成员变量类型 | 成员变量 | 描述 |
---|---|---|
FrameProcessorBase | mFrameProcessor | 从Device获取每帧的Result Metadata |
vector |
mSupportedPhysicalRequestKeys | Physical Camera支持设置的Request Keys,submitRequest时用于过滤掉不支持的Request设置 |
KeyedVector<sp |
mStreamMap | 以Map方式存在,key是GraphicBufferProducer,value是Stream&Surface ID(shared的情况,一个Stream有多个Surface) |
KeyedVector<int32_t, OutputConfiguration> | mConfiguredOutputs | 保存上层配置的OutputConfiguration列表 |
map<int64_t, int64_t> | mDynamicProfileMap | (profile id -> Supported dynamic profiles bit map) 存放支持的Dynamic Range Profiles,submitRequest时会对设置的值做检查 |
InputStreamConfiguration | mInputStream | 存放Input Stream,只支持一路Input Stream |
int32_t | mStreamingRequestId | 存放Streaming的Request ID,每次调用submitRequestList后,Request ID会++,主要用于判断Repeating request是否处于Active |
成员变量类型 | 成员变量 | 描述 |
---|---|---|
int32_t | mRequestIdCounter; | submitRequestList时++,唯一标识当前的这次submit request行为 |
vector |
mPhysicalCameraIds | 存放当前CameraDevice对应的Physical Camera,对logical multi camera有效 |
Vector |
mDeferredStreams | 存放处于Deferred状态的Output Stream,Surface ready后会move到mStreamMap |
map<int32_t, OutputStreamInfo> | mStreamInfoMap | stream ID -> outputStreamInfo mapping,记录每路output stream的info |
map<std::string, std::unordered_set |
mHighResolutionCameraIdToStreamIdSet | 高分辨率(>=24M)的camera id (logical / physical) -> list of stream ids,检查Request里面设置的Sensor Pixel Model与OutputConfiguration里面设置的Sensor Pixel Mode是否一致。 |
set |
mHighResolutionSensors | 支持高分辨率Stream的Camera,有ULTRA_HIGH_RESOLUTION_SENSOR capability |
KeyedVector<sp |
mCompositeStreamMap | 等价于mStreamMap,存放需要做Composite的Stream:HEIC,JPEG_DEPTH(Jpeg with XMP depth metadata),JpegR(Jpeg with Recovery map) |
成员变量类型 | 成员变量 | 描述 |
---|---|---|
CameraProviderManager | mProviderManager | 存放CameraProviderManager的实例,用于判断是否是logical multi-cam和isSessionConfigurationSupported |
bool | mOverrideForPerfClass | 是否要Override the camera characteristics for performance class primary cameras,在isSessionConfigurationSupported使用 |
string | mUserTag | CaptureRequest.setTag设置的,记录最新设置的mUserTag,记录在event log里面 |
int | mVideoStabilizationMode | 记录最新设置的Video Stabilization Mode,记录在event log里面 |
CameraDeviceClient与Stream相关的变量
CameraDeviceClientBase成员变量详解
成员变量类型 | 成员变量 | 描述 |
---|---|---|
ICameraDeviceCallbacks | mRemoteCallback | 保存给App进程的回调对象实例 |
Camera2ClientBase成员变量详解
成员变量类型 | 成员变量 | 描述 |
---|---|---|
SharedCameraCallbacks | mSharedCameraCallbacks | 保存给App进程的回调对象实例 |
pid_t | mInitialClientPid | 记录初始化Camera Client时传递的Client PID |
bool | mOverrideForPerfClass | 是否要Override the camera characteristics for performance class primary cameras |
bool | mLegacyClient | Client是否是API1 |
CameraServiceProxyWrapper | mCameraServiceProxyWrapper | CameraServiceProxy对象,用于与之交互 |
CameraDeviceBase | mDevice | 存放CameraDeviceBase的实例 |
bool | mDeviceActive | 标识当前Camera Device是否处于Active状态 |
int | mApi1CameraId | API1的Camera ID(整型),如果是API2,这个值为-1 |
CameraServiceWatchdog | mCameraServiceWatchdog | Camera Client的Watch Dog,监控disconnect是否timeout |
CameraService::BasicClient成员变量详解
成员变量类型 | 成员变量 | 描述 |
---|---|---|
CameraService | sCameraService | 保存CameraService的实例,用于Client回调CameraService |
String8 | mCameraIdStr | Camera ID |
int | mCameraFacing | Camera的朝向(BACK或FRONT) |
int | mOrientation | Camera sensor的安装角度 |
String16 | mClientPackageName | 客户端进程的package name |
bool | mSystemNativeClient | 是否是System Native Client(UID < AID_APP_START的Native进程) |
String16 | mClientFeatureId | Client进程的feature id(mContext.getAttributionTag()),在操作AppOpsManager使用 |
pid_t | mClientPid | Client的PID |
uid_t | mClientUid | Client的UID |
pid_t | mServicePid | Camera Service的PID |
bool | mDisconnected | 当前Client是否处于Disconnect状态 |
bool | mUidIsTrusted | UID是否是可信的(mediaserver, cameraserver, telephony可信) |
成员变量类型 | 成员变量 | 描述 |
---|---|---|
bool | mOverrideToPortrait | 是否要将Stream通过RotateAndCrop成Portrait,兼容性考虑 |
int32_t | mAudioRestriction | 对Audio的限制策略 |
IBinder | mRemoteBinder | 保存给App进程的回调对象实例 |
AppOpsManager | mAppOpsManager | AppOpsManager,用于检查Client是否有Camera操作权限 |
OpsCallback | mOpsCallback | AppOps的回调,用于通知App的操作权限变化 |
bool | mOpsActive | 是否开始监听Camera Ops |
bool | mOpsStreaming | 是否开始执行Camera Ops |