From 16d017da95ac6916c568baffbe9b1a8282f100d8 Mon Sep 17 00:00:00 2001 From: wangchaole Date: Fri, 1 Jul 2022 14:32:30 +0800 Subject: [PATCH] =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=A0=81=E5=92=8C=E6=A1=86?= =?UTF-8?q?=E6=9E=B6=E5=AF=B9=E9=BD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- .../client/src/callback/dcamera_input_callback.cpp | 7 ++++++- .../src/distributedcameramgr/dcamera_sink_controller.cpp | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/services/cameraservice/cameraoperator/client/src/callback/dcamera_input_callback.cpp b/services/cameraservice/cameraoperator/client/src/callback/dcamera_input_callback.cpp index de24c0b9..37da5e37 100644 --- a/services/cameraservice/cameraoperator/client/src/callback/dcamera_input_callback.cpp +++ b/services/cameraservice/cameraoperator/client/src/callback/dcamera_input_callback.cpp @@ -15,6 +15,7 @@ #include "dcamera_input_callback.h" +#include "camera_util.h" #include "dcamera_utils_tools.h" #include "distributed_camera_constants.h" #include "distributed_hardware_log.h" @@ -36,7 +37,11 @@ void DCameraInputCallback::OnError(const int32_t errorType, const int32_t errorM std::shared_ptr event = std::make_shared(); event->eventType_ = DCAMERA_MESSAGE; - event->eventResult_ = DCAMERA_EVENT_DEVICE_ERROR; + if (errorType == CameraStandard::CamServiceError::CAMERA_DEVICE_PREEMPTED) { + event->eventResult_ = DCAMERA_EVENT_DEVICE_PREEMPT; + } else { + event->eventResult_ = DCAMERA_EVENT_DEVICE_ERROR; + } callback_->OnStateChanged(event); } diff --git a/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp b/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp index 8f476c36..98cdbfe8 100644 --- a/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp +++ b/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp @@ -310,7 +310,11 @@ void DCameraSinkController::OnStateChanged(std::shared_ptr& event) { DHLOGI("DCameraSinkController::OnStateChanged dhId: %s, result: %d", GetAnonyString(dhId_).c_str(), event->eventResult_); - DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_DEVICE_ERROR, std::string("camera error")); + if (event->eventType_ == DCAMERA_EVENT_DEVICE_PREEMPT) { + DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_DEVICE_PREEMPT, std::string("camera device preempted")); + } else { + DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_DEVICE_ERROR, std::string("camera error")); + } } void DCameraSinkController::OnMetadataResult(std::vector>& settings) -- Gitee