本讲是android camera性能分析专题的第14讲,我们介绍从cameraserver角度详解camera启动性能,包括如下内容:
- 从cameraserver角度详解camera启动性能
- cameraserver核心函数流程拆解
资源 | 描述 |
---|---|
在线课程 | |
知识星球 | 星球名称:深入浅出android camera 星球id: 17296815 |
极客笔记圈 |
从cameraserver角度详解camera启动性能
模块 | 开始点 | 结束点 |
---|---|---|
app | 点击camera app icon | 开始调用connectdevice |
hal | 开始调用connectdevice | 调用connectdevice结束 |
app | 调用connectdevice结束 | 开始调用endconfigure |
hal | 开始调用endconfigure | 调用endconfigure结束 |
app | 调用endconfigure结束 | 调用submitrequestlist |
hal | 调用submitrequestlist | cameraserver收到第一帧 |
cameraserver核心函数流程拆解
getcameracharacteristics
1.shouldrejectsystemcameraconnection
2.getcameracharacteristicslocked // 从cameraprovidermanager中获取cameracharacteristics
3.getcameracharacteristics::checkpermission
connectdevice
会调用到hal的camerahal::opensession
1.validateconnectlocked
2.cameradeviceclient::initializeimpl
camera2clientbase::initializeimpl
camera3device::initialize
camerahal::opensession
3.finishconnectlocked
createdefaultrequest
会调用到hal的camerahal::constructdefaultrequestsettings
1.cameradeviceclient::createdefaultrequest
camera3device::createdefaultrequest
camerahal::constructdefaultrequestsettings
beginconfigure
cameradeviceclient::beginconfigure //not implemented yet
createstream
核心在创建 camera3outputstream
cameradeviceclient::createstream
sessionconfigurationutils::createsurfacefromgbp
query(width,height,format,dataspace)
camera3device::createstream
new camera3outputstream
setstreamtransformlocked
endconfigure
会调用到hal的camerahal::configurestreams
cameradeviceclient::endconfigure
camera3device::configurestreams
camera3stream::startconfiguration
camerahal::configurestreams
camera3stream::finishconfiguration
boost priority of request thread to sched_fifo
submitrequestlist
capturerequest送下来后会等待active
cameradeviceclient::submitrequestlist
camera3device::setstreamingrequestlist
camera3device::requestthread::setrepeatingrequests
camera3device::waituntilstatethenrelock
request thread线程开始给hal送request,调用 camerahal::processbatchcapturerequests
camera3device::requestthread::threadloop
camera3device::requestthread::waitfornextrequestbatch
camera3device::requestthread::preparehalrequests
camera3device::requestthread::sendrequestsbatch
camerahal::processbatchcapturerequests
statustracker通知status变化:
camera3device::notifystatus
camera3device::internalupdatestatuslocked
mstatuschanged.broadcast
camera2clientbase::notifyactive
cameraservice::basicclient::startcamerastreamingops
stream 0: first full buffer
hal回调processcaptureresult后,如果有buffer,则取出来 queuebuffer给 consumer
camera3device::processcaptureresult
camera3outpututils::returnandremovependingoutputbuffers
camera3outpututils::returnoutputbuffers
camera3stream::returnbuffer
camera3outputstream::returnbufferlocked
camera3iostreambase::returnanybufferlocked
camera3outputstream::returnbuffercheckedlocked
camera3outputstream::queuebuffertoconsumer