#frameworks/av/services/camera/libcameraservice/device3/Camera3Device.cpp
ProcessCaptureResult_3_4
#frameworks/av/services/camera/libcameraservice/device3/Camera3OutputUtils.cpp
ProcessOneCaptureResultLocked
processcaptureresult
returnAndRemovePendingOutputBuffers
returnOutputBuffers
#frameworks/av/services/camera/libcameraservice/device3/Camera3Stream.cpp
stream->returnBuffer
camera3stream::returnBuffer
Camera3Stream::removeOutstandingBuffer(清空outputbuffer)
returnBufferLocked
4.Camera3OutputStream
camera3outputstream::returnBufferLocked
camera3Iostreambase::returnAnyBufferLocked
camera3outputstream::returnbuffercheckedlocked
queueBufferToConsumer
consumer->queuebuffer(消费buffer)
mHandoutOutputTotalBufferCount-- (buffer减一)
#frameworks/av/services/camera/libcameraservice/device3/Camera3OutputUtils.cpp
sendCaptureResult
insertResultLocked(states, &captureResult, frameNumber)
states.resultQueue.insert
states.resultSignal.notify_one
FrameProcessorBase的threadLoop也是在起预览的initializeImpl函数中触发,initializeImpl函数在openCamera时调用。
#/frameworks/av/services/camera/libcameraservice/api2/CameraDeviceClient.cpp
status_t CameraDeviceClient::initializeImpl(TProviderPtr providerPtr) {
ATRACE_CALL();
status_t res;
res = Camera2ClientBase::initialize(providerPtr);
if (res != OK) {
return res;
}
String8 threadName;
mFrameProcessor = new FrameProcessorBase(mDevice);
threadName = String8::format("CDU-%s-FrameProc", mCameraIdStr.string());
#frameworks/av/services/camera/libcameraservice/common/FrameProcessorBase.cpp
threadLoop
device->waitForNextFrame(Camera3Device.cpp)
processNewFrames(device)
device->getNextResult (Camera3Device.cpp)
processSingleFrame
processListeners(result, device)
(*item)->onResultAvailable
#frameworks/av/services/camera/libcameraservice/api2/CameraDeviceClient.cpp
CameraDeviceClient::onResultAvailable
remoteCb->onResultReceived
#frameworks/base/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java
onResultReceived
holder.getCallback().onCaptureProgressed
holder.getCallback().onCaptureCompleted //app侧获取的每一帧处理数据的回调,从回调参数CaptureResult中读取