diff --git a/common/src/utils/dcamera_utils_tools.cpp b/common/src/utils/dcamera_utils_tools.cpp index 3cf52726708dbdace700b9815d7f813a64212e76..5dc9e786b64e80c6b5793dc57a54bf0c23299579 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 4cac74bf2a3fed05780dc4e38a46cc50a86c0daf..89208432708323cb031597d7b4d87bb08f70ac07 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 cb4a59854aed3a702031d5220fb212ee2c57555a..aede9e753ae8e8c1cd46987fe618fa241d0101ef 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 bdd819c41827b8f50c9461945af9701dccac6a56..43cbccf63a53146ac788397c0e2a60ddd0aed823 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 8688b0bcb366d0ff31dd6e9ebecc3d2e4ab1912c..c77d22147017a71ad1cdd6b267c69668a23091e2 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 7e69dad63aca071f512bacb3565f808f951742ab..9a52710b77c4f9a994124dfacaf9885d514c0709 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 7ad8a4de572f2b35692744a5a76d45fed417a033..71ce88196e785d2e32cf24c45a2fbdefcedc14f0 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 79de79dc254f299b35a8b15f6ef8f8745bff501d..ecfb67dd5b739354077b57ff64657ebbc9497635 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 620db87f53852f685b24db275ea243371493f35e..366027be3300b9672f7dfb638b9b46512df2761d 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 31c8c4402ac149602df488e52a07c38f8876fa2a..e20d89000fec24dd53d2a494c2f85fae25c07ac2 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 dcd189a653648b37ea7dc20d416a4db96d6b2335..5400bb0fa0e2c7aa5a838776a2e37e13be5d7567 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 389bffd1443d93cbb65ea6dec183b397f38b209e..6c2e8663f763c55f12509bcdb1cdb6b5f92695ec 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 1e4afd47959f7c01b6c02f18fe1092818c0ee490..bdc42368a24cbd09e9af2a849f7866f81f1d79bf 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 d772283350660f55b2d1aa3e36edb504ae172291..93d735da1dce01e9719bf238829721b74390a04b 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 96a4be39e4b364958a41426c39cacbd01324ec06..36b3944f5e2ff903756563258bb1edc2d7ab4dea 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 d3c4f23741ca7aa5d7bbbbd0f1c65db77a089d5f..5a0b5a20639f53b2a47b3ae4892a27ce0c409453 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 818cf703ee77d6e124d8cb9f406f85f16cc52fb5..719fe705a7b58bd8c68579611a216abe011015b2 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 004d954b4e5c8a83660c8e968ce0818f26224419..1c4ef0d533695e16602ed1d5aa81232c9029ffd0 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 8bfd2ba2f0d68e4c6f148a36a93063bfd8d70238..34d9da5a1b8aea2dcf7a3f661c057d25b029e5d0 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 8e79e671df615fbbcbda03ea0fe5b84741acdfc5..0d3ebf17267e5d75bc03e3cd956e42dbba8c81e0 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 52d923f7dbe599b39f06254293ad1da3d12f31a3..006c997bfb4bc3cae0cb758f4faa9bfbabab3454 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) {