From a002fb4df44e7bea22c193095aec6516411f65d6 Mon Sep 17 00:00:00 2001 From: Zhijun He Date: Wed, 17 Jun 2015 09:21:10 -0700 Subject: Camera2: fix high speed request builder creation issue The metadata local copy was mutated (swapped) to an empty copy after use, we need make a copy every time. Bug: 21442271 Change-Id: I8a71663ba964288bdd1d7f50b42db762d28d89c0 --- core/java/android/hardware/camera2/impl/CameraDeviceImpl.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'core') diff --git a/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java b/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java index a1ebe6a..20ce7a0 100644 --- a/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java +++ b/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java @@ -2049,6 +2049,8 @@ public class CameraDeviceImpl extends CameraDevice { // Prepare the Request builders: need carry over the request controls. // First, create a request builder that will only include preview or recording target. CameraMetadataNative requestMetadata = new CameraMetadataNative(request.getNativeCopy()); + // Note that after this step, the requestMetadata is mutated (swapped) and can not be used + // for next request builder creation. CaptureRequest.Builder singleTargetRequestBuilder = new CaptureRequest.Builder( requestMetadata, /*reprocess*/false, CameraCaptureSession.SESSION_ID_NONE); @@ -2069,6 +2071,9 @@ public class CameraDeviceImpl extends CameraDevice { // Second, Create a request builder that will include both preview and recording targets. CaptureRequest.Builder doubleTargetRequestBuilder = null; if (outputSurfaces.size() == 2) { + // Have to create a new copy, the original one was mutated after a new + // CaptureRequest.Builder creation. + requestMetadata = new CameraMetadataNative(request.getNativeCopy()); doubleTargetRequestBuilder = new CaptureRequest.Builder( requestMetadata, /*reprocess*/false, CameraCaptureSession.SESSION_ID_NONE); doubleTargetRequestBuilder.set(CaptureRequest.CONTROL_CAPTURE_INTENT, -- cgit v1.1