From 8720245aac3d92006438352927a3eea906f8c87e Mon Sep 17 00:00:00 2001 From: wangchaole Date: Tue, 22 Mar 2022 17:37:17 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=8B=8D=E7=85=A7?= =?UTF-8?q?=E6=B5=81=E4=B8=8A=E6=8A=A5=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- .../src/dstream_operator/dstream_operator.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 21af8d76..2ae88bec 100644 --- a/camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp +++ b/camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp @@ -492,6 +492,21 @@ DCamRetCode DStreamOperator::ShutterBuffer(int streamId, const std::shared_ptrsecond->type_ == DCStreamType::SNAPSHOT_FRAME) { + std::vector> info; + std::shared_ptr tmp = std::make_shared(); + tmp->frameCount_ = acceptedBufferNum_[std::make_pair(captureId, streamId)]; + tmp->streamId_ = streamId; + info.push_back(tmp); + if (dcStreamOperatorCallback_) { + dcStreamOperatorCallback_->OnCaptureEnded(captureId, info); + DHLOGD("snapshot stream successfully reported captureId = %d streamId = %d.", captureId, streamId); + } + } + } } uint64_t resultTimestamp = GetCurrentLocalTimeStamp(); -- Gitee From ae8eda90bdb607110ab77dd6febef52bf0f6fc63 Mon Sep 17 00:00:00 2001 From: wangchaole Date: Tue, 22 Mar 2022 20:21:47 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=8B=8D=E7=85=A7?= =?UTF-8?q?=E6=B5=81=E4=B8=8A=E6=8A=A5=E5=8A=9F=E8=83=BD?= 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 2ae88bec..edcd7f94 100644 --- a/camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp +++ b/camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp @@ -494,8 +494,8 @@ DCamRetCode DStreamOperator::ShutterBuffer(int streamId, const std::shared_ptrsecond->type_ == DCStreamType::SNAPSHOT_FRAME) { + if (dcStreamInfo != dcStreamInfoMap_.end()) { + if (dcStreamInfo->second->type_ == DCStreamType::SNAPSHOT_FRAME) { std::vector> info; std::shared_ptr tmp = std::make_shared(); tmp->frameCount_ = acceptedBufferNum_[std::make_pair(captureId, streamId)]; -- Gitee From 7b5d4bbc4f2d5f707f01511e27e235b667a17a64 Mon Sep 17 00:00:00 2001 From: wangchaole Date: Wed, 23 Mar 2022 09:39:02 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=8B=8D=E7=85=A7?= =?UTF-8?q?=E6=B5=81=E4=B8=8A=E6=8A=A5=E5=8A=9F=E8=83=BD?= 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 | 36 +++++++++++-------- 2 files changed, 23 insertions(+), 14 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 3885d503..229a9f21 100644 --- a/camera_hdf/hdi_impl/include/dstream_operator/dstream_operator.h +++ b/camera_hdf/hdi_impl/include/dstream_operator/dstream_operator.h @@ -64,6 +64,7 @@ public: DCamRetCode SetCallBack(OHOS::sptr const &callback); DCamRetCode SetDeviceCallback(function &errorCbk, function)> &resultCbk); + void SnapShotStreamOnCaptureEnded(int32_t captureId, int streamId); void Release(); private: 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 edcd7f94..aa9a0d32 100644 --- a/camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp +++ b/camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp @@ -493,20 +493,7 @@ DCamRetCode DStreamOperator::ShutterBuffer(int streamId, const std::shared_ptrsecond->type_ == DCStreamType::SNAPSHOT_FRAME) { - std::vector> info; - std::shared_ptr tmp = std::make_shared(); - tmp->frameCount_ = acceptedBufferNum_[std::make_pair(captureId, streamId)]; - tmp->streamId_ = streamId; - info.push_back(tmp); - if (dcStreamOperatorCallback_) { - dcStreamOperatorCallback_->OnCaptureEnded(captureId, info); - DHLOGD("snapshot stream successfully reported captureId = %d streamId = %d.", captureId, streamId); - } - } - } + SnapShotStreamOnCaptureEnded(captureId, streamId); } uint64_t resultTimestamp = GetCurrentLocalTimeStamp(); @@ -549,6 +536,27 @@ DCamRetCode DStreamOperator::SetDeviceCallback( return SUCCESS; } +void DStreamOperator::SnapShotStreamOnCaptureEnded(int32_t captureId, int streamId) +{ + auto dcStreamInfo = dcStreamInfoMap_.find(streamId); + if (dcStreamInfo == dcStreamInfoMap_.end()) { + return; + } + if (dcStreamInfo->second->type_ != DCStreamType::SNAPSHOT_FRAME) { + return; + } + if (dcStreamOperatorCallback_ == nullptr) { + return; + } + std::vector> info; + std::shared_ptr tmp = std::make_shared(); + tmp->frameCount_ = acceptedBufferNum_[std::make_pair(captureId, streamId)]; + tmp->streamId_ = streamId; + info.push_back(tmp); + dcStreamOperatorCallback_->OnCaptureEnded(captureId, info); + DHLOGD("snapshot stream successfully reported captureId = %d streamId = %d.", captureId, streamId); +} + void DStreamOperator::Release() { DHLOGI("DStreamOperator::Release, begin release stream operator."); -- Gitee