OSDN Git Service

Camera3: Register all stream buffers at stream configuration time.
authorEino-Ville Talvala <etalvala@google.com>
Sat, 20 Apr 2013 00:26:13 +0000 (17:26 -0700)
committerEino-Ville Talvala <etalvala@google.com>
Sat, 20 Apr 2013 00:27:45 +0000 (17:27 -0700)
While registering them later would be nice for startup time, current
hardware will have to reinitialize everything, resulting in glitches.

Bug: 8657740
Change-Id: I1ed1f0a65d648f219f5228c8df15ffcf2a4b272e

services/camera/libcameraservice/Camera3Device.cpp

index d67b535..1433108 100644 (file)
@@ -907,6 +907,28 @@ status_t Camera3Device::configureStreamsLocked() {
         return res;
     }
 
+    // Finish all stream configuration immediately.
+    // TODO: Try to relax this later back to lazy completion, which should be
+    // faster
+
+    if (mInputStream != NULL) {
+        res = mInputStream->finishConfiguration(mHal3Device);
+        if (res != OK) {
+            SET_ERR_L("Can't finish configuring input stream %d: %s (%d)",
+                    mInputStream->getId(), strerror(-res), res);
+            return res;
+        }
+    }
+
+    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;
+        }
+    }
+
     // Request thread needs to know to avoid using repeat-last-settings protocol
     // across configure_streams() calls
     mRequestThread->configurationComplete();