OSDN Git Service

Camera2: Unconditionally shut down streams on disconnect.
authorEino-Ville Talvala <etalvala@google.com>
Fri, 5 Oct 2012 00:01:25 +0000 (17:01 -0700)
committerAndroid (Google) Code Review <android-gerrit@google.com>
Fri, 5 Oct 2012 23:14:48 +0000 (16:14 -0700)
stopPreviewL may do nothing in certain states. Stop streams directly
to avoid those failures, so that we always maintain the HAL interface
invariant that streams referenced by in-flight requests are never
deleted.

Bug: 7276954
Change-Id: Ic4cffc43036f4944684d941981a43d6dd1dce7af

services/camera/libcameraservice/Camera2Client.cpp

index 90cba46..3239483 100644 (file)
@@ -378,7 +378,16 @@ void Camera2Client::disconnect() {
 
     ALOGV("Camera %d: Shutting down", mCameraId);
 
-    stopPreviewL();
+    res = mStreamingProcessor->stopStream();
+    if (res != OK) {
+        ALOGE("%s: Problem stopping streaming: %s (%d)",
+                __FUNCTION__, strerror(-res), res);
+    }
+    res = mDevice->waitUntilDrained();
+    if (res != OK) {
+        ALOGE("%s: Problem waiting for HAL: %s (%d)",
+                __FUNCTION__, strerror(-res), res);
+    }
 
     {
         SharedParameters::Lock l(mParameters);