OSDN Git Service

camera3: Don't eagerly finish configuring bidi streams more than once
authorIgor Murashkin <iam@google.com>
Thu, 2 May 2013 21:59:28 +0000 (14:59 -0700)
committerIgor Murashkin <iam@google.com>
Thu, 2 May 2013 21:59:28 +0000 (14:59 -0700)
Finishing all stream configuration immediately is good, but when a stream is
both input and output it attempted to finish configuring bidi streams twice.
Since all ZSL streams are bidi, when we had a ZSL stream active preview would
immediately stop working.

Bug: 8563838
Change-Id: Iec998f11f6405fc15f3f31bd7cd29f03a7968d14

services/camera/libcameraservice/Camera3Device.cpp

index 5f87e8b..5e5bfc2 100644 (file)
@@ -1060,7 +1060,7 @@ status_t Camera3Device::configureStreamsLocked() {
     // TODO: Try to relax this later back to lazy completion, which should be
     // faster
 
-    if (mInputStream != NULL) {
+    if (mInputStream != NULL && mInputStream->isConfiguring()) {
         res = mInputStream->finishConfiguration(mHal3Device);
         if (res != OK) {
             SET_ERR_L("Can't finish configuring input stream %d: %s (%d)",
@@ -1070,11 +1070,15 @@ status_t Camera3Device::configureStreamsLocked() {
     }
 
     for (size_t i = 0; i < mOutputStreams.size(); i++) {
-        res = mOutputStreams.editValueAt(i)->finishConfiguration(mHal3Device);
-        if (res != OK) {
-            SET_ERR_L("Can't finish configuring output stream %d: %s (%d)",
-                    mOutputStreams[i]->getId(), strerror(-res), res);
-            return res;
+        sp<Camera3OutputStreamInterface> outputStream =
+            mOutputStreams.editValueAt(i);
+        if (outputStream->isConfiguring()) {
+            res = outputStream->finishConfiguration(mHal3Device);
+            if (res != OK) {
+                SET_ERR_L("Can't finish configuring output stream %d: %s (%d)",
+                        outputStream->getId(), strerror(-res), res);
+                return res;
+            }
         }
     }