已合并
fix replace device #4755
fix replace device #4755
已合并
junoo创建于 7月24日
3 个文件变更+7-2
@@ -2738,6 +2738,7 @@ int CameraManager::CreateCameraInput(sptr<CameraDevice> &camera, sptr<CameraInpu
2738 (isFoldV4 && curFoldStatus == FoldStatus::UNKNOWN_FOLD);2738 (isFoldV4 && curFoldStatus == FoldStatus::UNKNOWN_FOLD);
2739 bool isFrontCamera = (camera->GetPosition() == CameraPosition::CAMERA_POSITION_FRONT);2739 bool isFrontCamera = (camera->GetPosition() == CameraPosition::CAMERA_POSITION_FRONT);
2740 std::string originCameraId = camera->GetID();2740 std::string originCameraId = camera->GetID();
2741+ isDeviceReplaced_ = false;
2741 // LCOV_EXCL_START2742 // LCOV_EXCL_START
2742 if (isApiCompatRequired && isFoldStatusValid && isFrontCamera) {2743 if (isApiCompatRequired && isFoldStatusValid && isFrontCamera) {
2743 std::vector<sptr<CameraDevice>> cameraObjList = GetCameraDevices(); //全量2744 std::vector<sptr<CameraDevice>> cameraObjList = GetCameraDevices(); //全量
@@ -2747,6 +2748,7 @@ int CameraManager::CreateCameraInput(sptr<CameraDevice> &camera, sptr<CameraInpu
2747 cameraDevice != nullptr && cameraDevice->GetPosition() == CameraPosition::CAMERA_POSITION_FOLD_INNER;2748 cameraDevice != nullptr && cameraDevice->GetPosition() == CameraPosition::CAMERA_POSITION_FOLD_INNER;
2748 if (isFindDevice) {2749 if (isFindDevice) {
2749 camera = cameraDevice;2750 camera = cameraDevice;
2751+ isDeviceReplaced_ = true;
2750 break;2752 break;
2751 }2753 }
2752 }2754 }
@@ -5629,14 +5629,16 @@ bool CaptureSession::ValidateOutputProfile(Profile& outputProfile, CaptureOutput
5629 ":%{public}d", outputProfile.size_.width, outputProfile.size_.height, outputProfile.format_, outputType);5629 ":%{public}d", outputProfile.size_.width, outputProfile.size_.height, outputProfile.format_, outputType);
5630 auto inputDevice = GetInputDevice();5630 auto inputDevice = GetInputDevice();
5631 CHECK_RETURN_RET_ELOG(!inputDevice, false, "CaptureSession::ValidateOutputProfile Failed inputDevice is nullptr");5631 CHECK_RETURN_RET_ELOG(!inputDevice, false, "CaptureSession::ValidateOutputProfile Failed inputDevice is nullptr");
5632- auto inputDeviceInfo = inputDevice->GetCameraDeviceInfo();5632+ sptr<CameraDevice> inputDeviceInfo = inputDevice->GetCameraDeviceInfo();
5633+ auto modeName = GetMode();
5634+ CHECK_EXECUTE(CameraManager::GetInstance()->isDeviceReplaced_,
5635+ CameraManager::GetInstance()->GetSupportedFullOutputCapability(inputDeviceInfo, modeName));
5633 CHECK_RETURN_RET_ELOG(5636 CHECK_RETURN_RET_ELOG(
5634 !inputDeviceInfo, false, "CaptureSession::ValidateOutputProfile Failed inputDeviceInfo is nullptr");5637 !inputDeviceInfo, false, "CaptureSession::ValidateOutputProfile Failed inputDeviceInfo is nullptr");
5635 CHECK_RETURN_RET_ILOG(5638 CHECK_RETURN_RET_ILOG(
5636 outputType == CAPTURE_OUTPUT_TYPE_METADATA, true, "CaptureSession::ValidateOutputProfile MetadataOutput");5639 outputType == CAPTURE_OUTPUT_TYPE_METADATA, true, "CaptureSession::ValidateOutputProfile MetadataOutput");
5637 CHECK_RETURN_RET_ILOG(5640 CHECK_RETURN_RET_ILOG(
5638 outputType == CAPTURE_OUTPUT_TYPE_DEPTH_DATA, true, "CaptureSession::ValidateOutputProfile DepthDataOutput");5641 outputType == CAPTURE_OUTPUT_TYPE_DEPTH_DATA, true, "CaptureSession::ValidateOutputProfile DepthDataOutput");
5639- auto modeName = GetMode();
5640 auto validateOutputProfileFunc = [modeName](auto validateProfile, auto& profiles) -> bool {5642 auto validateOutputProfileFunc = [modeName](auto validateProfile, auto& profiles) -> bool {
5641 MEDIA_INFO_LOG("CaptureSession::ValidateOutputProfile in mode(%{public}d): "5643 MEDIA_INFO_LOG("CaptureSession::ValidateOutputProfile in mode(%{public}d): "
5642 "w(%{public}d),h(%{public}d),f(%{public}d), profiles size is:%{public}zu",5644 "w(%{public}d),h(%{public}d),f(%{public}d), profiles size is:%{public}zu",
@@ -1133,6 +1133,7 @@ public:
1133 std::vector<sptr<CameraDevice>> GetCameraDevices();1133 std::vector<sptr<CameraDevice>> GetCameraDevices();
1134 bool ShouldClearCache();1134 bool ShouldClearCache();
1135 void GetCameraIdByDisPlugin(sptr<CameraDevice> &camera);1135 void GetCameraIdByDisPlugin(sptr<CameraDevice> &camera);
1136+ bool isDeviceReplaced_ = false;
1136protected:1137protected:
1137 // Only for UT1138 // Only for UT
1138 explicit CameraManager(sptr<ICameraService> serviceProxy) : serviceProxyPrivate_(serviceProxy)1139 explicit CameraManager(sptr<ICameraService> serviceProxy) : serviceProxyPrivate_(serviceProxy)