From 89bd1e7e0bbbdd77a271dec191f9c5356cb223b4 Mon Sep 17 00:00:00 2001 From: byndyx Date: Tue, 19 Mar 2024 21:42:58 +0800 Subject: [PATCH] modify warn Signed-off-by: byndyx --- common/src/utils/dcamera_utils_tools.cpp | 3 +- .../src/callback/dcamera_sink_callback.cpp | 2 +- .../src/distributed_camera_sink_proxy.cpp | 1 + .../src/distributed_camera_source_proxy.cpp | 1 + .../base/src/dcamera_metadata_setting_cmd.cpp | 6 ++-- .../dcamera_sink_controller.h | 4 +-- .../dcamera_sink_service_ipc.cpp | 4 +++ .../dcamera_source_service_ipc.cpp | 4 +++ .../base/ifeeding_smoother.cpp | 1 + .../base/time_statistician.cpp | 1 + .../derived/dcamera_feeding_smoother.cpp | 1 + .../derived/dcamera_time_statistician.cpp | 2 ++ .../channel/include/dcamera_softbus_adapter.h | 2 +- .../src/dcamera_channel_source_impl.cpp | 30 +++++++++++-------- .../channel/src/dcamera_softbus_adapter.cpp | 4 ++- .../channel/src/dcamera_softbus_session.cpp | 8 +++-- .../src/pipeline/dcamera_pipeline_source.cpp | 1 + .../fpscontroller/fps_controller_process.cpp | 1 + .../decoder/decode_data_process.cpp | 1 + .../encoder/encode_data_process.cpp | 3 ++ .../scale_convert_process.cpp | 1 + 21 files changed, 58 insertions(+), 23 deletions(-) diff --git a/common/src/utils/dcamera_utils_tools.cpp b/common/src/utils/dcamera_utils_tools.cpp index 3cf52726..5dc9e786 100644 --- a/common/src/utils/dcamera_utils_tools.cpp +++ b/common/src/utils/dcamera_utils_tools.cpp @@ -97,12 +97,11 @@ std::string Base64Encode(const unsigned char *toEncode, unsigned int len) DHLOGE("toEncode is null or len is zero."); return ret; } - int32_t length = len; uint32_t i = 0; unsigned char charArray3[3]; unsigned char charArray4[4]; - while (length--) { + while (len--) { charArray3[i++] = *(toEncode++); if (i == sizeof(charArray3)) { charArray4[INDEX_FIRST] = (charArray3[INDEX_FIRST] & PARAM_FC) >> OFFSET2; diff --git a/interfaces/inner_kits/native_cpp/camera_sink/src/callback/dcamera_sink_callback.cpp b/interfaces/inner_kits/native_cpp/camera_sink/src/callback/dcamera_sink_callback.cpp index 4cac74bf..89208432 100644 --- a/interfaces/inner_kits/native_cpp/camera_sink/src/callback/dcamera_sink_callback.cpp +++ b/interfaces/inner_kits/native_cpp/camera_sink/src/callback/dcamera_sink_callback.cpp @@ -35,7 +35,7 @@ int32_t DCameraSinkCallback::OnNotifyResourceInfo(const ResourceEventType &type, int32_t ret = DCAMERA_OK; std::lock_guard lock(privacyResMutex_); auto iter = privacyResCallback_.begin(); - if (iter != privacyResCallback_.end()) { + if (iter != privacyResCallback_.end() && (*iter) != nullptr) { ret = (*iter)->OnPrivaceResourceMessage(type, subtype, networkId, isSensitive, isSameAccout); } return ret; diff --git a/interfaces/inner_kits/native_cpp/camera_sink/src/distributed_camera_sink_proxy.cpp b/interfaces/inner_kits/native_cpp/camera_sink/src/distributed_camera_sink_proxy.cpp index cb4a5985..aede9e75 100644 --- a/interfaces/inner_kits/native_cpp/camera_sink/src/distributed_camera_sink_proxy.cpp +++ b/interfaces/inner_kits/native_cpp/camera_sink/src/distributed_camera_sink_proxy.cpp @@ -26,6 +26,7 @@ namespace OHOS { namespace DistributedHardware { int32_t DistributedCameraSinkProxy::InitSink(const std::string& params, const sptr &sinkCallback) { + CHECK_AND_RETURN_RET_LOG(sinkCallback == nullptr, DCAMERA_BAD_VALUE, "sinkCallback is nullptr"); DHLOGI("start"); if (params.empty() || params.size() > PARAM_MAX_SIZE) { DHLOGE("params is invalid"); diff --git a/interfaces/inner_kits/native_cpp/camera_source/src/distributed_camera_source_proxy.cpp b/interfaces/inner_kits/native_cpp/camera_source/src/distributed_camera_source_proxy.cpp index bdd819c4..43cbccf6 100644 --- a/interfaces/inner_kits/native_cpp/camera_source/src/distributed_camera_source_proxy.cpp +++ b/interfaces/inner_kits/native_cpp/camera_source/src/distributed_camera_source_proxy.cpp @@ -28,6 +28,7 @@ namespace DistributedHardware { int32_t DistributedCameraSourceProxy::InitSource(const std::string& params, const sptr& callback) { + CHECK_AND_RETURN_RET_LOG(callback == nullptr, DCAMERA_BAD_VALUE, "callback is nullptr"); DHLOGI("start"); if (params.empty() || params.size() > PARAM_MAX_SIZE) { DHLOGE("params is invalid"); diff --git a/services/cameraservice/base/src/dcamera_metadata_setting_cmd.cpp b/services/cameraservice/base/src/dcamera_metadata_setting_cmd.cpp index 8688b0bc..c77d2214 100644 --- a/services/cameraservice/base/src/dcamera_metadata_setting_cmd.cpp +++ b/services/cameraservice/base/src/dcamera_metadata_setting_cmd.cpp @@ -44,8 +44,10 @@ int32_t DCameraMetadataSettingCmd::Marshal(std::string& jsonStr) cJSON_Delete(rootValue); return DCAMERA_BAD_VALUE; } - cJSON_AddNumberToObject(setting, "SettingType", (*iter)->type_); - cJSON_AddStringToObject(setting, "SettingValue", (*iter)->value_.c_str()); + if ((*iter) != nullptr) { + cJSON_AddNumberToObject(setting, "SettingType", (*iter)->type_); + cJSON_AddStringToObject(setting, "SettingValue", (*iter)->value_.c_str()); + } cJSON_AddItemToArray(settings, setting); } diff --git a/services/cameraservice/sinkservice/include/distributedcameramgr/dcamera_sink_controller.h b/services/cameraservice/sinkservice/include/distributedcameramgr/dcamera_sink_controller.h index 7e69dad6..9a52710b 100644 --- a/services/cameraservice/sinkservice/include/distributedcameramgr/dcamera_sink_controller.h +++ b/services/cameraservice/sinkservice/include/distributedcameramgr/dcamera_sink_controller.h @@ -93,8 +93,8 @@ private: sptr sinkCallback_; std::atomic isPageStatus_ = false; std::shared_ptr initCallback_; - bool isSensitive_; - bool isSameAccount_; + bool isSensitive_ = false; + bool isSameAccount_ = false; const std::string SESSION_FLAG = "control"; const std::string SRC_TYPE = "camera"; diff --git a/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_service_ipc.cpp b/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_service_ipc.cpp index 7ad8a4de..71ce8819 100644 --- a/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_service_ipc.cpp +++ b/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_service_ipc.cpp @@ -160,6 +160,10 @@ void DCameraSinkServiceIpc::OnSourceRemoteCamSrvDied(const wptr& } auto iter = std::find_if(remoteSources_.begin(), remoteSources_.end(), [&]( const std::pair> &item)->bool { + if (item.second == nullptr || item.second->AsObject() == nullptr) { + DHLOGE("item.second or item.second->AsObject() is nullptr"); + return false; + } return item.second->AsObject() == diedRemoted; }); if (iter == remoteSources_.end()) { diff --git a/services/cameraservice/sourceservice/src/distributedcameramgr/dcamera_source_service_ipc.cpp b/services/cameraservice/sourceservice/src/distributedcameramgr/dcamera_source_service_ipc.cpp index 79de79dc..ecfb67dd 100644 --- a/services/cameraservice/sourceservice/src/distributedcameramgr/dcamera_source_service_ipc.cpp +++ b/services/cameraservice/sourceservice/src/distributedcameramgr/dcamera_source_service_ipc.cpp @@ -160,6 +160,10 @@ void DCameraSourceServiceIpc::OnSinkRemoteCamSrvDied(const wptr& } auto iter = std::find_if(remoteSinks_.begin(), remoteSinks_.end(), [&]( const std::pair> &item)->bool { + if (item.second == nullptr || item.second->AsObject() == nullptr) { + DHLOGE("item.second or item.second->AsObject() is nullptr"); + return false; + } return item.second->AsObject() == diedRemoted; }); if (iter == remoteSinks_.end()) { diff --git a/services/cameraservice/sourceservice/src/distributedcameramgr/dcameradata/feedingsmoother/base/ifeeding_smoother.cpp b/services/cameraservice/sourceservice/src/distributedcameramgr/dcameradata/feedingsmoother/base/ifeeding_smoother.cpp index 620db87f..366027be 100644 --- a/services/cameraservice/sourceservice/src/distributedcameramgr/dcameradata/feedingsmoother/base/ifeeding_smoother.cpp +++ b/services/cameraservice/sourceservice/src/distributedcameramgr/dcameradata/feedingsmoother/base/ifeeding_smoother.cpp @@ -95,6 +95,7 @@ void IFeedingSmoother::LooperSmooth() void IFeedingSmoother::SmoothFeeding(const std::shared_ptr& data) { + CHECK_AND_RETURN_LOG(data == nullptr, "data is nullptr"); int64_t enterTime = GetNowTimeStampUs(); SetClockTime(enterTime); int64_t timeStamp = data->GetTimeStamp(); diff --git a/services/cameraservice/sourceservice/src/distributedcameramgr/dcameradata/feedingsmoother/base/time_statistician.cpp b/services/cameraservice/sourceservice/src/distributedcameramgr/dcameradata/feedingsmoother/base/time_statistician.cpp index 31c8c440..e20d8900 100644 --- a/services/cameraservice/sourceservice/src/distributedcameramgr/dcameradata/feedingsmoother/base/time_statistician.cpp +++ b/services/cameraservice/sourceservice/src/distributedcameramgr/dcameradata/feedingsmoother/base/time_statistician.cpp @@ -20,6 +20,7 @@ namespace OHOS { namespace DistributedHardware { void TimeStatistician::CalProcessTime(const std::shared_ptr& data) { + CHECK_AND_RETURN_LOG(data == nullptr, "data is nullptr"); int64_t feedTime = GetNowTimeStampUs(); int64_t timeStamp = data->GetTimeStamp(); CalAverFeedInterval(feedTime); diff --git a/services/cameraservice/sourceservice/src/distributedcameramgr/dcameradata/feedingsmoother/derived/dcamera_feeding_smoother.cpp b/services/cameraservice/sourceservice/src/distributedcameramgr/dcameradata/feedingsmoother/derived/dcamera_feeding_smoother.cpp index dcd189a6..5400bb0f 100644 --- a/services/cameraservice/sourceservice/src/distributedcameramgr/dcameradata/feedingsmoother/derived/dcamera_feeding_smoother.cpp +++ b/services/cameraservice/sourceservice/src/distributedcameramgr/dcameradata/feedingsmoother/derived/dcamera_feeding_smoother.cpp @@ -51,6 +51,7 @@ int32_t DCameraFeedingSmoother::NotifySmoothFinished(const std::shared_ptr buffer = std::reinterpret_pointer_cast(data); + CHECK_AND_RETURN_RET_LOG(buffer == nullptr, NOTIFY_FAILED, "The buffer is nullptr"); buffer->frameInfo_.timePonit.finishSmooth = finishSmoothT; dCameraStatistician_->CalWholeProcessTime(buffer); if (listener_ == nullptr) { diff --git a/services/cameraservice/sourceservice/src/distributedcameramgr/dcameradata/feedingsmoother/derived/dcamera_time_statistician.cpp b/services/cameraservice/sourceservice/src/distributedcameramgr/dcameradata/feedingsmoother/derived/dcamera_time_statistician.cpp index 389bffd1..6c2e8663 100644 --- a/services/cameraservice/sourceservice/src/distributedcameramgr/dcameradata/feedingsmoother/derived/dcamera_time_statistician.cpp +++ b/services/cameraservice/sourceservice/src/distributedcameramgr/dcameradata/feedingsmoother/derived/dcamera_time_statistician.cpp @@ -23,6 +23,7 @@ void DCameraTimeStatistician::CalProcessTime(const std::shared_ptr dataBuffer = std::reinterpret_pointer_cast(data); + CHECK_AND_RETURN_LOG(dataBuffer == nullptr, "The dataBuffer is nullptr"); DCameraFrameInfo frameInfo = dataBuffer->frameInfo_; int64_t encode = frameInfo.timePonit.finishEncode - frameInfo.timePonit.startEncode; int64_t trans = frameInfo.timePonit.recv - frameInfo.timePonit.send + frameInfo.offset; @@ -48,6 +49,7 @@ void DCameraTimeStatistician::CalProcessTime(const std::shared_ptr& data) { + CHECK_AND_RETURN_LOG(data == nullptr, "The data is nullptr"); DCameraFrameInfo frameInfo = data->frameInfo_; int64_t smooth = frameInfo.timePonit.finishSmooth - frameInfo.timePonit.startSmooth; int64_t sink = frameInfo.timePonit.send - frameInfo.timePonit.startEncode; diff --git a/services/channel/include/dcamera_softbus_adapter.h b/services/channel/include/dcamera_softbus_adapter.h index 1e4afd47..bdc42368 100644 --- a/services/channel/include/dcamera_softbus_adapter.h +++ b/services/channel/include/dcamera_softbus_adapter.h @@ -92,7 +92,7 @@ private: std::mutex idMapLock_; std::map> sessionIdMap_; - int32_t sourceSocketId_; + int32_t sourceSocketId_ = 0; std::map sessionModeAndDataTypeMap_; std::mutex mySessionNamePeerDevIdLock_; std::map peerDevIdMySessionNameMap_; diff --git a/services/channel/src/dcamera_channel_source_impl.cpp b/services/channel/src/dcamera_channel_source_impl.cpp index d7722833..93d735da 100644 --- a/services/channel/src/dcamera_channel_source_impl.cpp +++ b/services/channel/src/dcamera_channel_source_impl.cpp @@ -41,11 +41,13 @@ int32_t DCameraChannelSourceImpl::CloseSession() } int32_t ret = DCAMERA_OK; for (auto iter = softbusSessions_.begin(); iter != softbusSessions_.end(); iter++) { - int32_t retOpen = (*iter)->CloseSession(); - if (retOpen != DCAMERA_OK) { - DHLOGE("DCameraChannelSourceImpl CloseSession %{public}s failed, ret: %{public}d", - GetAnonyString(mySessionName_).c_str(), retOpen); - ret = DCAMERA_BAD_OPERATE; + if ((*iter) != nullptr) { + int32_t retOpen = (*iter)->CloseSession(); + if (retOpen != DCAMERA_OK) { + DHLOGE("DCameraChannelSourceImpl CloseSession %{public}s failed, ret: %{public}d", + GetAnonyString(mySessionName_).c_str(), retOpen); + ret = DCAMERA_BAD_OPERATE; + } } } @@ -96,8 +98,10 @@ int32_t DCameraChannelSourceImpl::ReleaseSession() { DHLOGI("DCameraChannelSourceImpl ReleaseSession name: %{public}s", GetAnonyString(mySessionName_).c_str()); for (auto iter = softbusSessions_.begin(); iter != softbusSessions_.end(); iter++) { - std::string sessKey = (*iter)->GetPeerDevId() + (*iter)->GetPeerSessionName(); - DCameraSoftbusAdapter::GetInstance().sourceSessions_.erase(sessKey); + if ((*iter) != nullptr) { + std::string sessKey = (*iter)->GetPeerDevId() + (*iter)->GetPeerSessionName(); + DCameraSoftbusAdapter::GetInstance().sourceSessions_.erase(sessKey); + } } std::vector>().swap(softbusSessions_); int32_t ret = DCameraSoftbusAdapter::GetInstance().DestroySoftbusSessionServer(mySessionName_); @@ -116,11 +120,13 @@ int32_t DCameraChannelSourceImpl::SendData(std::shared_ptr& buffer) } int32_t ret = DCAMERA_OK; for (auto iter = softbusSessions_.begin(); iter != softbusSessions_.end(); iter++) { - int32_t retSend = (*iter)->SendData(mode_, buffer); - if (retSend != DCAMERA_OK) { - DHLOGE("DCameraChannelSourceImpl SendData %{public}s failed, ret: %{public}d", - GetAnonyString(mySessionName_).c_str(), retSend); - ret = DCAMERA_BAD_OPERATE; + if ((*iter) != nullptr) { + int32_t retSend = (*iter)->SendData(mode_, buffer); + if (retSend != DCAMERA_OK) { + DHLOGE("DCameraChannelSourceImpl SendData %{public}s failed, ret: %{public}d", + GetAnonyString(mySessionName_).c_str(), retSend); + ret = DCAMERA_BAD_OPERATE; + } } } return ret; diff --git a/services/channel/src/dcamera_softbus_adapter.cpp b/services/channel/src/dcamera_softbus_adapter.cpp index 96a4be39..36b3944f 100644 --- a/services/channel/src/dcamera_softbus_adapter.cpp +++ b/services/channel/src/dcamera_softbus_adapter.cpp @@ -239,11 +239,13 @@ int32_t DCameraSoftbusAdapter::CloseSoftbusSession(int32_t socket) int32_t DCameraSoftbusAdapter::SendSofbusBytes(int32_t socket, std::shared_ptr& buffer) { + CHECK_AND_RETURN_RET_LOG(buffer == nullptr, DCAMERA_BAD_VALUE, "The buffer is nullptr"); return SendBytes(socket, buffer->Data(), buffer->Size()); } int32_t DCameraSoftbusAdapter::SendSofbusStream(int32_t socket, std::shared_ptr& buffer) { + CHECK_AND_RETURN_RET_LOG(buffer == nullptr, DCAMERA_BAD_VALUE, "The buffer is nullptr"); StreamData streamData = { reinterpret_cast(buffer->Data()), buffer->Size() }; int64_t timeStamp; if (!buffer->FindInt64(TIME_STAMP_US, timeStamp)) { @@ -302,7 +304,7 @@ int32_t DCameraSoftbusAdapter::DCameraSoftbusSourceGetSession(int32_t socket, std::shared_ptr& session) { std::lock_guard autoLock(sourceSocketLock_); - auto iter = sourceSocketSessionMap_.find(socket); + auto iter = sourceSocketSessionMap_.find(socket); if (iter == sourceSocketSessionMap_.end()) { DHLOGE("source can not find current socket %{public}d", socket); return DCAMERA_NOT_FOUND; diff --git a/services/channel/src/dcamera_softbus_session.cpp b/services/channel/src/dcamera_softbus_session.cpp index d3c4f237..5a0b5a20 100644 --- a/services/channel/src/dcamera_softbus_session.cpp +++ b/services/channel/src/dcamera_softbus_session.cpp @@ -125,6 +125,7 @@ void DCameraSoftbusSession::DealRecvData(std::shared_ptr& buffer) void DCameraSoftbusSession::PackRecvData(std::shared_ptr& buffer) { + CHECK_AND_RETURN_RET_LOG(buffer == nullptr, DCAMERA_BAD_VALUE, "The buffer is nullptr"); uint64_t bufferSize; if (buffer->Size() < BINARY_HEADER_FRAG_LEN) { bufferSize = static_cast(buffer->Size()); @@ -158,6 +159,7 @@ void DCameraSoftbusSession::PackRecvData(std::shared_ptr& buffer) void DCameraSoftbusSession::AssembleNoFrag(std::shared_ptr& buffer, SessionDataHeader& headerPara) { + CHECK_AND_RETURN_LOG(buffer == nullptr, DCAMERA_BAD_VALUE, "The buffer is nullptr"); if (headerPara.dataLen != headerPara.totalLen) { DHLOGE("DCameraSoftbusSession PackRecvData failed, dataLen: %{public}d, totalLen: %{public}d, sess: " "%{public}s peerSess: %{public}s", headerPara.dataLen, headerPara.totalLen, mySessionName_.c_str(), @@ -177,6 +179,7 @@ void DCameraSoftbusSession::AssembleNoFrag(std::shared_ptr& buffer, void DCameraSoftbusSession::AssembleFrag(std::shared_ptr& buffer, SessionDataHeader& headerPara) { + CHECK_AND_RETURN_RET_LOG(buffer == nullptr, DCAMERA_BAD_VALUE, "The buffer is nullptr"); if (headerPara.fragFlag == FRAG_START) { isWaiting_ = true; nowSeq_ = headerPara.seqNum; @@ -305,6 +308,7 @@ int32_t DCameraSoftbusSession::SendData(DCameraSessionMode mode, std::shared_ptr int32_t DCameraSoftbusSession::UnPackSendData(std::shared_ptr& buffer, DCameraSendFuc memberFunc) { + CHECK_AND_RETURN_RET_LOG(buffer == nullptr, DCAMERA_BAD_VALUE, "The buffer is nullptr"); uint16_t subSeq = 0; uint32_t seq = 0; uint32_t totalLen = buffer->Size(); @@ -324,10 +328,9 @@ int32_t DCameraSoftbusSession::UnPackSendData(std::shared_ptr& buffe return (this->*memberFunc)(unpackData); } uint32_t offset = 0; - uint64_t bufferSize; while (totalLen > offset) { SetHeadParaDataLen(headPara, totalLen, offset); - bufferSize = static_cast(buffer->Size()); + uint64_t bufferSize = static_cast(buffer->Size()); DHLOGD("DCameraSoftbusSession UnPackSendData, size: %" PRIu64", dataLen: %{public}d, totalLen: %{public}d, " "nowTime: %{public}" PRId64" start:", bufferSize, headPara.dataLen, headPara.totalLen, GetNowTimeStampUs()); std::shared_ptr unpackData = @@ -346,6 +349,7 @@ int32_t DCameraSoftbusSession::UnPackSendData(std::shared_ptr& buffe ret, mySessionName_.c_str(), peerSessionName_.c_str()); return ret; } + bufferSize = static_cast(buffer->Size()); DHLOGD("DCameraSoftbusSession UnPackSendData, size: %" PRIu64", dataLen: %{public}d, totalLen: %{public}d, " "nowTime: %{public}" PRId64" end:", bufferSize, headPara.dataLen, headPara.totalLen, GetNowTimeStampUs()); headPara.subSeq++; diff --git a/services/data_process/src/pipeline/dcamera_pipeline_source.cpp b/services/data_process/src/pipeline/dcamera_pipeline_source.cpp index 818cf703..719fe705 100644 --- a/services/data_process/src/pipeline/dcamera_pipeline_source.cpp +++ b/services/data_process/src/pipeline/dcamera_pipeline_source.cpp @@ -201,6 +201,7 @@ void DCameraPipelineSource::OnEvent(DCameraPipelineEvent& ev) OnError(ERROR_PIPELINE_EVENTBUS); return; } + CHECK_AND_RETURN_LOG(pipelineHead_ == nullptr, "pipelineHead_"); pipelineHead_->ProcessData(inputBuffers); } diff --git a/services/data_process/src/pipeline_node/fpscontroller/fps_controller_process.cpp b/services/data_process/src/pipeline_node/fpscontroller/fps_controller_process.cpp index 004d954b..1c4ef0d5 100644 --- a/services/data_process/src/pipeline_node/fpscontroller/fps_controller_process.cpp +++ b/services/data_process/src/pipeline_node/fpscontroller/fps_controller_process.cpp @@ -82,6 +82,7 @@ int32_t FpsControllerProcess::ProcessData(std::vectorFindInt64("timeUs", timeStampUs)) { DHLOGE("Find decoder output timestamp failed."); return DCAMERA_BAD_TYPE; diff --git a/services/data_process/src/pipeline_node/multimedia_codec/decoder/decode_data_process.cpp b/services/data_process/src/pipeline_node/multimedia_codec/decoder/decode_data_process.cpp index 8bfd2ba2..34d9da5a 100644 --- a/services/data_process/src/pipeline_node/multimedia_codec/decoder/decode_data_process.cpp +++ b/services/data_process/src/pipeline_node/multimedia_codec/decoder/decode_data_process.cpp @@ -349,6 +349,7 @@ int32_t DecodeDataProcess::ProcessData(std::vector>& DHLOGE("video decoder input buffers queue over flow."); return DCAMERA_INDEX_OVERFLOW; } + CHECK_AND_RETURN_RET_LOG(inputBuffers[0] == nullptr, DCAMERA_BAD_TYPE, "The inputBuffers[0] is nullptr"); if (inputBuffers[0]->Size() > MAX_YUV420_BUFFER_SIZE) { DHLOGE("DecodeNode input buffer size %{public}zu error.", inputBuffers[0]->Size()); return DCAMERA_MEMORY_OPT_ERROR; diff --git a/services/data_process/src/pipeline_node/multimedia_codec/encoder/encode_data_process.cpp b/services/data_process/src/pipeline_node/multimedia_codec/encoder/encode_data_process.cpp index 8e79e671..0d3ebf17 100644 --- a/services/data_process/src/pipeline_node/multimedia_codec/encoder/encode_data_process.cpp +++ b/services/data_process/src/pipeline_node/multimedia_codec/encoder/encode_data_process.cpp @@ -331,6 +331,7 @@ int32_t EncodeDataProcess::ProcessData(std::vector>& DHLOGE("The video encoder does not exist before encoding data."); return DCAMERA_INIT_ERR; } + CHECK_AND_RETURN_RET_LOG(inputBuffers[0] == nullptr, DCAMERA_BAD_TYPE, "The inputBuffers[0] is nullptr"); if (inputBuffers[0]->Size() > NORM_YUV420_BUFFER_SIZE) { DHLOGE("EncodeNode input buffer size %{public}zu error.", inputBuffers[0]->Size()); return DCAMERA_MEMORY_OPT_ERROR; @@ -344,6 +345,7 @@ int32_t EncodeDataProcess::ProcessData(std::vector>& int32_t EncodeDataProcess::FeedEncoderInputBuffer(std::shared_ptr& inputBuffer) { + CHECK_AND_RETURN_RET_LOG(inputBuffer == nullptr, DCAMERA_BAD_TYPE, "The inputBuffer is nullptr"); std::lock_guard lck(mtxEncoderState_); DHLOGD("Feed encoder input buffer, buffer size %{public}zu.", inputBuffer->Size()); CHECK_AND_RETURN_RET_LOG(encodeProducerSurface_ == nullptr, DCAMERA_INIT_ERR, "%{public}s", @@ -365,6 +367,7 @@ int32_t EncodeDataProcess::FeedEncoderInputBuffer(std::shared_ptr& i inputTimeStampUs_ = GetEncoderTimeStamp(); DHLOGD("Encoder input buffer size %{public}zu, timeStamp %{public}lld.", inputBuffer->Size(), (long long)inputTimeStampUs_); + CHECK_AND_RETURN_RET_LOG(surfacebuffer->GetExtraData() == nullptr, DCAMERA_BAD_TYPE, "The GetExtraData is nullptr"); surfacebuffer->GetExtraData()->ExtraSet("timeStamp", inputTimeStampUs_); BufferFlushConfig flushConfig = { {0, 0, sourceConfig_.GetWidth(), sourceConfig_.GetHeight()}, 0}; diff --git a/services/data_process/src/pipeline_node/scale_conversion/scale_convert_process.cpp b/services/data_process/src/pipeline_node/scale_conversion/scale_convert_process.cpp index 52d923f7..006c997b 100644 --- a/services/data_process/src/pipeline_node/scale_conversion/scale_convert_process.cpp +++ b/services/data_process/src/pipeline_node/scale_conversion/scale_convert_process.cpp @@ -393,6 +393,7 @@ int32_t ScaleConvertProcess::ConvertDone(std::vector DHLOGE("The received data buffer is empty."); return DCAMERA_BAD_VALUE; } + CHECK_AND_RETURN_RET_LOG(outputBuffers[0] == nullptr, DCAMERA_BAD_TYPE, "The outputBuffers[0] is nullptr"); outputBuffers[0]->frameInfo_.timePonit.finishScale = finishScaleTime; if (nextDataProcess_ != nullptr) { -- Gitee