OSDN Git Service

Camera1: Don't send partial results to ZSL clients
authorZhijun He <zhijunhe@google.com>
Wed, 25 Jun 2014 18:40:02 +0000 (11:40 -0700)
committerZhijun He <zhijunhe@google.com>
Sat, 28 Jun 2014 00:53:38 +0000 (17:53 -0700)
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
services/camera/libcameraservice/api1/Camera2Client.h
services/camera/libcameraservice/api1/client2/CaptureSequencer.cpp
services/camera/libcameraservice/api1/client2/ZslProcessor.cpp
services/camera/libcameraservice/api1/client2/ZslProcessor3.cpp
services/camera/libcameraservice/api2/CameraDeviceClient.cpp
services/camera/libcameraservice/common/FrameProcessorBase.cpp
services/camera/libcameraservice/common/FrameProcessorBase.h

index 0b6ad92..1642896 100644 (file)
@@ -1674,8 +1674,8 @@ int Camera2Client::getZslStreamId() const {
 }
 
 status_t Camera2Client::registerFrameListener(int32_t minId, int32_t maxId,
-        wp<camera2::FrameProcessor::FilteredListener> listener) {
-    return mFrameProcessor->registerListener(minId, maxId, listener);
+        wp<camera2::FrameProcessor::FilteredListener> listener, bool sendPartials) {
+    return mFrameProcessor->registerListener(minId, maxId, listener, sendPartials);
 }
 
 status_t Camera2Client::removeFrameListener(int32_t minId, int32_t maxId,
index 0e06195..5ce757a 100644 (file)
@@ -117,7 +117,8 @@ public:
     int getZslStreamId() const;
 
     status_t registerFrameListener(int32_t minId, int32_t maxId,
-            wp<camera2::FrameProcessor::FilteredListener> listener);
+            wp<camera2::FrameProcessor::FilteredListener> listener,
+            bool sendPartials = true);
     status_t removeFrameListener(int32_t minId, int32_t maxId,
             wp<camera2::FrameProcessor::FilteredListener> listener);
 
index 8268f65..cb9aca6 100644 (file)
@@ -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);
index 2a2a5af..10463c1 100644 (file)
@@ -202,7 +202,8 @@ status_t ZslProcessor::updateStream(const Parameters &params) {
     }
     client->registerFrameListener(Camera2Client::kPreviewRequestIdStart,
             Camera2Client::kPreviewRequestIdEnd,
-            this);
+            this,
+            /*sendPartials*/false);
 
     return OK;
 }
index 1dcb718..79ea2c3 100644 (file)
@@ -148,7 +148,8 @@ status_t ZslProcessor3::updateStream(const Parameters &params) {
     }
     client->registerFrameListener(Camera2Client::kPreviewRequestIdStart,
             Camera2Client::kPreviewRequestIdEnd,
-            this);
+            this,
+            /*sendPartials*/false);
 
     return OK;
 }
index 544f736..de42cee 100644 (file)
@@ -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;
 }
index f6a971a..2c82049 100644 (file)
@@ -37,11 +37,11 @@ FrameProcessorBase::~FrameProcessorBase() {
 }
 
 status_t FrameProcessorBase::registerListener(int32_t minId,
-        int32_t maxId, wp<FilteredListener> listener, bool quirkSendPartials) {
+        int32_t maxId, wp<FilteredListener> 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<RangeListener>::iterator item = mRangeListeners.begin();
         while (item != mRangeListeners.end()) {
             if (requestId >= item->minId && requestId < item->maxId &&
-                    (!quirkIsPartial || item->quirkSendPartials)) {
+                    (!quirkIsPartial || item->sendPartials)) {
                 sp<FilteredListener> listener = item->listener.promote();
                 if (listener == 0) {
                     item = mRangeListeners.erase(item);
index 15a014e..ee44a8b 100644 (file)
@@ -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<FilteredListener> listener,
-                              bool quirkSendPartials = true);
+                              bool sendPartials = true);
     status_t removeListener(int32_t minId, int32_t maxId,
                             wp<FilteredListener> listener);
 
@@ -66,7 +66,7 @@ class FrameProcessorBase: public Thread {
         int32_t minId;
         int32_t maxId;
         wp<FilteredListener> listener;
-        bool quirkSendPartials;
+        bool sendPartials;
     };
     List<RangeListener> mRangeListeners;