From 25a0aef19e170d2695f64b4c48296e7914155a88 Mon Sep 17 00:00:00 2001 From: Zhijun He Date: Wed, 25 Jun 2014 11:40:02 -0700 Subject: Camera1: Don't send partial results to ZSL clients ZSL clients expect each received result as a complete result, and send back to HAL as a reprocess capture request. CaptureSequencer client assumes results to be non-partial too, it need look into some metadata that may not be present in partial results. Change-Id: Id716913fd6e1c914726abd6610fddf91141783c2 --- services/camera/libcameraservice/api1/Camera2Client.cpp | 4 ++-- services/camera/libcameraservice/api1/Camera2Client.h | 3 ++- .../libcameraservice/api1/client2/CaptureSequencer.cpp | 12 ++++++++++-- .../camera/libcameraservice/api1/client2/ZslProcessor.cpp | 3 ++- .../camera/libcameraservice/api1/client2/ZslProcessor3.cpp | 3 ++- services/camera/libcameraservice/api2/CameraDeviceClient.cpp | 2 +- .../camera/libcameraservice/common/FrameProcessorBase.cpp | 6 +++--- services/camera/libcameraservice/common/FrameProcessorBase.h | 6 +++--- 8 files changed, 25 insertions(+), 14 deletions(-) (limited to 'services') diff --git a/services/camera/libcameraservice/api1/Camera2Client.cpp b/services/camera/libcameraservice/api1/Camera2Client.cpp index 0b6ad92..1642896 100644 --- a/services/camera/libcameraservice/api1/Camera2Client.cpp +++ b/services/camera/libcameraservice/api1/Camera2Client.cpp @@ -1674,8 +1674,8 @@ int Camera2Client::getZslStreamId() const { } status_t Camera2Client::registerFrameListener(int32_t minId, int32_t maxId, - wp listener) { - return mFrameProcessor->registerListener(minId, maxId, listener); + wp listener, bool sendPartials) { + return mFrameProcessor->registerListener(minId, maxId, listener, sendPartials); } status_t Camera2Client::removeFrameListener(int32_t minId, int32_t maxId, diff --git a/services/camera/libcameraservice/api1/Camera2Client.h b/services/camera/libcameraservice/api1/Camera2Client.h index 0e06195..5ce757a 100644 --- a/services/camera/libcameraservice/api1/Camera2Client.h +++ b/services/camera/libcameraservice/api1/Camera2Client.h @@ -117,7 +117,8 @@ public: int getZslStreamId() const; status_t registerFrameListener(int32_t minId, int32_t maxId, - wp listener); + wp listener, + bool sendPartials = true); status_t removeFrameListener(int32_t minId, int32_t maxId, wp listener); diff --git a/services/camera/libcameraservice/api1/client2/CaptureSequencer.cpp b/services/camera/libcameraservice/api1/client2/CaptureSequencer.cpp index 8268f65..cb9aca6 100644 --- a/services/camera/libcameraservice/api1/client2/CaptureSequencer.cpp +++ b/services/camera/libcameraservice/api1/client2/CaptureSequencer.cpp @@ -350,8 +350,10 @@ CaptureSequencer::CaptureState CaptureSequencer::manageZslStart( return DONE; } + // We don't want to get partial results for ZSL capture. client->registerFrameListener(mCaptureId, mCaptureId + 1, - this); + this, + /*sendPartials*/false); // TODO: Actually select the right thing here. res = processor->pushToReprocess(mCaptureId); @@ -393,8 +395,14 @@ CaptureSequencer::CaptureState CaptureSequencer::manageStandardStart( bool isAeConverged = false; // Get the onFrameAvailable callback when the requestID == mCaptureId + // We don't want to get partial results for normal capture, as we need + // Get ANDROID_SENSOR_TIMESTAMP from the capture result, but partial + // result doesn't have to have this metadata available. + // TODO: Update to use the HALv3 shutter notification for remove the + // need for this listener and make it faster. see bug 12530628. client->registerFrameListener(mCaptureId, mCaptureId + 1, - this); + this, + /*sendPartials*/false); { Mutex::Autolock l(mInputMutex); diff --git a/services/camera/libcameraservice/api1/client2/ZslProcessor.cpp b/services/camera/libcameraservice/api1/client2/ZslProcessor.cpp index 2a2a5af..10463c1 100644 --- a/services/camera/libcameraservice/api1/client2/ZslProcessor.cpp +++ b/services/camera/libcameraservice/api1/client2/ZslProcessor.cpp @@ -202,7 +202,8 @@ status_t ZslProcessor::updateStream(const Parameters ¶ms) { } client->registerFrameListener(Camera2Client::kPreviewRequestIdStart, Camera2Client::kPreviewRequestIdEnd, - this); + this, + /*sendPartials*/false); return OK; } diff --git a/services/camera/libcameraservice/api1/client2/ZslProcessor3.cpp b/services/camera/libcameraservice/api1/client2/ZslProcessor3.cpp index 1dcb718..79ea2c3 100644 --- a/services/camera/libcameraservice/api1/client2/ZslProcessor3.cpp +++ b/services/camera/libcameraservice/api1/client2/ZslProcessor3.cpp @@ -148,7 +148,8 @@ status_t ZslProcessor3::updateStream(const Parameters ¶ms) { } client->registerFrameListener(Camera2Client::kPreviewRequestIdStart, Camera2Client::kPreviewRequestIdEnd, - this); + this, + /*sendPartials*/false); return OK; } diff --git a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp index 544f736..de42cee 100644 --- a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp +++ b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp @@ -82,7 +82,7 @@ status_t CameraDeviceClient::initialize(camera_module_t *module) mFrameProcessor->registerListener(FRAME_PROCESSOR_LISTENER_MIN_ID, FRAME_PROCESSOR_LISTENER_MAX_ID, /*listener*/this, - /*quirkSendPartials*/true); + /*sendPartials*/true); return OK; } diff --git a/services/camera/libcameraservice/common/FrameProcessorBase.cpp b/services/camera/libcameraservice/common/FrameProcessorBase.cpp index f6a971a..2c82049 100644 --- a/services/camera/libcameraservice/common/FrameProcessorBase.cpp +++ b/services/camera/libcameraservice/common/FrameProcessorBase.cpp @@ -37,11 +37,11 @@ FrameProcessorBase::~FrameProcessorBase() { } status_t FrameProcessorBase::registerListener(int32_t minId, - int32_t maxId, wp listener, bool quirkSendPartials) { + int32_t maxId, wp listener, bool sendPartials) { Mutex::Autolock l(mInputMutex); ALOGV("%s: Registering listener for frame id range %d - %d", __FUNCTION__, minId, maxId); - RangeListener rListener = { minId, maxId, listener, quirkSendPartials }; + RangeListener rListener = { minId, maxId, listener, sendPartials }; mRangeListeners.push_back(rListener); return OK; } @@ -176,7 +176,7 @@ status_t FrameProcessorBase::processListeners(const CaptureResult &result, List::iterator item = mRangeListeners.begin(); while (item != mRangeListeners.end()) { if (requestId >= item->minId && requestId < item->maxId && - (!quirkIsPartial || item->quirkSendPartials)) { + (!quirkIsPartial || item->sendPartials)) { sp listener = item->listener.promote(); if (listener == 0) { item = mRangeListeners.erase(item); diff --git a/services/camera/libcameraservice/common/FrameProcessorBase.h b/services/camera/libcameraservice/common/FrameProcessorBase.h index 15a014e..ee44a8b 100644 --- a/services/camera/libcameraservice/common/FrameProcessorBase.h +++ b/services/camera/libcameraservice/common/FrameProcessorBase.h @@ -45,10 +45,10 @@ class FrameProcessorBase: public Thread { // Register a listener for a range of IDs [minId, maxId). Multiple listeners // can be listening to the same range. - // QUIRK: sendPartials controls whether partial results will be sent. + // sendPartials controls whether partial results will be sent. status_t registerListener(int32_t minId, int32_t maxId, wp listener, - bool quirkSendPartials = true); + bool sendPartials = true); status_t removeListener(int32_t minId, int32_t maxId, wp listener); @@ -66,7 +66,7 @@ class FrameProcessorBase: public Thread { int32_t minId; int32_t maxId; wp listener; - bool quirkSendPartials; + bool sendPartials; }; List mRangeListeners; -- cgit v1.1