From 6255fa932cfebbcf844696d8c5e9dbc73755b5c8 Mon Sep 17 00:00:00 2001 From: Matthew Date: Sun, 8 Jun 2025 17:41:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9C=80=E5=B0=8Ffps?= =?UTF-8?q?=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/cpp/PhoneDevice.cpp | 1 + app/src/main/cpp/camera2/ndkcamera.cpp | 12 +++++++++++- app/src/main/cpp/camera2/ndkcamera.h | 3 ++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/src/main/cpp/PhoneDevice.cpp b/app/src/main/cpp/PhoneDevice.cpp index 784f09f0..7b144514 100644 --- a/app/src/main/cpp/PhoneDevice.cpp +++ b/app/src/main/cpp/PhoneDevice.cpp @@ -2051,6 +2051,7 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector< params.wait3ALocked = mPhotoInfo.wait3ALocked; params.customHdr = mPhotoInfo.customHdr; params.hdrStep = mPhotoInfo.hdrStep; + params.minFps = mPhotoInfo.minFps; params.burstRawCapture = mPhotoInfo.usingRawFormat; params.burstCaptures = mPhotoInfo.burstCaptures; if (params.requestTemplate <= 0 || params.requestTemplate > 5) diff --git a/app/src/main/cpp/camera2/ndkcamera.cpp b/app/src/main/cpp/camera2/ndkcamera.cpp index d2000f5c..de180994 100644 --- a/app/src/main/cpp/camera2/ndkcamera.cpp +++ b/app/src/main/cpp/camera2/ndkcamera.cpp @@ -903,7 +903,17 @@ NdkCamera::CaptureRequest* NdkCamera::CreateRequest(bool isPreviewRequest, int32 status = ACaptureRequest_setEntry_u8(request->request, ACAMERA_CONTROL_AE_MODE, 1, &aeMode); // ACaptureRequest_setEntry_i32(capture_request, ACAMERA_SENSOR_SENSITIVITY, 1, &sensitivity_); - if ((aeCompensationRange.min_ != 0 || aeCompensationRange.max_ != 0) && m_params.compensation != 0) + if (m_params.minFps != 0) + { + int32_t fpsRange[2] = {m_params.minFps, 10}; + status = ACaptureRequest_setEntry_i32(request->request, ACAMERA_CONTROL_AE_TARGET_FPS_RANGE, 2, fpsRange); + if (status != ACAMERA_OK) + { + ALOGE("Failed to set ACAMERA_CONTROL_AE_TARGET_FPS_RANGE: %d", status); + } + } + + if ((aeCompensationRange.min_ != 0 || aeCompensationRange.max_ != 0) && m_params.compensation != 0) { int32_t compensation = m_params.compensation; if (compensation < aeCompensationRange.min_) diff --git a/app/src/main/cpp/camera2/ndkcamera.h b/app/src/main/cpp/camera2/ndkcamera.h index ebaea678..6f3fc2fc 100644 --- a/app/src/main/cpp/camera2/ndkcamera.h +++ b/app/src/main/cpp/camera2/ndkcamera.h @@ -88,7 +88,8 @@ public: unsigned int burstRawCapture : 3; unsigned int customHdr : 1; unsigned int hdrStep : 3; - unsigned int reserved : 11; + unsigned int minFps : 4; + unsigned int reserved : 7; int64_t exposureTime; unsigned int sensitivity; int compensation;