From f6e09d200c3e043737adcdadd52310ebbd1b19da Mon Sep 17 00:00:00 2001 From: Eino-Ville Talvala Date: Thu, 4 Oct 2012 17:01:25 -0700 Subject: [PATCH] Camera2: Unconditionally shut down streams on disconnect. 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 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/services/camera/libcameraservice/Camera2Client.cpp b/services/camera/libcameraservice/Camera2Client.cpp index 90cba46f34..323948379a 100644 --- a/services/camera/libcameraservice/Camera2Client.cpp +++ b/services/camera/libcameraservice/Camera2Client.cpp @@ -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); -- 2.11.0