From bccd5964ffb5ab18f7c899bfe303c53dd61a51c3 Mon Sep 17 00:00:00 2001 From: wangchaole Date: Thu, 16 Jun 2022 15:42:45 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E5=A4=84=E7=90=86reviewbot=E5=91=8A?= =?UTF-8?q?=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- .../dstream_operator/dstream_operator.h | 1 + .../src/dstream_operator/dstream_operator.cpp | 17 +++++++---- .../client/include/dcamera_client.h | 1 + .../client/src/dcamera_client.cpp | 29 ++++++++++--------- .../client/src/dcamera_client_common.cpp | 27 ++++++++++------- 5 files changed, 45 insertions(+), 30 deletions(-) diff --git a/camera_hdf/hdi_impl/include/dstream_operator/dstream_operator.h b/camera_hdf/hdi_impl/include/dstream_operator/dstream_operator.h index 5a7eea26..f9b39de8 100644 --- a/camera_hdf/hdi_impl/include/dstream_operator/dstream_operator.h +++ b/camera_hdf/hdi_impl/include/dstream_operator/dstream_operator.h @@ -90,6 +90,7 @@ private: void ExtractStreamInfo(DCStreamInfo &dstStreamInfo, const std::shared_ptr &srcStreamInfo); void ExtractCaptureInfo(std::vector &captureInfos); void ExtractCameraAttr(Json::Value &rootValue, std::set &allFormats, std::vector &photoFormats); + void SetSrcStreamInfo(std::vector>& srcStreamInfo); private: std::shared_ptr dMetadataProcessor_; diff --git a/camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp b/camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp index 735359e4..53d30ab9 100644 --- a/camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp +++ b/camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp @@ -699,12 +699,7 @@ DCamRetCode DStreamOperator::NegotiateSuitableCaptureInfo(const std::shared_ptr< bool isStreaming) { std::vector> srcStreamInfo; - for (auto &id : srcCaptureInfo->streamIds_) { - auto iter = dcStreamInfoMap_.find(id); - if (iter != dcStreamInfoMap_.end()) { - srcStreamInfo.push_back(iter->second); - } - } + SetSrcStreamInfo(srcStreamInfo); if (srcStreamInfo.empty()) { DHLOGE("Input source stream info vector is empty."); return DCamRetCode::INVALID_ARGUMENT; @@ -751,6 +746,16 @@ DCamRetCode DStreamOperator::NegotiateSuitableCaptureInfo(const std::shared_ptr< return SUCCESS; } +void DStreamOperator::SetSrcStreamInfo(std::vector>& srcStreamInfo) +{ + for (auto &id : srcCaptureInfo->streamIds_) { + auto iter = dcStreamInfoMap_.find(id); + if (iter != dcStreamInfoMap_.end()) { + srcStreamInfo.push_back(iter->second); + } + } +} + std::shared_ptr DStreamOperator::BuildSuitableCaptureInfo(const shared_ptr& srcCaptureInfo, std::vector> &srcStreamInfo) { diff --git a/services/cameraservice/cameraoperator/client/include/dcamera_client.h b/services/cameraservice/cameraoperator/client/include/dcamera_client.h index 712d7544..e7342175 100644 --- a/services/cameraservice/cameraoperator/client/include/dcamera_client.h +++ b/services/cameraservice/cameraoperator/client/include/dcamera_client.h @@ -57,6 +57,7 @@ private: int32_t StartVideoOutput(); void SetQualityAndGpsLocation(const std::shared_ptr& cameraMetadata, std::shared_ptr& photoCaptureSettings); + void ReleasCaptureSession(); bool isInit_; std::string cameraId_; diff --git a/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp b/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp index 86e22ebd..c66fccb0 100644 --- a/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp +++ b/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp @@ -163,19 +163,7 @@ int32_t DCameraClient::StopCapture() photoOutput_->Release(); photoOutput_ = nullptr; } - - if (captureSession_ != nullptr) { - DHLOGI("DCameraClient::StopCapture %s stop captureSession", GetAnonyString(cameraId_).c_str()); - int32_t ret = captureSession_->Stop(); - if (ret != DCAMERA_OK) { - DHLOGE("DCameraClient::StopCapture captureSession stop failed, cameraId: %s, ret: %d", - GetAnonyString(cameraId_).c_str(), ret); - } - DHLOGI("DCameraClient::StopCapture %s release captureSession", GetAnonyString(cameraId_).c_str()); - captureSession_->Release(); - captureSession_ = nullptr; - } - + ReleasCaptureSession(); if (cameraInput_ != nullptr) { DHLOGI("DCameraClient::StopCapture %s release cameraInput", GetAnonyString(cameraId_).c_str()); cameraInput_->Release(); @@ -210,6 +198,21 @@ int32_t DCameraClient::StopCapture() return DCAMERA_OK; } +void DCameraClient::ReleasCaptureSession() +{ + if (captureSession_ != nullptr) { + DHLOGI("DCameraClient::StopCapture %s stop captureSession", GetAnonyString(cameraId_).c_str()); + int32_t ret = captureSession_->Stop(); + if (ret != DCAMERA_OK) { + DHLOGE("DCameraClient::StopCapture captureSession stop failed, cameraId: %s, ret: %d", + GetAnonyString(cameraId_).c_str(), ret); + } + DHLOGI("DCameraClient::StopCapture %s release captureSession", GetAnonyString(cameraId_).c_str()); + captureSession_->Release(); + captureSession_ = nullptr; + } +} + int32_t DCameraClient::SetStateCallback(std::shared_ptr& callback) { DHLOGI("DCameraClient::SetStateCallback cameraId: %s", GetAnonyString(cameraId_).c_str()); diff --git a/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp b/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp index 72ec7512..7f9b6fa9 100644 --- a/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp +++ b/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp @@ -146,17 +146,7 @@ int32_t DCameraClient::StartCapture(std::vectorStop(); - if (ret != DCAMERA_OK) { - DHLOGE("DCameraClientCommon::StopCapture captureSession stop failed, cameraId: %s, ret: %d", - GetAnonyString(cameraId_).c_str(), ret); - } - DHLOGI("DCameraClientCommon::StopCapture %s release captureSession", GetAnonyString(cameraId_).c_str()); - captureSession_->Release(); - captureSession_ = nullptr; - } + ReleasCaptureSession(); if (cameraInput_ != nullptr) { DHLOGI("DCameraClientCommon::StopCapture %s release cameraInput", GetAnonyString(cameraId_).c_str()); @@ -194,6 +184,21 @@ int32_t DCameraClient::StopCapture() return DCAMERA_OK; } +void DCameraClient::ReleasCaptureSession() +{ + if (captureSession_ != nullptr) { + DHLOGI("DCameraClientCommon::StopCapture %s stop captureSession", GetAnonyString(cameraId_).c_str()); + int32_t ret = captureSession_->Stop(); + if (ret != DCAMERA_OK) { + DHLOGE("DCameraClientCommon::StopCapture captureSession stop failed, cameraId: %s, ret: %d", + GetAnonyString(cameraId_).c_str(), ret); + } + DHLOGI("DCameraClientCommon::StopCapture %s release captureSession", GetAnonyString(cameraId_).c_str()); + captureSession_->Release(); + captureSession_ = nullptr; + } +} + int32_t DCameraClient::SetStateCallback(std::shared_ptr& callback) { DHLOGI("DCameraClientCommon::SetStateCallback cameraId: %s", GetAnonyString(cameraId_).c_str()); -- Gitee From 185daba1a8c7364e04aaab437728a95263a42773 Mon Sep 17 00:00:00 2001 From: wangchaole Date: Thu, 16 Jun 2022 17:27:22 +0800 Subject: [PATCH 2/8] reviewbot Signed-off-by: wangchaole --- .../include/dstream_operator/dstream_operator.h | 2 +- .../src/dstream_operator/dstream_operator.cpp | 4 ++-- .../constants/distributed_camera_constants.h | 3 +++ .../client/src/callback/dcamera_input_callback.cpp | 7 +++++-- .../client/src/callback/dcamera_photo_callback.cpp | 2 +- .../dcamera_sink_controller.cpp | 14 +++++++++----- 6 files changed, 21 insertions(+), 11 deletions(-) diff --git a/camera_hdf/hdi_impl/include/dstream_operator/dstream_operator.h b/camera_hdf/hdi_impl/include/dstream_operator/dstream_operator.h index f9b39de8..efac1683 100644 --- a/camera_hdf/hdi_impl/include/dstream_operator/dstream_operator.h +++ b/camera_hdf/hdi_impl/include/dstream_operator/dstream_operator.h @@ -90,7 +90,7 @@ private: void ExtractStreamInfo(DCStreamInfo &dstStreamInfo, const std::shared_ptr &srcStreamInfo); void ExtractCaptureInfo(std::vector &captureInfos); void ExtractCameraAttr(Json::Value &rootValue, std::set &allFormats, std::vector &photoFormats); - void SetSrcStreamInfo(std::vector>& srcStreamInfo); + void SetSrcStreamInfo(const std::shared_ptr& srcCaptureInfo, std::vector>& srcStreamInfo); private: std::shared_ptr dMetadataProcessor_; diff --git a/camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp b/camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp index 53d30ab9..a2fe63c2 100644 --- a/camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp +++ b/camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp @@ -699,7 +699,7 @@ DCamRetCode DStreamOperator::NegotiateSuitableCaptureInfo(const std::shared_ptr< bool isStreaming) { std::vector> srcStreamInfo; - SetSrcStreamInfo(srcStreamInfo); + SetSrcStreamInfo(srcCaptureInfo, srcStreamInfo); if (srcStreamInfo.empty()) { DHLOGE("Input source stream info vector is empty."); return DCamRetCode::INVALID_ARGUMENT; @@ -746,7 +746,7 @@ DCamRetCode DStreamOperator::NegotiateSuitableCaptureInfo(const std::shared_ptr< return SUCCESS; } -void DStreamOperator::SetSrcStreamInfo(std::vector>& srcStreamInfo) +void DStreamOperator::SetSrcStreamInfo(const std::shared_ptr& srcCaptureInfo, std::vector>& srcStreamInfo) { for (auto &id : srcCaptureInfo->streamIds_) { auto iter = dcStreamInfoMap_.find(id); diff --git a/common/include/constants/distributed_camera_constants.h b/common/include/constants/distributed_camera_constants.h index eddb2f5b..90d7acde 100644 --- a/common/include/constants/distributed_camera_constants.h +++ b/common/include/constants/distributed_camera_constants.h @@ -58,6 +58,9 @@ typedef enum { DCAMERA_EVENT_START_CAPTURE_ERROR = -6, DCAMERA_EVENT_STOP_CAPTURE_ERROR = -7, DCAMERA_EVENT_UPDATE_SETTINGS_ERROR = -8, + DCAMERA_EVENT_DEVICE_PREEMPT = -9, + DCAMERA_EVENT_DEVICE_IN_USE = -10, + DCAMERA_EVENT_NO_PERMISSION = -11, } DCameraEventResult; typedef enum { 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 8d980fd5..0cbf46ae 100644 --- a/services/cameraservice/cameraoperator/client/src/callback/dcamera_input_callback.cpp +++ b/services/cameraservice/cameraoperator/client/src/callback/dcamera_input_callback.cpp @@ -31,10 +31,13 @@ void DCameraInputCallback::OnError(const int32_t errorType, const int32_t errorM DHLOGE("DCameraInputCallback::OnError StateCallback is null"); return; } - std::shared_ptr event = std::make_shared(); event->eventType_ = DCAMERA_MESSAGE; - event->eventResult_ = DCAMERA_EVENT_CAMERA_ERROR; + if (errorType == CamServiceError::) { + event->eventResult_ = DCAMERA_DEVICE_PREEMPT; + } else { + event->eventResult_ = DCAMERA_EVENT_CAMERA_ERROR; + } callback_->OnStateChanged(event); } } // namespace DistributedHardware diff --git a/services/cameraservice/cameraoperator/client/src/callback/dcamera_photo_callback.cpp b/services/cameraservice/cameraoperator/client/src/callback/dcamera_photo_callback.cpp index 1ad5ca50..bbadae4e 100644 --- a/services/cameraservice/cameraoperator/client/src/callback/dcamera_photo_callback.cpp +++ b/services/cameraservice/cameraoperator/client/src/callback/dcamera_photo_callback.cpp @@ -49,7 +49,7 @@ void DCameraPhotoCallback::OnCaptureError(const int32_t captureId, const int32_t std::shared_ptr event = std::make_shared(); event->eventType_ = DCAMERA_MESSAGE; - event->eventResult_ = DCAMERA_EVENT_CAMERA_ERROR; + event->eventResult_ = DCAMERA_DEVICE_ERROR; callback_->OnStateChanged(event); } } // namespace DistributedHardware diff --git a/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp b/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp index 9501728a..ecf5eb38 100644 --- a/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp +++ b/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp @@ -79,7 +79,7 @@ int32_t DCameraSinkController::StopCapture() if (ret != DCAMERA_OK) { DHLOGE("DCameraSinkController::StopCapture client stop capture failed, dhId: %s, ret: %d", GetAnonyString(dhId_).c_str(), ret); - DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_CAMERA_ERROR, std::string("operator stop capture failed")); + DCameraNotifyInner(DCAMERA_MESSAGE, ret, std::string("operator stop capture failed")); return ret; } @@ -87,7 +87,7 @@ int32_t DCameraSinkController::StopCapture() if (ret != DCAMERA_OK) { DHLOGE("DCameraSinkController::StopCapture output stop capture failed, dhId: %s, ret: %d", GetAnonyString(dhId_).c_str(), ret); - DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_CAMERA_ERROR, std::string("output stop capture failed")); + DCameraNotifyInner(DCAMERA_MESSAGE, ret, std::string("output stop capture failed")); return ret; } @@ -309,7 +309,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_CAMERA_ERROR, std::string("camera error")); + if (event->eventResult_ == CamServiceError::) { + DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_DEVICE_PREEMPT, std::string("camera preempted")); + } else { + DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_CAMERA_ERROR, std::string("camera error")); + } } void DCameraSinkController::OnMetadataResult() @@ -387,7 +391,7 @@ int32_t DCameraSinkController::StartCaptureInner(std::vector Date: Thu, 16 Jun 2022 18:47:29 +0800 Subject: [PATCH 3/8] =?UTF-8?q?reviewbot=E5=91=8A=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- .../constants/distributed_camera_constants.h | 3 --- .../client/src/callback/dcamera_input_callback.cpp | 7 ++----- .../client/src/callback/dcamera_photo_callback.cpp | 2 +- .../dcamera_sink_controller.cpp | 14 +++++--------- 4 files changed, 8 insertions(+), 18 deletions(-) diff --git a/common/include/constants/distributed_camera_constants.h b/common/include/constants/distributed_camera_constants.h index 90d7acde..eddb2f5b 100644 --- a/common/include/constants/distributed_camera_constants.h +++ b/common/include/constants/distributed_camera_constants.h @@ -58,9 +58,6 @@ typedef enum { DCAMERA_EVENT_START_CAPTURE_ERROR = -6, DCAMERA_EVENT_STOP_CAPTURE_ERROR = -7, DCAMERA_EVENT_UPDATE_SETTINGS_ERROR = -8, - DCAMERA_EVENT_DEVICE_PREEMPT = -9, - DCAMERA_EVENT_DEVICE_IN_USE = -10, - DCAMERA_EVENT_NO_PERMISSION = -11, } DCameraEventResult; typedef enum { 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 0cbf46ae..8d980fd5 100644 --- a/services/cameraservice/cameraoperator/client/src/callback/dcamera_input_callback.cpp +++ b/services/cameraservice/cameraoperator/client/src/callback/dcamera_input_callback.cpp @@ -31,13 +31,10 @@ void DCameraInputCallback::OnError(const int32_t errorType, const int32_t errorM DHLOGE("DCameraInputCallback::OnError StateCallback is null"); return; } + std::shared_ptr event = std::make_shared(); event->eventType_ = DCAMERA_MESSAGE; - if (errorType == CamServiceError::) { - event->eventResult_ = DCAMERA_DEVICE_PREEMPT; - } else { - event->eventResult_ = DCAMERA_EVENT_CAMERA_ERROR; - } + event->eventResult_ = DCAMERA_EVENT_CAMERA_ERROR; callback_->OnStateChanged(event); } } // namespace DistributedHardware diff --git a/services/cameraservice/cameraoperator/client/src/callback/dcamera_photo_callback.cpp b/services/cameraservice/cameraoperator/client/src/callback/dcamera_photo_callback.cpp index bbadae4e..1ad5ca50 100644 --- a/services/cameraservice/cameraoperator/client/src/callback/dcamera_photo_callback.cpp +++ b/services/cameraservice/cameraoperator/client/src/callback/dcamera_photo_callback.cpp @@ -49,7 +49,7 @@ void DCameraPhotoCallback::OnCaptureError(const int32_t captureId, const int32_t std::shared_ptr event = std::make_shared(); event->eventType_ = DCAMERA_MESSAGE; - event->eventResult_ = DCAMERA_DEVICE_ERROR; + event->eventResult_ = DCAMERA_EVENT_CAMERA_ERROR; callback_->OnStateChanged(event); } } // namespace DistributedHardware diff --git a/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp b/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp index ecf5eb38..9501728a 100644 --- a/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp +++ b/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp @@ -79,7 +79,7 @@ int32_t DCameraSinkController::StopCapture() if (ret != DCAMERA_OK) { DHLOGE("DCameraSinkController::StopCapture client stop capture failed, dhId: %s, ret: %d", GetAnonyString(dhId_).c_str(), ret); - DCameraNotifyInner(DCAMERA_MESSAGE, ret, std::string("operator stop capture failed")); + DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_CAMERA_ERROR, std::string("operator stop capture failed")); return ret; } @@ -87,7 +87,7 @@ int32_t DCameraSinkController::StopCapture() if (ret != DCAMERA_OK) { DHLOGE("DCameraSinkController::StopCapture output stop capture failed, dhId: %s, ret: %d", GetAnonyString(dhId_).c_str(), ret); - DCameraNotifyInner(DCAMERA_MESSAGE, ret, std::string("output stop capture failed")); + DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_CAMERA_ERROR, std::string("output stop capture failed")); return ret; } @@ -309,11 +309,7 @@ void DCameraSinkController::OnStateChanged(std::shared_ptr& event) { DHLOGI("DCameraSinkController::OnStateChanged dhId: %s, result: %d", GetAnonyString(dhId_).c_str(), event->eventResult_); - if (event->eventResult_ == CamServiceError::) { - DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_DEVICE_PREEMPT, std::string("camera preempted")); - } else { - DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_CAMERA_ERROR, std::string("camera error")); - } + DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_CAMERA_ERROR, std::string("camera error")); } void DCameraSinkController::OnMetadataResult() @@ -391,7 +387,7 @@ int32_t DCameraSinkController::StartCaptureInner(std::vector Date: Thu, 16 Jun 2022 18:49:17 +0800 Subject: [PATCH 4/8] =?UTF-8?q?reviewbott=E5=91=8A=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp b/camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp index a2fe63c2..e173080f 100644 --- a/camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp +++ b/camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp @@ -746,7 +746,8 @@ DCamRetCode DStreamOperator::NegotiateSuitableCaptureInfo(const std::shared_ptr< return SUCCESS; } -void DStreamOperator::SetSrcStreamInfo(const std::shared_ptr& srcCaptureInfo, std::vector>& srcStreamInfo) +void DStreamOperator::SetSrcStreamInfo(const std::shared_ptr& srcCaptureInfo, + std::vector>& srcStreamInfo) { for (auto &id : srcCaptureInfo->streamIds_) { auto iter = dcStreamInfoMap_.find(id); -- Gitee From 7bb8e278a38bcd036c051441c58e516e6c89c573 Mon Sep 17 00:00:00 2001 From: wangchaole Date: Thu, 16 Jun 2022 18:50:35 +0800 Subject: [PATCH 5/8] =?UTF-8?q?reviewbott=E5=91=8A=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- .../hdi_impl/include/dstream_operator/dstream_operator.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/camera_hdf/hdi_impl/include/dstream_operator/dstream_operator.h b/camera_hdf/hdi_impl/include/dstream_operator/dstream_operator.h index efac1683..d2909a68 100644 --- a/camera_hdf/hdi_impl/include/dstream_operator/dstream_operator.h +++ b/camera_hdf/hdi_impl/include/dstream_operator/dstream_operator.h @@ -90,7 +90,8 @@ private: void ExtractStreamInfo(DCStreamInfo &dstStreamInfo, const std::shared_ptr &srcStreamInfo); void ExtractCaptureInfo(std::vector &captureInfos); void ExtractCameraAttr(Json::Value &rootValue, std::set &allFormats, std::vector &photoFormats); - void SetSrcStreamInfo(const std::shared_ptr& srcCaptureInfo, std::vector>& srcStreamInfo); + void SetSrcStreamInfo(const std::shared_ptr& srcCaptureInfo, + std::vector>& srcStreamInfo); private: std::shared_ptr dMetadataProcessor_; -- Gitee From 3ae299ee3d26eb62089b8607f7059565c276cf89 Mon Sep 17 00:00:00 2001 From: wangchaole Date: Fri, 17 Jun 2022 15:12:35 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E5=A4=84=E7=90=86reviewbot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- .../client/src/dcamera_client.cpp | 21 ++++++++++--------- .../client/src/dcamera_client_common.cpp | 21 ++++++++++--------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp b/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp index c66fccb0..751a9e52 100644 --- a/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp +++ b/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp @@ -200,17 +200,18 @@ int32_t DCameraClient::StopCapture() void DCameraClient::ReleasCaptureSession() { - if (captureSession_ != nullptr) { - DHLOGI("DCameraClient::StopCapture %s stop captureSession", GetAnonyString(cameraId_).c_str()); - int32_t ret = captureSession_->Stop(); - if (ret != DCAMERA_OK) { - DHLOGE("DCameraClient::StopCapture captureSession stop failed, cameraId: %s, ret: %d", - GetAnonyString(cameraId_).c_str(), ret); - } - DHLOGI("DCameraClient::StopCapture %s release captureSession", GetAnonyString(cameraId_).c_str()); - captureSession_->Release(); - captureSession_ = nullptr; + if (captureSession_ == nullptr) { + return; + } + DHLOGI("DCameraClient::StopCapture %s stop captureSession", GetAnonyString(cameraId_).c_str()); + int32_t ret = captureSession_->Stop(); + if (ret != DCAMERA_OK) { + DHLOGE("DCameraClient::StopCapture captureSession stop failed, cameraId: %s, ret: %d", + GetAnonyString(cameraId_).c_str(), ret); } + DHLOGI("DCameraClient::StopCapture %s release captureSession", GetAnonyString(cameraId_).c_str()); + captureSession_->Release(); + captureSession_ = nullptr; } int32_t DCameraClient::SetStateCallback(std::shared_ptr& callback) diff --git a/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp b/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp index 7f9b6fa9..c6ac44f0 100644 --- a/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp +++ b/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp @@ -186,17 +186,18 @@ int32_t DCameraClient::StopCapture() void DCameraClient::ReleasCaptureSession() { - if (captureSession_ != nullptr) { - DHLOGI("DCameraClientCommon::StopCapture %s stop captureSession", GetAnonyString(cameraId_).c_str()); - int32_t ret = captureSession_->Stop(); - if (ret != DCAMERA_OK) { - DHLOGE("DCameraClientCommon::StopCapture captureSession stop failed, cameraId: %s, ret: %d", - GetAnonyString(cameraId_).c_str(), ret); - } - DHLOGI("DCameraClientCommon::StopCapture %s release captureSession", GetAnonyString(cameraId_).c_str()); - captureSession_->Release(); - captureSession_ = nullptr; + if (captureSession_ == nullptr) { + return; + } + DHLOGI("DCameraClientCommon::StopCapture %s stop captureSession", GetAnonyString(cameraId_).c_str()); + int32_t ret = captureSession_->Stop(); + if (ret != DCAMERA_OK) { + DHLOGE("DCameraClientCommon::StopCapture captureSession stop failed, cameraId: %s, ret: %d", + GetAnonyString(cameraId_).c_str(), ret); } + DHLOGI("DCameraClientCommon::StopCapture %s release captureSession", GetAnonyString(cameraId_).c_str()); + captureSession_->Release(); + captureSession_ = nullptr; } int32_t DCameraClient::SetStateCallback(std::shared_ptr& callback) -- Gitee From 29f1275cee89255fbdc51294a33586c173bcee5c Mon Sep 17 00:00:00 2001 From: wangchaole Date: Fri, 17 Jun 2022 16:38:03 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E5=A4=84=E7=90=86reviewbot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- .../cameraservice/cameraoperator/client/src/dcamera_client.cpp | 2 +- .../cameraoperator/client/src/dcamera_client_common.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp b/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp index 751a9e52..e0fbeca4 100644 --- a/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp +++ b/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp @@ -207,7 +207,7 @@ void DCameraClient::ReleasCaptureSession() int32_t ret = captureSession_->Stop(); if (ret != DCAMERA_OK) { DHLOGE("DCameraClient::StopCapture captureSession stop failed, cameraId: %s, ret: %d", - GetAnonyString(cameraId_).c_str(), ret); + GetAnonyString(cameraId_).c_str(), ret); } DHLOGI("DCameraClient::StopCapture %s release captureSession", GetAnonyString(cameraId_).c_str()); captureSession_->Release(); diff --git a/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp b/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp index c6ac44f0..ada6857c 100644 --- a/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp +++ b/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp @@ -193,7 +193,7 @@ void DCameraClient::ReleasCaptureSession() int32_t ret = captureSession_->Stop(); if (ret != DCAMERA_OK) { DHLOGE("DCameraClientCommon::StopCapture captureSession stop failed, cameraId: %s, ret: %d", - GetAnonyString(cameraId_).c_str(), ret); + GetAnonyString(cameraId_).c_str(), ret); } DHLOGI("DCameraClientCommon::StopCapture %s release captureSession", GetAnonyString(cameraId_).c_str()); captureSession_->Release(); -- Gitee From 4c149ce7f7666b89b83762a9a829c4d06b474a0f Mon Sep 17 00:00:00 2001 From: wangchaole Date: Fri, 17 Jun 2022 16:48:39 +0800 Subject: [PATCH 8/8] reviewbot Signed-off-by: wangchaole --- .../cameraservice/cameraoperator/client/src/dcamera_client.cpp | 2 +- .../cameraoperator/client/src/dcamera_client_common.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp b/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp index e0fbeca4..80de4332 100644 --- a/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp +++ b/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp @@ -207,7 +207,7 @@ void DCameraClient::ReleasCaptureSession() int32_t ret = captureSession_->Stop(); if (ret != DCAMERA_OK) { DHLOGE("DCameraClient::StopCapture captureSession stop failed, cameraId: %s, ret: %d", - GetAnonyString(cameraId_).c_str(), ret); + GetAnonyString(cameraId_).c_str(), ret); } DHLOGI("DCameraClient::StopCapture %s release captureSession", GetAnonyString(cameraId_).c_str()); captureSession_->Release(); diff --git a/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp b/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp index ada6857c..2d6f0cb4 100644 --- a/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp +++ b/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp @@ -193,7 +193,7 @@ void DCameraClient::ReleasCaptureSession() int32_t ret = captureSession_->Stop(); if (ret != DCAMERA_OK) { DHLOGE("DCameraClientCommon::StopCapture captureSession stop failed, cameraId: %s, ret: %d", - GetAnonyString(cameraId_).c_str(), ret); + GetAnonyString(cameraId_).c_str(), ret); } DHLOGI("DCameraClientCommon::StopCapture %s release captureSession", GetAnonyString(cameraId_).c_str()); captureSession_->Release(); -- Gitee