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 20bfaf9eb8c3841585cb5572cc56e85838037098..6ffae69adfd4888cfb95078e9fb4a0f6acb56218 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 > MAX_SUPPORT_PHOTO_WIDTH || height > 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; diff --git a/services/cameraservice/cameraoperator/handler/src/dcamera_handler.cpp b/services/cameraservice/cameraoperator/handler/src/dcamera_handler.cpp index c9c29b774a79f2f3fb0c233231d0279c888fa208..eb752783da5fd0ec107f3f20fc4d4e36828d401c 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: { - ret = (size.width >= RESOLUTION_MIN_WIDTH) && - (size.height >= RESOLUTION_MIN_HEIGHT) && - (size.width <= RESOLUTION_MAX_WIDTH_SNAPSHOT) && - (size.height <= RESOLUTION_MAX_HEIGHT_SNAPSHOT); + uint64_t dcResolution = static_cast(size.width * size.width); + uint64_t dcMaxResolution = static_cast(RESOLUTION_MAX_WIDTH_SNAPSHOT * + RESOLUTION_MAX_HEIGHT_SNAPSHOT); + uint64_t dcMinResolution = static_cast(RESOLUTION_MIN_WIDTH * + RESOLUTION_MIN_HEIGHT); + ret = (dcResolution >= dcMinResolution) && (dcResolution <= dcMaxResolution); break; } default: {