From 4929ad64dcb4092dc617c01a11d4b34fa9975a39 Mon Sep 17 00:00:00 2001 From: wangchaole Date: Tue, 29 Mar 2022 11:24:58 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9B=B8=E6=9C=BA?= =?UTF-8?q?=E5=88=86=E8=BE=A8=E7=8E=87=E8=BF=87=E6=BB=A4=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- .../src/dcamera_device/dmetadata_processor.cpp | 2 +- .../handler/src/dcamera_handler.cpp | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/camera_hdf/hdi_impl/src/dcamera_device/dmetadata_processor.cpp b/camera_hdf/hdi_impl/src/dcamera_device/dmetadata_processor.cpp index 20bfaf9e..54b2e564 100644 --- a/camera_hdf/hdi_impl/src/dcamera_device/dmetadata_processor.cpp +++ b/camera_hdf/hdi_impl/src/dcamera_device/dmetadata_processor.cpp @@ -534,7 +534,7 @@ std::map> DMetadataProcessor::GetDCameraSupported if (height == 0 || width == 0 || (isPhotoFormat && (width > MAX_SUPPORT_PHOTO_WIDTH || height > MAX_SUPPORT_PHOTO_HEIGHT)) || (!isPhotoFormat && - (width > MAX_SUPPORT_PREVIEW_WIDTH || height > MAX_SUPPORT_PREVIEW_HEIGHT))) { + ((width * height) > (MAX_SUPPORT_PREVIEW_WIDTH * MAX_SUPPORT_PREVIEW_HEIGHT))) { continue; } DCResolution resolution(width, height); diff --git a/services/cameraservice/cameraoperator/handler/src/dcamera_handler.cpp b/services/cameraservice/cameraoperator/handler/src/dcamera_handler.cpp index c9c29b77..f125a5a0 100644 --- a/services/cameraservice/cameraoperator/handler/src/dcamera_handler.cpp +++ b/services/cameraservice/cameraoperator/handler/src/dcamera_handler.cpp @@ -62,8 +62,10 @@ std::vector DCameraHandler::Query() DHLOGI("DCameraHandler::Query connection type: %d", info->GetConnectionType()); continue; } - if ((info->GetPosition() == OHOS_CAMERA_POSITION_FRONT) || - (info->GetPosition() == OHOS_CAMERA_POSITION_BACK && info->GetCameraType() == OHOS_CAMERA_TYPE_LOGICAL)) { + if ((info->GetPosition() == OHOS_CAMERA_POSITION_OTHER) || + (info->GetPosition() == OHOS_CAMERA_POSITION_FRONT) || + (info->GetPosition() == OHOS_CAMERA_POSITION_BACK && + info->GetCameraType() == OHOS_CAMERA_TYPE_LOGICAL)) { DHItem item = CreateDHItem(info); itemList.push_back(item); } @@ -108,8 +110,10 @@ std::vector DCameraHandler::GetCameras() DHLOGI("DCameraHandler::GetCameras connection type: %d", info->GetConnectionType()); continue; } - if ((info->GetPosition() == OHOS_CAMERA_POSITION_FRONT) || - (info->GetPosition() == OHOS_CAMERA_POSITION_BACK && info->GetCameraType() == OHOS_CAMERA_TYPE_LOGICAL)) { + if ((info->GetPosition() == OHOS_CAMERA_POSITION_OTHER) || + (info->GetPosition() == OHOS_CAMERA_POSITION_FRONT) || + (info->GetPosition() == OHOS_CAMERA_POSITION_BACK && + info->GetCameraType() == OHOS_CAMERA_TYPE_LOGICAL)) { std::string dhId = CAMERA_ID_PREFIX + info->GetID(); cameras.push_back(dhId); } @@ -233,10 +237,12 @@ bool DCameraHandler::IsValid(DCStreamType type, CameraStandard::CameraPicSize& s break; } case SNAPSHOT_FRAME: { + uint64_t dcResolution = static_cast(size.width * size.width); + uint64_t dcMaxResolution = static_cast(RESOLUTION_MAX_WIDTH_SNAPSHOT * + RESOLUTION_MAX_HEIGHT_SNAPSHOT); ret = (size.width >= RESOLUTION_MIN_WIDTH) && (size.height >= RESOLUTION_MIN_HEIGHT) && - (size.width <= RESOLUTION_MAX_WIDTH_SNAPSHOT) && - (size.height <= RESOLUTION_MAX_HEIGHT_SNAPSHOT); + (dcResolution <= dcMaxResolution); break; } default: { -- Gitee From e59129745304d576bb9c9eb96feebcca53f16f3d Mon Sep 17 00:00:00 2001 From: wangchaole Date: Tue, 29 Mar 2022 12:10:41 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9B=B8=E6=9C=BA?= =?UTF-8?q?=E5=88=86=E8=BE=A8=E7=8E=87=E8=BF=87=E6=BB=A4=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- .../hdi_impl/src/dcamera_device/dmetadata_processor.cpp | 4 ++-- .../cameraoperator/handler/src/dcamera_handler.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/camera_hdf/hdi_impl/src/dcamera_device/dmetadata_processor.cpp b/camera_hdf/hdi_impl/src/dcamera_device/dmetadata_processor.cpp index 54b2e564..63796dc2 100644 --- a/camera_hdf/hdi_impl/src/dcamera_device/dmetadata_processor.cpp +++ b/camera_hdf/hdi_impl/src/dcamera_device/dmetadata_processor.cpp @@ -532,9 +532,9 @@ std::map> DMetadataProcessor::GetDCameraSupported uint32_t width = static_cast(std::stoi(reso[0])); uint32_t height = static_cast(std::stoi(reso[1])); if (height == 0 || width == 0 || - (isPhotoFormat && (width > MAX_SUPPORT_PHOTO_WIDTH || height > MAX_SUPPORT_PHOTO_HEIGHT)) || + (isPhotoFormat && (width * height) > (MAX_SUPPORT_PREVIEW_WIDTH * MAX_SUPPORT_PREVIEW_HEIGHT))) || (!isPhotoFormat && - ((width * height) > (MAX_SUPPORT_PREVIEW_WIDTH * MAX_SUPPORT_PREVIEW_HEIGHT))) { + (width > MAX_SUPPORT_PREVIEW_WIDTH || height > MAX_SUPPORT_PREVIEW_HEIGHT))) { continue; } DCResolution resolution(width, height); diff --git a/services/cameraservice/cameraoperator/handler/src/dcamera_handler.cpp b/services/cameraservice/cameraoperator/handler/src/dcamera_handler.cpp index f125a5a0..eb752783 100644 --- a/services/cameraservice/cameraoperator/handler/src/dcamera_handler.cpp +++ b/services/cameraservice/cameraoperator/handler/src/dcamera_handler.cpp @@ -240,9 +240,9 @@ bool DCameraHandler::IsValid(DCStreamType type, CameraStandard::CameraPicSize& s uint64_t dcResolution = static_cast(size.width * size.width); uint64_t dcMaxResolution = static_cast(RESOLUTION_MAX_WIDTH_SNAPSHOT * RESOLUTION_MAX_HEIGHT_SNAPSHOT); - ret = (size.width >= RESOLUTION_MIN_WIDTH) && - (size.height >= RESOLUTION_MIN_HEIGHT) && - (dcResolution <= dcMaxResolution); + uint64_t dcMinResolution = static_cast(RESOLUTION_MIN_WIDTH * + RESOLUTION_MIN_HEIGHT); + ret = (dcResolution >= dcMinResolution) && (dcResolution <= dcMaxResolution); break; } default: { -- Gitee From af09c352239dee44948f13a7fb52d8ef963ee963 Mon Sep 17 00:00:00 2001 From: wangchaole Date: Tue, 29 Mar 2022 12:13:13 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9B=B8=E6=9C=BA?= =?UTF-8?q?=E5=88=86=E8=BE=A8=E7=8E=87=E8=BF=87=E6=BB=A4=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- camera_hdf/hdi_impl/src/dcamera_device/dmetadata_processor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/camera_hdf/hdi_impl/src/dcamera_device/dmetadata_processor.cpp b/camera_hdf/hdi_impl/src/dcamera_device/dmetadata_processor.cpp index 63796dc2..adb37342 100644 --- a/camera_hdf/hdi_impl/src/dcamera_device/dmetadata_processor.cpp +++ b/camera_hdf/hdi_impl/src/dcamera_device/dmetadata_processor.cpp @@ -532,7 +532,7 @@ std::map> DMetadataProcessor::GetDCameraSupported uint32_t width = static_cast(std::stoi(reso[0])); uint32_t height = static_cast(std::stoi(reso[1])); if (height == 0 || width == 0 || - (isPhotoFormat && (width * height) > (MAX_SUPPORT_PREVIEW_WIDTH * MAX_SUPPORT_PREVIEW_HEIGHT))) || + (isPhotoFormat && (width * height) > (MAX_SUPPORT_PHOTO_WIDTH * MAX_SUPPORT_PHOTO_HEIGHT))) || (!isPhotoFormat && (width > MAX_SUPPORT_PREVIEW_WIDTH || height > MAX_SUPPORT_PREVIEW_HEIGHT))) { continue; -- Gitee From 3d2851c65de5bb38e8657d3efa2913eb66079140 Mon Sep 17 00:00:00 2001 From: wangchaole Date: Tue, 29 Mar 2022 15:38:31 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9B=B8=E6=9C=BA?= =?UTF-8?q?=E5=88=86=E8=BE=A8=E7=8E=87=E8=BF=87=E6=BB=A4=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- camera_hdf/hdi_impl/src/dcamera_device/dmetadata_processor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/camera_hdf/hdi_impl/src/dcamera_device/dmetadata_processor.cpp b/camera_hdf/hdi_impl/src/dcamera_device/dmetadata_processor.cpp index adb37342..6ffae69a 100644 --- a/camera_hdf/hdi_impl/src/dcamera_device/dmetadata_processor.cpp +++ b/camera_hdf/hdi_impl/src/dcamera_device/dmetadata_processor.cpp @@ -532,7 +532,7 @@ std::map> DMetadataProcessor::GetDCameraSupported uint32_t width = static_cast(std::stoi(reso[0])); uint32_t height = static_cast(std::stoi(reso[1])); if (height == 0 || width == 0 || - (isPhotoFormat && (width * height) > (MAX_SUPPORT_PHOTO_WIDTH * MAX_SUPPORT_PHOTO_HEIGHT))) || + (isPhotoFormat && ((width * height) > (MAX_SUPPORT_PHOTO_WIDTH * MAX_SUPPORT_PHOTO_HEIGHT))) || (!isPhotoFormat && (width > MAX_SUPPORT_PREVIEW_WIDTH || height > MAX_SUPPORT_PREVIEW_HEIGHT))) { continue; -- Gitee