From ff1584d4d348819a95d43a320bb1616458055e46 Mon Sep 17 00:00:00 2001 From: Matthew Date: Sat, 27 Jul 2024 15:16:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E9=94=81=E5=AE=9A=E5=AF=B9?= =?UTF-8?q?=E7=84=A6=E4=B8=80=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/cpp/camera2/ndkcamera.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/src/main/cpp/camera2/ndkcamera.cpp b/app/src/main/cpp/camera2/ndkcamera.cpp index 837b5c73..a25b9fb1 100644 --- a/app/src/main/cpp/camera2/ndkcamera.cpp +++ b/app/src/main/cpp/camera2/ndkcamera.cpp @@ -1272,9 +1272,15 @@ void NdkCamera::onCaptureCompleted(ACameraCaptureSession* session, ACaptureReque { if (mResult.afState == ACAMERA_CONTROL_AF_STATE_PASSIVE_FOCUSED) { - uint8_t trig = ACAMERA_CONTROL_AF_TRIGGER_START; - status = ACaptureRequest_setEntry_u8(capture_request, ACAMERA_CONTROL_AF_TRIGGER, 1, &trig); - XYLOG(XYLOG_SEVERITY_DEBUG, "Trigger AF AFS=%u", (uint32_t)mResult.afState); + // Will lock it + if (mResult.afLockSetted == 0) + { + uint8_t trig = ACAMERA_CONTROL_AF_TRIGGER_START; + status = ACaptureRequest_setEntry_u8(capture_request, ACAMERA_CONTROL_AF_TRIGGER, 1, &trig); + + mResult.afLockSetted = 1; + XYLOG(XYLOG_SEVERITY_DEBUG, "Trigger AF AFS=%u", (uint32_t)mResult.afState); + } } }