mirror of
https://github.com/openharmony/multimedia_camera_standard.git
synced 2026-06-30 20:48:03 -04:00
refactor for camera frameworks and services
Signed-off-by: cold_yixiu <lengye@huawei.com>
This commit is contained in:
+15
-8
@@ -33,14 +33,21 @@
|
||||
]
|
||||
},
|
||||
"build": {
|
||||
"sub_component": [
|
||||
"//foundation/multimedia/camera_framework/sa_profile:camera_service_sa_profile",
|
||||
"//foundation/multimedia/camera_framework/services/etc:camera_service.rc",
|
||||
"//foundation/multimedia/camera_framework/services/camera_service:camera_service",
|
||||
"//foundation/multimedia/camera_framework/frameworks/native/camera:camera_framework",
|
||||
"//foundation/multimedia/camera_framework/interfaces/kits/js/camera_napi:camera_napi",
|
||||
"//foundation/multimedia/camera_framework/interfaces/kits/js/camera_napi:camera_js"
|
||||
],
|
||||
"group_type": {
|
||||
"base_group": [
|
||||
],
|
||||
"fwk_group": [
|
||||
"//foundation/multimedia/camera_framework/frameworks/native/camera:camera_framework",
|
||||
"//foundation/multimedia/camera_framework/interfaces/kits/js/camera_napi:camera_napi",
|
||||
"//foundation/multimedia/camera_framework/interfaces/kits/js/camera_napi:camera_js"
|
||||
],
|
||||
"service_group": [
|
||||
"//foundation/multimedia/camera_framework/sa_profile:camera_service_sa_profile",
|
||||
"//foundation/multimedia/camera_framework/services/etc:camera_service.rc",
|
||||
"//foundation/multimedia/camera_framework/services/camera_service:camera_service"
|
||||
]
|
||||
},
|
||||
|
||||
"inner_kits": [
|
||||
{
|
||||
"type": "none",
|
||||
|
||||
@@ -50,6 +50,12 @@ ohos_shared_library("camera_framework") {
|
||||
"//foundation/multimedia/camera_framework/services/camera_service/binder/client/src/hstream_capture_proxy.cpp",
|
||||
"//foundation/multimedia/camera_framework/services/camera_service/binder/client/src/hstream_metadata_proxy.cpp",
|
||||
"//foundation/multimedia/camera_framework/services/camera_service/binder/client/src/hstream_repeat_proxy.cpp",
|
||||
"//foundation/multimedia/camera_framework/services/camera_service/binder/server/src/hcamera_device_callback_stub.cpp",
|
||||
"//foundation/multimedia/camera_framework/services/camera_service/binder/server/src/hcamera_listener_stub.cpp",
|
||||
"//foundation/multimedia/camera_framework/services/camera_service/binder/server/src/hcamera_service_callback_stub.cpp",
|
||||
"//foundation/multimedia/camera_framework/services/camera_service/binder/server/src/hcapture_session_callback_stub.cpp",
|
||||
"//foundation/multimedia/camera_framework/services/camera_service/binder/server/src/hstream_capture_callback_stub.cpp",
|
||||
"//foundation/multimedia/camera_framework/services/camera_service/binder/server/src/hstream_repeat_callback_stub.cpp",
|
||||
"src/input/camera_info.cpp",
|
||||
"src/input/camera_input.cpp",
|
||||
"src/input/camera_manager.cpp",
|
||||
@@ -85,13 +91,9 @@ ohos_shared_library("camera_framework") {
|
||||
"//drivers/interface/camera/v1_0:libcamera_proxy_1.0",
|
||||
"//drivers/peripheral/camera/interfaces/metadata:metadata",
|
||||
"//foundation/graphic/graphic_2d:libsurface",
|
||||
"//foundation/multimedia/camera_framework/services/camera_service:camera_service",
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
"ability_base:want",
|
||||
"bundle_framework:appexecfwk_base",
|
||||
"bundle_framework:appexecfwk_core",
|
||||
"hisysevent_native:libhisysevent",
|
||||
"hitrace_native:hitrace_meter",
|
||||
"hiviewdfx_hilog_native:libhilog",
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "camera_device_ability_items.h"
|
||||
#include "camera_util.h"
|
||||
#include "hcamera_device_callback_stub.h"
|
||||
#include "ipc_skeleton.h"
|
||||
#include "camera_log.h"
|
||||
#include "metadata_utils.h"
|
||||
|
||||
@@ -51,8 +50,6 @@ public:
|
||||
MEDIA_ERR_LOG("CameraDeviceServiceCallback::OnError() is called!, errorType: %{public}d, errorMsg: %{public}d",
|
||||
errorType, errorMsg);
|
||||
if (camInput_ != nullptr && camInput_->GetErrorCallback() != nullptr) {
|
||||
CAMERA_SYSEVENT_FAULT(CreateMsg("CameraDeviceServiceCallback::OnError() is called!, errorType: %d,"
|
||||
"errorMsg: %d", errorType, errorMsg));
|
||||
camInput_->GetErrorCallback()->OnError(errorType, errorMsg);
|
||||
} else {
|
||||
MEDIA_INFO_LOG("CameraDeviceServiceCallback::ErrorCallback not set!, Discarding callback");
|
||||
@@ -64,23 +61,6 @@ public:
|
||||
{
|
||||
MEDIA_INFO_LOG("CameraDeviceServiceCallback::OnResult() is called!, cameraId: %{public}s, timestamp: %{public}"
|
||||
PRIu64, camInput_->GetCameraDeviceInfo()->GetID().c_str(), timestamp);
|
||||
camera_metadata_item_t item;
|
||||
int ret = Camera::FindCameraMetadataItem(result->get(), OHOS_CONTROL_FLASH_STATE, &item);
|
||||
if (ret == 0) {
|
||||
MEDIA_INFO_LOG("CameraDeviceServiceCallback::OnResult() OHOS_CONTROL_FLASH_STATE is %{public}d",
|
||||
item.data.u8[0]);
|
||||
CAMERA_SYSEVENT_BEHAVIOR(CreateMsg("FlashStateChanged! current OHOS_CONTROL_FLASH_STATE is %d",
|
||||
item.data.u8[0]));
|
||||
POWERMGR_SYSEVENT_TORCH_STATE(IPCSkeleton::GetCallingPid(),
|
||||
IPCSkeleton::GetCallingUid(), item.data.u8[0]);
|
||||
}
|
||||
ret = Camera::FindCameraMetadataItem(result->get(), OHOS_CONTROL_FLASH_MODE, &item);
|
||||
if (ret == 0) {
|
||||
MEDIA_INFO_LOG("CameraDeviceServiceCallback::OnResult() OHOS_CONTROL_FLASH_MODE is %{public}d",
|
||||
item.data.u8[0]);
|
||||
CAMERA_SYSEVENT_BEHAVIOR(CreateMsg("FlashModeChanged! current OHOS_CONTROL_FLASH_MODE is %d",
|
||||
item.data.u8[0]));
|
||||
}
|
||||
|
||||
camInput_->ProcessAutoExposureUpdates(result);
|
||||
camInput_->ProcessAutoFocusUpdates(result);
|
||||
@@ -822,12 +802,6 @@ void CameraInput::SetFlashMode(camera_flash_mode_enum_t flashMode)
|
||||
MEDIA_ERR_LOG("CameraInput::SetFlashMode Failed to set flash mode");
|
||||
return;
|
||||
}
|
||||
|
||||
if (flashMode == OHOS_CAMERA_FLASH_MODE_CLOSE) {
|
||||
POWERMGR_SYSEVENT_FLASH_OFF();
|
||||
} else {
|
||||
POWERMGR_SYSEVENT_FLASH_ON();
|
||||
}
|
||||
}
|
||||
|
||||
void CameraInput::SetErrorCallback(std::shared_ptr<ErrorCallback> errorCallback)
|
||||
@@ -856,14 +830,10 @@ void CameraInput::ProcessAutoFocusUpdates(const std::shared_ptr<Camera::CameraMe
|
||||
int ret = Camera::FindCameraMetadataItem(metadata, OHOS_CONTROL_FOCUS_MODE, &item);
|
||||
if (ret == CAM_META_SUCCESS) {
|
||||
MEDIA_DEBUG_LOG("Focus mode: %{public}d", item.data.u8[0]);
|
||||
CAMERA_SYSEVENT_BEHAVIOR(CreateMsg("FocusModeChanged! current OHOS_CONTROL_FOCUS_MODE is %d",
|
||||
item.data.u8[0]));
|
||||
}
|
||||
ret = Camera::FindCameraMetadataItem(metadata, OHOS_CONTROL_FOCUS_STATE, &item);
|
||||
if (ret == CAM_META_SUCCESS) {
|
||||
MEDIA_INFO_LOG("Focus state: %{public}d", item.data.u8[0]);
|
||||
CAMERA_SYSEVENT_BEHAVIOR(CreateMsg("FocusStateChanged! current OHOS_CONTROL_FOCUS_STATE is %d",
|
||||
item.data.u8[0]));
|
||||
if (focusCallback_ != nullptr) {
|
||||
camera_focus_state_t focusState = static_cast<camera_focus_state_t>(item.data.u8[0]);
|
||||
auto itr = mapFromMetadataFocus_.find(focusState);
|
||||
|
||||
@@ -70,9 +70,6 @@ public:
|
||||
CameraDeviceStatus deviceStatus;
|
||||
CameraStatusInfo cameraStatusInfo;
|
||||
|
||||
CAMERA_SYSEVENT_BEHAVIOR(CreateMsg("OnCameraStatusChanged! for cameraId:%s, current Camera Status:%d",
|
||||
cameraId.c_str(), status));
|
||||
|
||||
if (camMngr_ != nullptr && camMngr_->GetApplicationCallback() != nullptr) {
|
||||
switch (status) {
|
||||
case CAMERA_STATUS_UNAVAILABLE:
|
||||
@@ -103,12 +100,6 @@ public:
|
||||
int32_t OnFlashlightStatusChanged(const std::string& cameraId, const FlashStatus status) override
|
||||
{
|
||||
FlashlightStatus flashlightStatus;
|
||||
|
||||
CAMERA_SYSEVENT_BEHAVIOR(CreateMsg("OnFlashlightStatusChanged! for cameraId:%s, current Flash Status:%d",
|
||||
cameraId.c_str(), status));
|
||||
POWERMGR_SYSEVENT_TORCH_STATE(IPCSkeleton::GetCallingPid(),
|
||||
IPCSkeleton::GetCallingUid(), status);
|
||||
|
||||
MEDIA_INFO_LOG("OnFlashlightStatusChanged: cameraId: %{public}s, status: %{public}d", cameraId.c_str(), status);
|
||||
if (camMngr_ != nullptr && camMngr_->GetApplicationCallback() != nullptr) {
|
||||
switch (status) {
|
||||
@@ -176,9 +167,6 @@ sptr<PhotoOutput> CameraManager::CreatePhotoOutput(sptr<Surface> &surface)
|
||||
result = new(std::nothrow) PhotoOutput(streamCapture);
|
||||
if (result == nullptr) {
|
||||
MEDIA_ERR_LOG("Failed to new PhotoOutput ");
|
||||
} else {
|
||||
POWERMGR_SYSEVENT_CAMERA_CONFIG(PHOTO, surface->GetDefaultWidth(),
|
||||
surface->GetDefaultHeight());
|
||||
}
|
||||
} else {
|
||||
MEDIA_ERR_LOG("Failed to get stream capture object from hcamera service!, %{public}d", retCode);
|
||||
@@ -202,10 +190,6 @@ sptr<PhotoOutput> CameraManager::CreatePhotoOutput(const sptr<OHOS::IBufferProdu
|
||||
result = new(std::nothrow) PhotoOutput(streamCapture);
|
||||
if (result == nullptr) {
|
||||
MEDIA_ERR_LOG("Failed to new PhotoOutput");
|
||||
} else {
|
||||
POWERMGR_SYSEVENT_CAMERA_CONFIG(PHOTO,
|
||||
producer->GetDefaultWidth(),
|
||||
producer->GetDefaultHeight());
|
||||
}
|
||||
} else {
|
||||
MEDIA_ERR_LOG("Failed to get stream capture object from hcamera service!, %{public}d", retCode);
|
||||
@@ -230,10 +214,6 @@ sptr<PreviewOutput> CameraManager::CreatePreviewOutput(sptr<Surface> surface)
|
||||
result = new(std::nothrow) PreviewOutput(streamRepeat);
|
||||
if (result == nullptr) {
|
||||
MEDIA_ERR_LOG("Failed to new PreviewOutput");
|
||||
} else {
|
||||
POWERMGR_SYSEVENT_CAMERA_CONFIG(PREVIEW,
|
||||
surface->GetDefaultWidth(),
|
||||
surface->GetDefaultHeight());
|
||||
}
|
||||
} else {
|
||||
MEDIA_ERR_LOG("PreviewOutput: Failed to get stream repeat object from hcamera service!, %{public}d", retCode);
|
||||
@@ -257,10 +237,6 @@ sptr<PreviewOutput> CameraManager::CreatePreviewOutput(const sptr<OHOS::IBufferP
|
||||
result = new(std::nothrow) PreviewOutput(streamRepeat);
|
||||
if (result == nullptr) {
|
||||
MEDIA_ERR_LOG("Failed to new PreviewOutput");
|
||||
} else {
|
||||
POWERMGR_SYSEVENT_CAMERA_CONFIG(PREVIEW,
|
||||
producer->GetDefaultWidth(),
|
||||
producer->GetDefaultHeight());
|
||||
}
|
||||
} else {
|
||||
MEDIA_ERR_LOG("PreviewOutput: Failed to get stream repeat object from hcamera service!, %{public}d", retCode);
|
||||
@@ -286,8 +262,6 @@ sptr<PreviewOutput> CameraManager::CreateCustomPreviewOutput(sptr<Surface> surfa
|
||||
result = new(std::nothrow) PreviewOutput(streamRepeat);
|
||||
if (result == nullptr) {
|
||||
MEDIA_ERR_LOG("Failed to new PreviewOutput");
|
||||
} else {
|
||||
POWERMGR_SYSEVENT_CAMERA_CONFIG(PREVIEW, width, height);
|
||||
}
|
||||
} else {
|
||||
MEDIA_ERR_LOG("PreviewOutput: Failed to get stream repeat object from hcamera service!, %{public}d", retCode);
|
||||
@@ -312,8 +286,6 @@ sptr<PreviewOutput> CameraManager::CreateCustomPreviewOutput(const sptr<OHOS::IB
|
||||
result = new(std::nothrow) PreviewOutput(streamRepeat);
|
||||
if (result == nullptr) {
|
||||
MEDIA_ERR_LOG("Failed to new PreviewOutput");
|
||||
} else {
|
||||
POWERMGR_SYSEVENT_CAMERA_CONFIG(PREVIEW, width, height);
|
||||
}
|
||||
} else {
|
||||
MEDIA_ERR_LOG("PreviewOutput: Failed to get stream repeat object from hcamera service!, %{public}d", retCode);
|
||||
@@ -365,7 +337,6 @@ sptr<MetadataOutput> CameraManager::CreateMetadataOutput()
|
||||
MEDIA_ERR_LOG("CameraManager::CreateMetadataOutput Surface consumer listener registration failed");
|
||||
return nullptr;
|
||||
}
|
||||
POWERMGR_SYSEVENT_CAMERA_CONFIG(METADATA, width, height);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -386,10 +357,6 @@ sptr<VideoOutput> CameraManager::CreateVideoOutput(sptr<Surface> &surface)
|
||||
result = new(std::nothrow) VideoOutput(streamRepeat);
|
||||
if (result == nullptr) {
|
||||
MEDIA_ERR_LOG("Failed to new VideoOutput");
|
||||
} else {
|
||||
POWERMGR_SYSEVENT_CAMERA_CONFIG(VIDEO,
|
||||
surface->GetDefaultWidth(),
|
||||
surface->GetDefaultHeight());
|
||||
}
|
||||
} else {
|
||||
MEDIA_ERR_LOG("VideoOutpout: Failed to get stream repeat object from hcamera service! %{public}d", retCode);
|
||||
@@ -413,10 +380,6 @@ sptr<VideoOutput> CameraManager::CreateVideoOutput(const sptr<OHOS::IBufferProdu
|
||||
result = new(std::nothrow) VideoOutput(streamRepeat);
|
||||
if (result == nullptr) {
|
||||
MEDIA_ERR_LOG("Failed to new VideoOutput");
|
||||
} else {
|
||||
POWERMGR_SYSEVENT_CAMERA_CONFIG(VIDEO,
|
||||
producer->GetDefaultWidth(),
|
||||
producer->GetDefaultHeight());
|
||||
}
|
||||
} else {
|
||||
MEDIA_ERR_LOG("VideoOutpout: Failed to get stream repeat object from hcamera service! %{public}d", retCode);
|
||||
@@ -560,10 +523,6 @@ std::vector<sptr<CameraInfo>> CameraManager::GetCameras()
|
||||
MEDIA_ERR_LOG("CameraManager::GetCameras new CameraInfo failed for id={public}%s", it.c_str());
|
||||
continue;
|
||||
}
|
||||
CAMERA_SYSEVENT_STATISTIC(CreateMsg("CameraManager GetCameras camera ID:%s, Camera position:%d,"
|
||||
" Camera Type:%d, Connection Type:%d, Mirror support:%d", it.c_str(),
|
||||
cameraObj->GetPosition(), cameraObj->GetCameraType(),
|
||||
cameraObj->GetConnectionType(), cameraObj->IsMirrorSupported()));
|
||||
cameraObjList.emplace_back(cameraObj);
|
||||
}
|
||||
} else {
|
||||
@@ -592,8 +551,6 @@ sptr<CameraInput> CameraManager::CreateCameraInput(sptr<CameraInfo> &camera)
|
||||
} else {
|
||||
MEDIA_ERR_LOG("CameraManager::CreateCameraInput: Camera object is null");
|
||||
}
|
||||
CAMERA_SYSEVENT_STATISTIC(CreateMsg("CameraManager_CreateCameraInput CameraId:%s", camera->GetID().c_str()));
|
||||
|
||||
return cameraInput;
|
||||
}
|
||||
|
||||
|
||||
@@ -206,8 +206,6 @@ public:
|
||||
int32_t OnCaptureError(const int32_t captureId, const int32_t errorCode) override
|
||||
{
|
||||
if (photoOutput_ != nullptr && photoOutput_->GetApplicationCallback() != nullptr) {
|
||||
CAMERA_SYSEVENT_FAULT(CreateMsg("Photo OnCaptureError! captureId:%d & "
|
||||
"errorCode:%{public}d", captureId, errorCode));
|
||||
photoOutput_->GetApplicationCallback()->OnCaptureError(captureId, errorCode);
|
||||
} else {
|
||||
MEDIA_INFO_LOG("Discarding HStreamCaptureCallbackImpl::OnCaptureError callback");
|
||||
|
||||
@@ -72,7 +72,6 @@ public:
|
||||
int32_t OnFrameError(int32_t errorCode) override
|
||||
{
|
||||
if (previewOutput_ != nullptr && previewOutput_->GetApplicationCallback() != nullptr) {
|
||||
CAMERA_SYSEVENT_FAULT(CreateMsg("Preview OnFrameError! errorCode:%d", errorCode));
|
||||
previewOutput_->GetApplicationCallback()->OnError(errorCode);
|
||||
} else {
|
||||
MEDIA_INFO_LOG("Discarding HStreamRepeatCallbackImpl::OnFrameError callback in preview");
|
||||
|
||||
@@ -65,7 +65,6 @@ public:
|
||||
int32_t OnFrameError(const int32_t errorCode) override
|
||||
{
|
||||
if (videoOutput_ != nullptr && videoOutput_->GetApplicationCallback() != nullptr) {
|
||||
CAMERA_SYSEVENT_FAULT(CreateMsg("Video OnFrameError! errorCode:%d", errorCode));
|
||||
videoOutput_->GetApplicationCallback()->OnError(errorCode);
|
||||
} else {
|
||||
MEDIA_INFO_LOG("Discarding HStreamRepeatCallbackImpl::OnFrameError callback in video");
|
||||
|
||||
@@ -17,17 +17,10 @@
|
||||
#include "camera_util.h"
|
||||
#include "hcapture_session_callback_stub.h"
|
||||
#include "input/camera_input.h"
|
||||
#include "ipc_skeleton.h"
|
||||
#include "camera_log.h"
|
||||
#include "output/photo_output.h"
|
||||
#include "output/preview_output.h"
|
||||
#include "output/video_output.h"
|
||||
#include "bundle_mgr_interface.h"
|
||||
#include "iservice_registry.h"
|
||||
#include "system_ability_definition.h"
|
||||
|
||||
using namespace OHOS::AppExecFwk;
|
||||
using namespace OHOS::AAFwk;
|
||||
|
||||
namespace OHOS {
|
||||
namespace CameraStandard {
|
||||
@@ -50,7 +43,6 @@ public:
|
||||
MEDIA_INFO_LOG("CaptureSessionCallback::OnError() is called!, errorCode: %{public}d",
|
||||
errorCode);
|
||||
if (captureSession_ != nullptr && captureSession_->GetApplicationCallback() != nullptr) {
|
||||
CAMERA_SYSEVENT_FAULT(CreateMsg("Session OnError! errorCode:%d", errorCode));
|
||||
captureSession_->GetApplicationCallback()->OnError(errorCode);
|
||||
} else {
|
||||
MEDIA_INFO_LOG("CaptureSessionCallback::ApplicationCallback not set!, Discarding callback");
|
||||
@@ -59,37 +51,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
static std::string GetClientBundle(int uid)
|
||||
{
|
||||
std::string bundleName = "";
|
||||
auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
if (samgr == nullptr) {
|
||||
MEDIA_ERR_LOG("Get ability manager failed");
|
||||
return bundleName;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> object = samgr->GetSystemAbility(BUNDLE_MGR_SERVICE_SYS_ABILITY_ID);
|
||||
if (object == nullptr) {
|
||||
MEDIA_DEBUG_LOG("object is NULL.");
|
||||
return bundleName;
|
||||
}
|
||||
|
||||
sptr<AppExecFwk::IBundleMgr> bms = iface_cast<AppExecFwk::IBundleMgr>(object);
|
||||
if (bms == nullptr) {
|
||||
MEDIA_DEBUG_LOG("bundle manager service is NULL.");
|
||||
return bundleName;
|
||||
}
|
||||
|
||||
auto result = bms->GetBundleNameForUid(uid, bundleName);
|
||||
if (!result) {
|
||||
MEDIA_ERR_LOG("GetBundleNameForUid fail");
|
||||
return "";
|
||||
}
|
||||
MEDIA_INFO_LOG("bundle name is %{public}s ", bundleName.c_str());
|
||||
|
||||
return bundleName;
|
||||
}
|
||||
|
||||
CaptureSession::CaptureSession(sptr<ICaptureSession> &captureSession)
|
||||
{
|
||||
captureSession_ = captureSession;
|
||||
@@ -112,14 +73,6 @@ int32_t CaptureSession::BeginConfig()
|
||||
int32_t CaptureSession::CommitConfig()
|
||||
{
|
||||
CAMERA_SYNC_TRACE;
|
||||
if (inputDevice_ != nullptr) {
|
||||
int32_t pid = IPCSkeleton::GetCallingPid();
|
||||
int32_t uid = IPCSkeleton::GetCallingUid();
|
||||
POWERMGR_SYSEVENT_CAMERA_CONNECT(pid, uid,
|
||||
inputDevice_->GetCameraDeviceInfo()->GetID().c_str(),
|
||||
GetClientBundle(uid));
|
||||
}
|
||||
|
||||
return captureSession_->CommitConfig();
|
||||
}
|
||||
|
||||
@@ -130,7 +83,6 @@ int32_t CaptureSession::AddInput(sptr<CaptureInput> &input)
|
||||
MEDIA_ERR_LOG("CaptureSession::AddInput input is null");
|
||||
return CAMERA_INVALID_ARG;
|
||||
}
|
||||
CAMERA_SYSEVENT_STATISTIC(CreateMsg("CaptureSession::AddInput"));
|
||||
inputDevice_ = input;
|
||||
return captureSession_->AddInput(((sptr<CameraInput> &)input)->GetCameraDevice());
|
||||
}
|
||||
@@ -142,7 +94,6 @@ int32_t CaptureSession::AddOutput(sptr<CaptureOutput> &output)
|
||||
MEDIA_ERR_LOG("CaptureSession::AddOutput output is null");
|
||||
return CAMERA_INVALID_ARG;
|
||||
}
|
||||
CAMERA_SYSEVENT_STATISTIC(CreateMsg("CaptureSession::AddOutput with %s", output->GetOutputTypeString()));
|
||||
output->SetSession(this);
|
||||
return captureSession_->AddOutput(output->GetStreamType(), output->GetStream());
|
||||
}
|
||||
@@ -154,7 +105,6 @@ int32_t CaptureSession::RemoveInput(sptr<CaptureInput> &input)
|
||||
MEDIA_ERR_LOG("CaptureSession::RemoveInput input is null");
|
||||
return CAMERA_INVALID_ARG;
|
||||
}
|
||||
CAMERA_SYSEVENT_STATISTIC(CreateMsg("CaptureSession::RemoveInput"));
|
||||
if (inputDevice_ != nullptr) {
|
||||
inputDevice_ = nullptr;
|
||||
}
|
||||
@@ -168,7 +118,6 @@ int32_t CaptureSession::RemoveOutput(sptr<CaptureOutput> &output)
|
||||
MEDIA_ERR_LOG("CaptureSession::RemoveOutput output is null");
|
||||
return CAMERA_INVALID_ARG;
|
||||
}
|
||||
CAMERA_SYSEVENT_STATISTIC(CreateMsg("CaptureSession::RemoveOutput with %s", output->GetOutputTypeString()));
|
||||
output->SetSession(nullptr);
|
||||
return captureSession_->RemoveOutput(output->GetStreamType(), output->GetStream());
|
||||
}
|
||||
@@ -300,10 +249,6 @@ std::shared_ptr<SessionCallback> CaptureSession::GetApplicationCallback()
|
||||
void CaptureSession::Release()
|
||||
{
|
||||
CAMERA_SYNC_TRACE;
|
||||
if (inputDevice_ != nullptr) {
|
||||
POWERMGR_SYSEVENT_CAMERA_DISCONNECT(inputDevice_->GetCameraDeviceInfo()->GetID().c_str());
|
||||
inputDevice_ = nullptr;
|
||||
}
|
||||
int32_t errCode = captureSession_->Release(0);
|
||||
if (errCode != CAMERA_OK) {
|
||||
MEDIA_ERR_LOG("Failed to Release capture session!, %{public}d", errCode);
|
||||
|
||||
@@ -22,17 +22,11 @@ ohos_shared_library("camera_service") {
|
||||
"binder/client/src/hcapture_session_callback_proxy.cpp",
|
||||
"binder/client/src/hstream_capture_callback_proxy.cpp",
|
||||
"binder/client/src/hstream_repeat_callback_proxy.cpp",
|
||||
"binder/server/src/hcamera_device_callback_stub.cpp",
|
||||
"binder/server/src/hcamera_device_stub.cpp",
|
||||
"binder/server/src/hcamera_listener_stub.cpp",
|
||||
"binder/server/src/hcamera_service_callback_stub.cpp",
|
||||
"binder/server/src/hcamera_service_stub.cpp",
|
||||
"binder/server/src/hcapture_session_callback_stub.cpp",
|
||||
"binder/server/src/hcapture_session_stub.cpp",
|
||||
"binder/server/src/hstream_capture_callback_stub.cpp",
|
||||
"binder/server/src/hstream_capture_stub.cpp",
|
||||
"binder/server/src/hstream_metadata_stub.cpp",
|
||||
"binder/server/src/hstream_repeat_callback_stub.cpp",
|
||||
"binder/server/src/hstream_repeat_stub.cpp",
|
||||
"src/camera_util.cpp",
|
||||
"src/hcamera_device.cpp",
|
||||
@@ -75,7 +69,10 @@ ohos_shared_library("camera_service") {
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
"ability_base:want",
|
||||
"access_token:libaccesstoken_sdk",
|
||||
"bundle_framework:appexecfwk_base",
|
||||
"bundle_framework:appexecfwk_core",
|
||||
"hisysevent_native:libhisysevent",
|
||||
"hitrace_native:hitrace_meter",
|
||||
"hiviewdfx_hilog_native:libhilog",
|
||||
|
||||
@@ -63,6 +63,8 @@ private:
|
||||
std::shared_ptr<OHOS::Camera::CameraMetadata> updateSettings_;
|
||||
sptr<IStreamOperator> streamOperator_;
|
||||
std::mutex deviceLock_;
|
||||
|
||||
void ReportFlashEvent(const std::shared_ptr<OHOS::Camera::CameraMetadata> &settings);
|
||||
};
|
||||
|
||||
class CameraDeviceCallback : public ICameraDeviceCallback {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include "camera_util.h"
|
||||
#include "camera_log.h"
|
||||
#include "ipc_skeleton.h"
|
||||
#include "metadata_utils.h"
|
||||
|
||||
namespace OHOS {
|
||||
@@ -177,12 +178,29 @@ int32_t HCameraDevice::UpdateSetting(const std::shared_ptr<OHOS::Camera::CameraM
|
||||
MEDIA_ERR_LOG("HCameraDevice::UpdateSetting failed with error Code: %{public}d", rc);
|
||||
return HdiToServiceError(rc);
|
||||
}
|
||||
ReportFlashEvent(updateSettings_);
|
||||
updateSettings_ = nullptr;
|
||||
}
|
||||
MEDIA_DEBUG_LOG("HCameraDevice::UpdateSetting Updated device settings");
|
||||
return CAMERA_OK;
|
||||
}
|
||||
|
||||
void HCameraDevice::ReportFlashEvent(const std::shared_ptr<OHOS::Camera::CameraMetadata> &settings) {
|
||||
camera_metadata_item_t item;
|
||||
camera_flash_mode_enum_t flashMode = OHOS_CAMERA_FLASH_MODE_ALWAYS_OPEN;
|
||||
int ret = OHOS::Camera::FindCameraMetadataItem(settings->get(), OHOS_CONTROL_FLASH_MODE, &item);
|
||||
if (ret != CAM_META_SUCCESS) {
|
||||
MEDIA_ERR_LOG("CameraInput::GetFlashMode Failed with return code %{public}d", ret);
|
||||
flashMode = static_cast<camera_flash_mode_enum_t>(item.data.u8[0]);
|
||||
}
|
||||
|
||||
if (flashMode == OHOS_CAMERA_FLASH_MODE_CLOSE) {
|
||||
POWERMGR_SYSEVENT_FLASH_OFF();
|
||||
} else {
|
||||
POWERMGR_SYSEVENT_FLASH_ON();
|
||||
}
|
||||
}
|
||||
|
||||
int32_t HCameraDevice::EnableResult(std::vector<int32_t> &results)
|
||||
{
|
||||
if (results.empty()) {
|
||||
@@ -264,13 +282,17 @@ sptr<IStreamOperator> HCameraDevice::GetStreamOperator()
|
||||
int32_t HCameraDevice::OnError(const ErrorType type, const int32_t errorMsg)
|
||||
{
|
||||
if (deviceSvcCallback_ != nullptr) {
|
||||
int32_t errorType;
|
||||
if (type == REQUEST_TIMEOUT) {
|
||||
deviceSvcCallback_->OnError(CAMERA_DEVICE_REQUEST_TIMEOUT, errorMsg);
|
||||
errorType = CAMERA_DEVICE_REQUEST_TIMEOUT;
|
||||
} else if (type == DEVICE_PREEMPT) {
|
||||
deviceSvcCallback_->OnError(CAMERA_DEVICE_PREEMPTED, errorMsg);
|
||||
errorType = CAMERA_DEVICE_PREEMPTED;
|
||||
} else {
|
||||
deviceSvcCallback_->OnError(CAMERA_UNKNOWN_ERROR, errorMsg);
|
||||
errorType = CAMERA_UNKNOWN_ERROR;
|
||||
}
|
||||
deviceSvcCallback_->OnError(errorType, errorMsg);
|
||||
CAMERA_SYSEVENT_FAULT(CreateMsg("CameraDeviceServiceCallback::OnError() is called!, errorType: %d,"
|
||||
"errorMsg: %d", errorType, errorMsg));
|
||||
}
|
||||
return CAMERA_OK;
|
||||
}
|
||||
@@ -281,6 +303,38 @@ int32_t HCameraDevice::OnResult(const uint64_t timestamp,
|
||||
if (deviceSvcCallback_ != nullptr) {
|
||||
deviceSvcCallback_->OnResult(timestamp, result);
|
||||
}
|
||||
camera_metadata_item_t item;
|
||||
common_metadata_header_t *metadata = result->get();
|
||||
int ret = OHOS::Camera::FindCameraMetadataItem(metadata, OHOS_CONTROL_FLASH_MODE, &item);
|
||||
if (ret == 0) {
|
||||
MEDIA_INFO_LOG("CameraDeviceServiceCallback::OnResult() OHOS_CONTROL_FLASH_MODE is %{public}d",
|
||||
item.data.u8[0]);
|
||||
CAMERA_SYSEVENT_BEHAVIOR(CreateMsg("FlashModeChanged! current OHOS_CONTROL_FLASH_MODE is %d",
|
||||
item.data.u8[0]));
|
||||
}
|
||||
ret = OHOS::Camera::FindCameraMetadataItem(metadata, OHOS_CONTROL_FLASH_STATE, &item);
|
||||
if (ret == 0) {
|
||||
MEDIA_INFO_LOG("CameraDeviceServiceCallback::OnResult() OHOS_CONTROL_FLASH_STATE is %{public}d",
|
||||
item.data.u8[0]);
|
||||
CAMERA_SYSEVENT_BEHAVIOR(CreateMsg("FlashStateChanged! current OHOS_CONTROL_FLASH_STATE is %d",
|
||||
item.data.u8[0]));
|
||||
POWERMGR_SYSEVENT_TORCH_STATE(IPCSkeleton::GetCallingPid(),
|
||||
IPCSkeleton::GetCallingUid(), item.data.u8[0]);
|
||||
}
|
||||
|
||||
ret = OHOS::Camera::FindCameraMetadataItem(metadata, OHOS_CONTROL_FOCUS_MODE, &item);
|
||||
if (ret == CAM_META_SUCCESS) {
|
||||
MEDIA_DEBUG_LOG("Focus mode: %{public}d", item.data.u8[0]);
|
||||
CAMERA_SYSEVENT_BEHAVIOR(CreateMsg("FocusModeChanged! current OHOS_CONTROL_FOCUS_MODE is %d",
|
||||
item.data.u8[0]));
|
||||
}
|
||||
ret = OHOS::Camera::FindCameraMetadataItem(metadata, OHOS_CONTROL_FOCUS_STATE, &item);
|
||||
if (ret == CAM_META_SUCCESS) {
|
||||
MEDIA_INFO_LOG("Focus state: %{public}d", item.data.u8[0]);
|
||||
CAMERA_SYSEVENT_BEHAVIOR(CreateMsg("FocusStateChanged! current OHOS_CONTROL_FOCUS_STATE is %d",
|
||||
item.data.u8[0]));
|
||||
}
|
||||
|
||||
return CAMERA_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,6 +92,35 @@ int32_t HCameraService::GetCameras(std::vector<std::string> &cameraIds,
|
||||
MEDIA_ERR_LOG("HCameraService::GetCameraAbility failed");
|
||||
return ret;
|
||||
}
|
||||
|
||||
camera_metadata_item_t item;
|
||||
common_metadata_header_t *metadata = cameraAbility->get();
|
||||
camera_position_enum_t cameraPosition = OHOS_CAMERA_POSITION_OTHER;
|
||||
int ret = OHOS::Camera::FindCameraMetadataItem(metadata, OHOS_ABILITY_CAMERA_POSITION, &item);
|
||||
if (ret == CAM_META_SUCCESS) {
|
||||
cameraPosition = static_cast<camera_position_enum_t>(item.data.u8[0]);
|
||||
}
|
||||
|
||||
camera_type_enum_t cameraType = OHOS_CAMERA_TYPE_UNSPECIFIED;
|
||||
ret = OHOS::Camera::FindCameraMetadataItem(metadata, OHOS_ABILITY_CAMERA_TYPE, &item);
|
||||
if (ret == CAM_META_SUCCESS) {
|
||||
cameraType = static_cast<camera_type_enum_t>(item.data.u8[0]);
|
||||
}
|
||||
|
||||
camera_connection_type_t connectionType = OHOS_CAMERA_CONNECTION_TYPE_BUILTIN;
|
||||
ret = OHOS::Camera::FindCameraMetadataItem(metadata, OHOS_ABILITY_CAMERA_CONNECTION_TYPE, &item);
|
||||
if (ret == CAM_META_SUCCESS) {
|
||||
connectionType = static_cast<camera_connection_type_t>(item.data.u8[0]);
|
||||
}
|
||||
|
||||
bool isMirrorSupported = false;
|
||||
ret = OHOS::Camera::FindCameraMetadataItem(metadata, OHOS_CONTROL_CAPTURE_MIRROR_SUPPORTED, &item);
|
||||
if (ret == CAM_META_SUCCESS) {
|
||||
isMirrorSupported = ((item.data.u8[0] == 1) || (item.data.u8[0] == 0));
|
||||
}
|
||||
CAMERA_SYSEVENT_STATISTIC(CreateMsg("CameraManager GetCameras camera ID:%s, Camera position:%d,"
|
||||
" Camera Type:%d, Connection Type:%d, Mirror support:%d", id.c_str(),
|
||||
cameraPosition, cameraType, connectionType, isMirrorSupported));
|
||||
cameraAbilityList.emplace_back(cameraAbility);
|
||||
}
|
||||
|
||||
@@ -132,6 +161,7 @@ int32_t HCameraService::CreateCameraDevice(std::string cameraId, sptr<ICameraDev
|
||||
}
|
||||
devices_.insert(std::make_pair(cameraId, cameraDevice));
|
||||
device = cameraDevice;
|
||||
CAMERA_SYSEVENT_STATISTIC(CreateMsg("CameraManager_CreateCameraInput CameraId:%s", cameraId.c_str()));
|
||||
return CAMERA_OK;
|
||||
}
|
||||
|
||||
@@ -170,6 +200,8 @@ int32_t HCameraService::CreatePhotoOutput(const sptr<OHOS::IBufferProducer> &pro
|
||||
MEDIA_ERR_LOG("HCameraService::CreatePhotoOutput HStreamCapture allocation failed");
|
||||
return CAMERA_ALLOC_ERROR;
|
||||
}
|
||||
POWERMGR_SYSEVENT_CAMERA_CONFIG(PHOTO, producer->GetDefaultWidth(),
|
||||
producer->GetDefaultHeight());
|
||||
photoOutput = streamCapture;
|
||||
return CAMERA_OK;
|
||||
}
|
||||
@@ -189,6 +221,8 @@ int32_t HCameraService::CreatePreviewOutput(const sptr<OHOS::IBufferProducer> &p
|
||||
MEDIA_ERR_LOG("HCameraService::CreatePreviewOutput HStreamRepeat allocation failed");
|
||||
return CAMERA_ALLOC_ERROR;
|
||||
}
|
||||
POWERMGR_SYSEVENT_CAMERA_CONFIG(PREVIEW, producer->GetDefaultWidth(),
|
||||
producer->GetDefaultHeight());
|
||||
previewOutput = streamRepeatPreview;
|
||||
return CAMERA_OK;
|
||||
}
|
||||
@@ -208,6 +242,7 @@ int32_t HCameraService::CreateCustomPreviewOutput(const sptr<OHOS::IBufferProduc
|
||||
MEDIA_ERR_LOG("HCameraService::CreateCustomPreviewOutput HStreamRepeat allocation failed");
|
||||
return CAMERA_ALLOC_ERROR;
|
||||
}
|
||||
POWERMGR_SYSEVENT_CAMERA_CONFIG(PREVIEW, width, height);
|
||||
previewOutput = streamRepeatPreview;
|
||||
return CAMERA_OK;
|
||||
}
|
||||
@@ -227,6 +262,8 @@ int32_t HCameraService::CreateMetadataOutput(const sptr<OHOS::IBufferProducer> &
|
||||
MEDIA_ERR_LOG("HCameraService::CreateMetadataOutput HStreamMetadata allocation failed");
|
||||
return CAMERA_ALLOC_ERROR;
|
||||
}
|
||||
POWERMGR_SYSEVENT_CAMERA_CONFIG(METADATA, producer->GetDefaultWidth(),
|
||||
producer->GetDefaultHeight());
|
||||
metadataOutput = streamMetadata;
|
||||
return CAMERA_OK;
|
||||
}
|
||||
@@ -246,6 +283,8 @@ int32_t HCameraService::CreateVideoOutput(const sptr<OHOS::IBufferProducer> &pro
|
||||
MEDIA_ERR_LOG("HCameraService::CreateVideoOutput HStreamRepeat allocation failed");
|
||||
return CAMERA_ALLOC_ERROR;
|
||||
}
|
||||
POWERMGR_SYSEVENT_CAMERA_CONFIG(VIDEO, producer->GetDefaultWidth(),
|
||||
producer->GetDefaultHeight());
|
||||
videoOutput = streamRepeatVideo;
|
||||
return CAMERA_OK;
|
||||
}
|
||||
@@ -254,6 +293,8 @@ void HCameraService::OnCameraStatus(const std::string& cameraId, CameraStatus st
|
||||
{
|
||||
if (cameraServiceCallback_) {
|
||||
cameraServiceCallback_->OnCameraStatusChanged(cameraId, status);
|
||||
CAMERA_SYSEVENT_BEHAVIOR(CreateMsg("OnCameraStatusChanged! for cameraId:%s, current Camera Status:%d",
|
||||
cameraId.c_str(), status));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,6 +302,10 @@ void HCameraService::OnFlashlightStatus(const std::string& cameraId, FlashStatus
|
||||
{
|
||||
if (cameraServiceCallback_) {
|
||||
cameraServiceCallback_->OnFlashlightStatusChanged(cameraId, status);
|
||||
CAMERA_SYSEVENT_BEHAVIOR(CreateMsg("OnFlashlightStatusChanged! for cameraId:%s, current Flash Status:%d",
|
||||
cameraId.c_str(), status));
|
||||
POWERMGR_SYSEVENT_TORCH_STATE(IPCSkeleton::GetCallingPid(),
|
||||
IPCSkeleton::GetCallingUid(), status);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,11 +20,49 @@
|
||||
#include "surface.h"
|
||||
#include "ipc_skeleton.h"
|
||||
#include "metadata_utils.h"
|
||||
#include "bundle_mgr_interface.h"
|
||||
#include "iservice_registry.h"
|
||||
#include "system_ability_definition.h"
|
||||
|
||||
using namespace OHOS::AppExecFwk;
|
||||
using namespace OHOS::AAFwk;
|
||||
|
||||
namespace OHOS {
|
||||
namespace CameraStandard {
|
||||
static std::map<int32_t, sptr<HCaptureSession>> session_;
|
||||
static std::mutex sessionLock_;
|
||||
|
||||
static std::string GetClientBundle(int uid)
|
||||
{
|
||||
std::string bundleName = "";
|
||||
auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
if (samgr == nullptr) {
|
||||
MEDIA_ERR_LOG("Get ability manager failed");
|
||||
return bundleName;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> object = samgr->GetSystemAbility(BUNDLE_MGR_SERVICE_SYS_ABILITY_ID);
|
||||
if (object == nullptr) {
|
||||
MEDIA_DEBUG_LOG("object is NULL.");
|
||||
return bundleName;
|
||||
}
|
||||
|
||||
sptr<AppExecFwk::IBundleMgr> bms = iface_cast<AppExecFwk::IBundleMgr>(object);
|
||||
if (bms == nullptr) {
|
||||
MEDIA_DEBUG_LOG("bundle manager service is NULL.");
|
||||
return bundleName;
|
||||
}
|
||||
|
||||
auto result = bms->GetBundleNameForUid(uid, bundleName);
|
||||
if (!result) {
|
||||
MEDIA_ERR_LOG("GetBundleNameForUid fail");
|
||||
return "";
|
||||
}
|
||||
MEDIA_INFO_LOG("bundle name is %{public}s ", bundleName.c_str());
|
||||
|
||||
return bundleName;
|
||||
}
|
||||
|
||||
HCaptureSession::HCaptureSession(sptr<HCameraHostManager> cameraHostManager,
|
||||
sptr<StreamOperatorCallback> streamOperatorCb)
|
||||
: cameraHostManager_(cameraHostManager), streamOperatorCallback_(streamOperatorCb),
|
||||
@@ -102,6 +140,7 @@ int32_t HCaptureSession::AddInput(sptr<ICameraDeviceService> cameraDevice)
|
||||
cameraDevice_->SetReleaseCameraDevice(false);
|
||||
} else {
|
||||
tempCameraDevices_.emplace_back(localCameraDevice);
|
||||
CAMERA_SYSEVENT_STATISTIC(CreateMsg("CaptureSession::AddInput"));
|
||||
}
|
||||
return CAMERA_OK;
|
||||
}
|
||||
@@ -143,6 +182,7 @@ int32_t HCaptureSession::AddOutput(StreamType streamType, sptr<IStreamCommon> st
|
||||
} else if (streamType == StreamType::METADATA) {
|
||||
rc = AddOutputStream(static_cast<HStreamMetadata *>(stream.GetRefPtr()));
|
||||
}
|
||||
CAMERA_SYSEVENT_STATISTIC(CreateMsg("CaptureSession::AddOutput with %d", streamType));
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -168,6 +208,7 @@ int32_t HCaptureSession::RemoveInput(sptr<ICameraDeviceService> cameraDevice)
|
||||
MEDIA_ERR_LOG("HCaptureSession::RemoveInput Invalid camera device");
|
||||
return CAMERA_INVALID_SESSION_CFG;
|
||||
}
|
||||
CAMERA_SYSEVENT_STATISTIC(CreateMsg("CaptureSession::RemoveInput"));
|
||||
return CAMERA_OK;
|
||||
}
|
||||
|
||||
@@ -213,6 +254,7 @@ int32_t HCaptureSession::RemoveOutput(StreamType streamType, sptr<IStreamCommon>
|
||||
} else if (streamType == StreamType::METADATA) {
|
||||
rc = RemoveOutputStream(static_cast<HStreamMetadata *>(stream.GetRefPtr()));
|
||||
}
|
||||
CAMERA_SYSEVENT_STATISTIC(CreateMsg("CaptureSession::RemoveOutput with %d", streamType));
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -543,6 +585,13 @@ int32_t HCaptureSession::CommitConfig()
|
||||
RestorePreviousState(cameraDevice_, !deletedStreamIds_.empty());
|
||||
return rc;
|
||||
}
|
||||
if (device != nullptr) {
|
||||
int32_t pid = IPCSkeleton::GetCallingPid();
|
||||
int32_t uid = IPCSkeleton::GetCallingUid();
|
||||
POWERMGR_SYSEVENT_CAMERA_CONNECT(pid, uid, device->GetCameraId().c_str(),
|
||||
GetClientBundle(uid));
|
||||
}
|
||||
|
||||
if (cameraDevice_ != nullptr && device != cameraDevice_) {
|
||||
cameraDevice_->Close();
|
||||
cameraDevice_ = nullptr;
|
||||
@@ -641,6 +690,7 @@ int32_t HCaptureSession::Release(pid_t pid)
|
||||
}
|
||||
if (cameraDevice_ != nullptr) {
|
||||
cameraDevice_->Close();
|
||||
POWERMGR_SYSEVENT_CAMERA_DISCONNECT(cameraDevice_->GetCameraId().c_str());
|
||||
cameraDevice_ = nullptr;
|
||||
}
|
||||
ClearCaptureSession(pid);
|
||||
|
||||
@@ -123,11 +123,15 @@ int32_t HStreamCapture::OnCaptureEnded(int32_t captureId, int32_t frameCount)
|
||||
int32_t HStreamCapture::OnCaptureError(int32_t captureId, int32_t errorCode)
|
||||
{
|
||||
if (streamCaptureCallback_ != nullptr) {
|
||||
int32_t captureErrorCode;
|
||||
if (errorCode == BUFFER_LOST) {
|
||||
streamCaptureCallback_->OnCaptureError(captureId, CAMERA_STREAM_BUFFER_LOST);
|
||||
captureErrorCode = CAMERA_STREAM_BUFFER_LOST;
|
||||
} else {
|
||||
streamCaptureCallback_->OnCaptureError(captureId, CAMERA_UNKNOWN_ERROR);
|
||||
captureErrorCode = CAMERA_UNKNOWN_ERROR;
|
||||
}
|
||||
CAMERA_SYSEVENT_FAULT(CreateMsg("Photo OnCaptureError! captureId:%d & "
|
||||
"errorCode:%{public}d", captureId, captureErrorCode));
|
||||
streamCaptureCallback_->OnCaptureError(captureId, captureErrorCode);
|
||||
}
|
||||
return CAMERA_OK;
|
||||
}
|
||||
|
||||
@@ -181,11 +181,14 @@ int32_t HStreamRepeat::OnFrameEnded(int32_t frameCount)
|
||||
int32_t HStreamRepeat::OnFrameError(int32_t errorType)
|
||||
{
|
||||
if (streamRepeatCallback_ != nullptr) {
|
||||
int32_t repeatErrorCode;
|
||||
if (errorType == BUFFER_LOST) {
|
||||
streamRepeatCallback_->OnFrameError(CAMERA_STREAM_BUFFER_LOST);
|
||||
repeatErrorCode = CAMERA_STREAM_BUFFER_LOST;
|
||||
} else {
|
||||
streamRepeatCallback_->OnFrameError(CAMERA_UNKNOWN_ERROR);
|
||||
repeatErrorCode = CAMERA_UNKNOWN_ERROR;
|
||||
}
|
||||
CAMERA_SYSEVENT_FAULT(CreateMsg("Preview OnFrameError! errorCode:%d", repeatErrorCode));
|
||||
streamRepeatCallback_->OnFrameError(repeatErrorCode);
|
||||
}
|
||||
return CAMERA_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user