From c3421126e20ce140a5fb6b989c89e1d7a8885584 Mon Sep 17 00:00:00 2001 From: Tome Date: Mon, 14 Jul 2025 20:22:37 +0800 Subject: [PATCH] =?UTF-8?q?FUZZ=E3=80=81UT=E3=80=81=E6=95=8F=E6=84=9F?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=89=93=E5=8D=B0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tome --- common/src/utils/dcamera_utils_tools.cpp | 2 +- .../onsinklocalcamsrvdied_fuzzer.cpp | 3 +++ .../sinkonloadsystemabilitysuccess_fuzzer.cpp | 3 +++ .../sinkproxychannelneg_fuzzer.cpp | 3 +++ .../sinkproxyclosechannel_fuzzer.cpp | 3 +++ .../sinkproxygetcamerainfo_fuzzer.cpp | 3 +++ .../sinkproxyinitsink_fuzzer/sinkproxyinitsink_fuzzer.cpp | 3 +++ .../sinkproxyopenchannel_fuzzer.cpp | 3 +++ .../sinkproxyreleasesink_fuzzer.cpp | 3 +++ .../sinkproxystopcapture_fuzzer.cpp | 3 +++ .../sinkproxysubscribelocalhardware_fuzzer.cpp | 3 +++ .../sinkproxyunsubscribelocalhardware_fuzzer.cpp | 3 +++ .../onsourcelocalcamsrvdied_fuzzer.cpp | 3 +++ .../sourceproxydcameranotify_fuzzer.cpp | 3 +++ .../sourceproxyinitsource_fuzzer.cpp | 3 +++ .../sourceproxyregisterdistributedhardware_fuzzer.cpp | 3 +++ .../sourceproxyunregisterdistributedhardware_fuzzer.cpp | 3 +++ .../common/camera_sink/dcamera_sink_handler_ipc_test.cpp | 1 + .../common/camera_sink/dcamera_sink_handler_test.cpp | 1 + .../camera_source/dcamera_source_handler_ipc_test.cpp | 1 + .../common/camera_source/dcamera_source_handler_test.cpp | 1 + .../distributedcamera/dcamera_sink_callback_proxy_test.cpp | 1 + .../dcamera_source_callback_proxy_test.cpp | 7 +++++++ .../distributed_camera_source_service_test.cpp | 1 + .../dcamera_source_service_ipc_test.cpp | 1 + .../pipeline_node/fpscontroller/fps_controller_process.cpp | 2 +- 26 files changed, 64 insertions(+), 2 deletions(-) diff --git a/common/src/utils/dcamera_utils_tools.cpp b/common/src/utils/dcamera_utils_tools.cpp index 8d21d2d0..ddba00d7 100644 --- a/common/src/utils/dcamera_utils_tools.cpp +++ b/common/src/utils/dcamera_utils_tools.cpp @@ -324,7 +324,7 @@ FILE *DumpFileUtil::OpenDumpFileInner(std::string para, std::string fileName) g_lastPara[para] = dumpPara; return dumpFile; } - DHLOGD("%{public}s = %{public}s, filePath: %{public}s", para.c_str(), dumpPara.c_str(), path); + if (dumpPara == "w") { dumpFile = fopen(path, "wb+"); CHECK_AND_RETURN_RET_LOG(dumpFile == nullptr, dumpFile, "Error opening dump file!"); diff --git a/interfaces/inner_kits/native_cpp/test/sinkfuzztest/onsinklocalcamsrvdied_fuzzer/onsinklocalcamsrvdied_fuzzer.cpp b/interfaces/inner_kits/native_cpp/test/sinkfuzztest/onsinklocalcamsrvdied_fuzzer/onsinklocalcamsrvdied_fuzzer.cpp index 8947d923..ad71efac 100644 --- a/interfaces/inner_kits/native_cpp/test/sinkfuzztest/onsinklocalcamsrvdied_fuzzer/onsinklocalcamsrvdied_fuzzer.cpp +++ b/interfaces/inner_kits/native_cpp/test/sinkfuzztest/onsinklocalcamsrvdied_fuzzer/onsinklocalcamsrvdied_fuzzer.cpp @@ -35,6 +35,9 @@ void OnSinkLocalCamSrvDiedFuzzTest(const uint8_t* data, size_t size) int32_t saId = *(reinterpret_cast(data)); sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + if (samgr == nullptr) { + return; + } sptr remoteObject = samgr->GetSystemAbility(saId); wptr remote (remoteObject); diff --git a/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkonloadsystemabilitysuccess_fuzzer/sinkonloadsystemabilitysuccess_fuzzer.cpp b/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkonloadsystemabilitysuccess_fuzzer/sinkonloadsystemabilitysuccess_fuzzer.cpp index c5f470a6..b6021667 100644 --- a/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkonloadsystemabilitysuccess_fuzzer/sinkonloadsystemabilitysuccess_fuzzer.cpp +++ b/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkonloadsystemabilitysuccess_fuzzer/sinkonloadsystemabilitysuccess_fuzzer.cpp @@ -37,6 +37,9 @@ void SinkOnLoadSystemAbilitySuccessFuzzTest(const uint8_t* data, size_t size) sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + if (samgr == nullptr) { + return; + } sptr remoteObject = samgr->GetSystemAbility(systemAbilityId); callback->OnLoadSystemAbilitySuccess(systemAbilityId, remoteObject); diff --git a/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxychannelneg_fuzzer/sinkproxychannelneg_fuzzer.cpp b/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxychannelneg_fuzzer/sinkproxychannelneg_fuzzer.cpp index 453b1ac2..d4dd0255 100644 --- a/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxychannelneg_fuzzer/sinkproxychannelneg_fuzzer.cpp +++ b/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxychannelneg_fuzzer/sinkproxychannelneg_fuzzer.cpp @@ -36,6 +36,9 @@ void SinkProxyChannelNegFuzzTest(const uint8_t* data, size_t size) sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + if (samgr == nullptr) { + return; + } sptr remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_CAMERA_SINK_SA_ID); std::shared_ptr dCSinkProxy = std::make_shared(remoteObject); diff --git a/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxyclosechannel_fuzzer/sinkproxyclosechannel_fuzzer.cpp b/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxyclosechannel_fuzzer/sinkproxyclosechannel_fuzzer.cpp index 1bf7996e..f1ac84dd 100644 --- a/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxyclosechannel_fuzzer/sinkproxyclosechannel_fuzzer.cpp +++ b/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxyclosechannel_fuzzer/sinkproxyclosechannel_fuzzer.cpp @@ -34,6 +34,9 @@ void SinkProxyCloseChannelFuzzTest(const uint8_t* data, size_t size) sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + if (samgr == nullptr) { + return; + } sptr remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_CAMERA_SINK_SA_ID); std::shared_ptr dCSinkProxy = std::make_shared(remoteObject); diff --git a/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxygetcamerainfo_fuzzer/sinkproxygetcamerainfo_fuzzer.cpp b/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxygetcamerainfo_fuzzer/sinkproxygetcamerainfo_fuzzer.cpp index 09766a4f..5bbd20b5 100644 --- a/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxygetcamerainfo_fuzzer/sinkproxygetcamerainfo_fuzzer.cpp +++ b/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxygetcamerainfo_fuzzer/sinkproxygetcamerainfo_fuzzer.cpp @@ -36,6 +36,9 @@ void SinkProxyGetCameraInfoFuzzTest(const uint8_t* data, size_t size) sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + if (samgr == nullptr) { + return; + } sptr remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_CAMERA_SINK_SA_ID); std::shared_ptr dCSinkProxy = std::make_shared(remoteObject); diff --git a/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxyinitsink_fuzzer/sinkproxyinitsink_fuzzer.cpp b/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxyinitsink_fuzzer/sinkproxyinitsink_fuzzer.cpp index fa85b599..bdf73e2f 100644 --- a/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxyinitsink_fuzzer/sinkproxyinitsink_fuzzer.cpp +++ b/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxyinitsink_fuzzer/sinkproxyinitsink_fuzzer.cpp @@ -36,6 +36,9 @@ void SinkProxyInitSinkFuzzTest(const uint8_t* data, size_t size) sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + if (samgr == nullptr) { + return; + } sptr remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_CAMERA_SINK_SA_ID); std::shared_ptr dCSinkProxy = std::make_shared(remoteObject); diff --git a/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxyopenchannel_fuzzer/sinkproxyopenchannel_fuzzer.cpp b/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxyopenchannel_fuzzer/sinkproxyopenchannel_fuzzer.cpp index 495126a7..4d3bef6d 100644 --- a/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxyopenchannel_fuzzer/sinkproxyopenchannel_fuzzer.cpp +++ b/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxyopenchannel_fuzzer/sinkproxyopenchannel_fuzzer.cpp @@ -36,6 +36,9 @@ void SinkProxyOpenChannelFuzzTest(const uint8_t* data, size_t size) sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + if (samgr == nullptr) { + return; + } sptr remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_CAMERA_SINK_SA_ID); std::shared_ptr dCSinkProxy = std::make_shared(remoteObject); diff --git a/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxyreleasesink_fuzzer/sinkproxyreleasesink_fuzzer.cpp b/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxyreleasesink_fuzzer/sinkproxyreleasesink_fuzzer.cpp index 13355d90..b3d29b04 100644 --- a/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxyreleasesink_fuzzer/sinkproxyreleasesink_fuzzer.cpp +++ b/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxyreleasesink_fuzzer/sinkproxyreleasesink_fuzzer.cpp @@ -34,6 +34,9 @@ void SinkProxyReleaseSinkFuzzTest(const uint8_t* data, size_t size) sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + if (samgr == nullptr) { + return; + } sptr remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_CAMERA_SINK_SA_ID); std::shared_ptr dCSinkProxy = std::make_shared(remoteObject); diff --git a/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxystopcapture_fuzzer/sinkproxystopcapture_fuzzer.cpp b/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxystopcapture_fuzzer/sinkproxystopcapture_fuzzer.cpp index 7a75bbb6..7829e4a8 100644 --- a/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxystopcapture_fuzzer/sinkproxystopcapture_fuzzer.cpp +++ b/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxystopcapture_fuzzer/sinkproxystopcapture_fuzzer.cpp @@ -35,6 +35,9 @@ void SinkProxyStopCaptureFuzzTest(const uint8_t* data, size_t size) sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + if (samgr == nullptr) { + return; + } sptr remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_CAMERA_SINK_SA_ID); std::shared_ptr dCSinkProxy = std::make_shared(remoteObject); diff --git a/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxysubscribelocalhardware_fuzzer/sinkproxysubscribelocalhardware_fuzzer.cpp b/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxysubscribelocalhardware_fuzzer/sinkproxysubscribelocalhardware_fuzzer.cpp index 4ffe5f41..65394049 100644 --- a/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxysubscribelocalhardware_fuzzer/sinkproxysubscribelocalhardware_fuzzer.cpp +++ b/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxysubscribelocalhardware_fuzzer/sinkproxysubscribelocalhardware_fuzzer.cpp @@ -36,6 +36,9 @@ void SinkProxySubscribeLocalHardwareFuzzTest(const uint8_t* data, size_t size) sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + if (samgr == nullptr) { + return; + } sptr remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_CAMERA_SINK_SA_ID); std::shared_ptr dCSinkProxy = std::make_shared(remoteObject); diff --git a/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxyunsubscribelocalhardware_fuzzer/sinkproxyunsubscribelocalhardware_fuzzer.cpp b/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxyunsubscribelocalhardware_fuzzer/sinkproxyunsubscribelocalhardware_fuzzer.cpp index 624c5334..62fdc521 100644 --- a/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxyunsubscribelocalhardware_fuzzer/sinkproxyunsubscribelocalhardware_fuzzer.cpp +++ b/interfaces/inner_kits/native_cpp/test/sinkfuzztest/sinkproxyunsubscribelocalhardware_fuzzer/sinkproxyunsubscribelocalhardware_fuzzer.cpp @@ -35,6 +35,9 @@ void SinkProxyUnsubscribeLocalHardwareFuzzTest(const uint8_t* data, size_t size) sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + if (samgr == nullptr) { + return; + } sptr remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_CAMERA_SINK_SA_ID); std::shared_ptr dCSinkProxy = std::make_shared(remoteObject); diff --git a/interfaces/inner_kits/native_cpp/test/sourcefuzztest/onsourcelocalcamsrvdied_fuzzer/onsourcelocalcamsrvdied_fuzzer.cpp b/interfaces/inner_kits/native_cpp/test/sourcefuzztest/onsourcelocalcamsrvdied_fuzzer/onsourcelocalcamsrvdied_fuzzer.cpp index d88493ec..d5473d44 100644 --- a/interfaces/inner_kits/native_cpp/test/sourcefuzztest/onsourcelocalcamsrvdied_fuzzer/onsourcelocalcamsrvdied_fuzzer.cpp +++ b/interfaces/inner_kits/native_cpp/test/sourcefuzztest/onsourcelocalcamsrvdied_fuzzer/onsourcelocalcamsrvdied_fuzzer.cpp @@ -35,6 +35,9 @@ void OnSourceLocalCamSrvDiedFuzzTest(const uint8_t* data, size_t size) int32_t saId = *(reinterpret_cast(data)); sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + if (samgr == nullptr) { + return; + } sptr remoteObject = samgr->GetSystemAbility(saId); wptr remote (remoteObject); diff --git a/interfaces/inner_kits/native_cpp/test/sourcefuzztest/sourceproxydcameranotify_fuzzer/sourceproxydcameranotify_fuzzer.cpp b/interfaces/inner_kits/native_cpp/test/sourcefuzztest/sourceproxydcameranotify_fuzzer/sourceproxydcameranotify_fuzzer.cpp index 3a943a54..8db67503 100644 --- a/interfaces/inner_kits/native_cpp/test/sourcefuzztest/sourceproxydcameranotify_fuzzer/sourceproxydcameranotify_fuzzer.cpp +++ b/interfaces/inner_kits/native_cpp/test/sourcefuzztest/sourceproxydcameranotify_fuzzer/sourceproxydcameranotify_fuzzer.cpp @@ -35,6 +35,9 @@ void SourceProxyDCameraNotifyFuzzTest(const uint8_t* data, size_t size) sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + if (samgr == nullptr) { + return; + } sptr remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_CAMERA_SOURCE_SA_ID); std::shared_ptr dCSourceProxy = std::make_shared(remoteObject); diff --git a/interfaces/inner_kits/native_cpp/test/sourcefuzztest/sourceproxyinitsource_fuzzer/sourceproxyinitsource_fuzzer.cpp b/interfaces/inner_kits/native_cpp/test/sourcefuzztest/sourceproxyinitsource_fuzzer/sourceproxyinitsource_fuzzer.cpp index 44fca0f1..504228f7 100644 --- a/interfaces/inner_kits/native_cpp/test/sourcefuzztest/sourceproxyinitsource_fuzzer/sourceproxyinitsource_fuzzer.cpp +++ b/interfaces/inner_kits/native_cpp/test/sourcefuzztest/sourceproxyinitsource_fuzzer/sourceproxyinitsource_fuzzer.cpp @@ -32,6 +32,9 @@ void SourceProxyInitSourceFuzzTest(const uint8_t* data, size_t size) sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + if (samgr == nullptr) { + return; + } sptr remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_CAMERA_SOURCE_SA_ID); std::shared_ptr dCSourceProxy = std::make_shared(remoteObject); diff --git a/interfaces/inner_kits/native_cpp/test/sourcefuzztest/sourceproxyregisterdistributedhardware_fuzzer/sourceproxyregisterdistributedhardware_fuzzer.cpp b/interfaces/inner_kits/native_cpp/test/sourcefuzztest/sourceproxyregisterdistributedhardware_fuzzer/sourceproxyregisterdistributedhardware_fuzzer.cpp index e04c84d8..ee6443be 100644 --- a/interfaces/inner_kits/native_cpp/test/sourcefuzztest/sourceproxyregisterdistributedhardware_fuzzer/sourceproxyregisterdistributedhardware_fuzzer.cpp +++ b/interfaces/inner_kits/native_cpp/test/sourcefuzztest/sourceproxyregisterdistributedhardware_fuzzer/sourceproxyregisterdistributedhardware_fuzzer.cpp @@ -44,6 +44,9 @@ void SourceProxyRegisterDistributedHardwareFuzzTest(const uint8_t* data, size_t sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + if (samgr == nullptr) { + return; + } sptr remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_CAMERA_SOURCE_SA_ID); std::shared_ptr dCSourceProxy = std::make_shared(remoteObject); diff --git a/interfaces/inner_kits/native_cpp/test/sourcefuzztest/sourceproxyunregisterdistributedhardware_fuzzer/sourceproxyunregisterdistributedhardware_fuzzer.cpp b/interfaces/inner_kits/native_cpp/test/sourcefuzztest/sourceproxyunregisterdistributedhardware_fuzzer/sourceproxyunregisterdistributedhardware_fuzzer.cpp index 713d0c93..e16eb98c 100644 --- a/interfaces/inner_kits/native_cpp/test/sourcefuzztest/sourceproxyunregisterdistributedhardware_fuzzer/sourceproxyunregisterdistributedhardware_fuzzer.cpp +++ b/interfaces/inner_kits/native_cpp/test/sourcefuzztest/sourceproxyunregisterdistributedhardware_fuzzer/sourceproxyunregisterdistributedhardware_fuzzer.cpp @@ -35,6 +35,9 @@ void SourceProxyUnregisterDistributedHardwareFuzzTest(const uint8_t* data, size_ sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + if (samgr == nullptr) { + return; + } sptr remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_CAMERA_SOURCE_SA_ID); std::shared_ptr dCSourceProxy = std::make_shared(remoteObject); diff --git a/interfaces/inner_kits/native_cpp/test/unittest/common/camera_sink/dcamera_sink_handler_ipc_test.cpp b/interfaces/inner_kits/native_cpp/test/unittest/common/camera_sink/dcamera_sink_handler_ipc_test.cpp index dc5a4101..c63ffb9a 100644 --- a/interfaces/inner_kits/native_cpp/test/unittest/common/camera_sink/dcamera_sink_handler_ipc_test.cpp +++ b/interfaces/inner_kits/native_cpp/test/unittest/common/camera_sink/dcamera_sink_handler_ipc_test.cpp @@ -134,6 +134,7 @@ HWTEST_F(DCameraSinkHandlerIpcTest, dcamera_sink_handler_ipc_test_005, TestSize. int32_t systemAbilityId = 4804; sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_NE(samgr, nullptr); wptr remoteObject = samgr->GetSystemAbility(systemAbilityId); DCameraSinkHandlerIpc::GetInstance().OnSinkLocalCamSrvDied(remoteObject); EXPECT_EQ(nullptr, DCameraSinkHandlerIpc::GetInstance().localSink_); diff --git a/interfaces/inner_kits/native_cpp/test/unittest/common/camera_sink/dcamera_sink_handler_test.cpp b/interfaces/inner_kits/native_cpp/test/unittest/common/camera_sink/dcamera_sink_handler_test.cpp index 5c64ce86..8a5c7122 100644 --- a/interfaces/inner_kits/native_cpp/test/unittest/common/camera_sink/dcamera_sink_handler_test.cpp +++ b/interfaces/inner_kits/native_cpp/test/unittest/common/camera_sink/dcamera_sink_handler_test.cpp @@ -168,6 +168,7 @@ HWTEST_F(DCameraSinkHandlerTest, dcamera_sink_handler_test_005, TestSize.Level1) int32_t systemAbilityId = 4804; sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_NE(samgr, nullptr); sptr remoteObject = samgr->GetSystemAbility(systemAbilityId); sptr loadCallback(new DCameraSinkLoadCallback(params)); ASSERT_NE(loadCallback, nullptr); diff --git a/interfaces/inner_kits/native_cpp/test/unittest/common/camera_source/dcamera_source_handler_ipc_test.cpp b/interfaces/inner_kits/native_cpp/test/unittest/common/camera_source/dcamera_source_handler_ipc_test.cpp index a0f2fa77..9528dc7b 100644 --- a/interfaces/inner_kits/native_cpp/test/unittest/common/camera_source/dcamera_source_handler_ipc_test.cpp +++ b/interfaces/inner_kits/native_cpp/test/unittest/common/camera_source/dcamera_source_handler_ipc_test.cpp @@ -134,6 +134,7 @@ HWTEST_F(DCameraSourceHandlerIpcTest, dcamera_source_handler_ipc_test_005, TestS int32_t systemAbilityId = 4803; sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_NE(samgr, nullptr); wptr remoteObject = samgr->GetSystemAbility(systemAbilityId); DCameraSourceHandlerIpc::GetInstance().OnSourceLocalCamSrvDied(remoteObject); EXPECT_EQ(nullptr, DCameraSourceHandlerIpc::GetInstance().localSource_); diff --git a/interfaces/inner_kits/native_cpp/test/unittest/common/camera_source/dcamera_source_handler_test.cpp b/interfaces/inner_kits/native_cpp/test/unittest/common/camera_source/dcamera_source_handler_test.cpp index 616bee39..d72a7d4b 100644 --- a/interfaces/inner_kits/native_cpp/test/unittest/common/camera_source/dcamera_source_handler_test.cpp +++ b/interfaces/inner_kits/native_cpp/test/unittest/common/camera_source/dcamera_source_handler_test.cpp @@ -154,6 +154,7 @@ HWTEST_F(DCameraSourceHandlerTest, dcamera_source_handler_test_005, TestSize.Lev int32_t systemAbilityId = 4803; sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_NE(samgr, nullptr); sptr remoteObject = samgr->GetSystemAbility(systemAbilityId); sptr loadCallback(new DCameraSourceLoadCallback(params)); ASSERT_NE(loadCallback, nullptr); diff --git a/services/cameraservice/sinkservice/test/unittest/common/distributedcamera/dcamera_sink_callback_proxy_test.cpp b/services/cameraservice/sinkservice/test/unittest/common/distributedcamera/dcamera_sink_callback_proxy_test.cpp index 1dcd4b73..6348a813 100644 --- a/services/cameraservice/sinkservice/test/unittest/common/distributedcamera/dcamera_sink_callback_proxy_test.cpp +++ b/services/cameraservice/sinkservice/test/unittest/common/distributedcamera/dcamera_sink_callback_proxy_test.cpp @@ -67,6 +67,7 @@ HWTEST_F(DcameraSinkCallbackProxyTest, dcamera_sink_callback_proxy_test_001, Tes DHLOGI("DcameraSinkCallbackProxyTest::dcamera_sink_callback_proxy_test_001"); sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_NE(samgr, nullptr); sptr remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_CAMERA_SINK_SA_ID); sptr callbackProxy(new DCameraSinkCallbackProxy(remoteObject)); EXPECT_EQ(false, callbackProxy == nullptr); diff --git a/services/cameraservice/sourceservice/test/unittest/common/distributedcamera/dcamera_source_callback_proxy_test.cpp b/services/cameraservice/sourceservice/test/unittest/common/distributedcamera/dcamera_source_callback_proxy_test.cpp index 6ba64b5d..dd8cd63c 100644 --- a/services/cameraservice/sourceservice/test/unittest/common/distributedcamera/dcamera_source_callback_proxy_test.cpp +++ b/services/cameraservice/sourceservice/test/unittest/common/distributedcamera/dcamera_source_callback_proxy_test.cpp @@ -74,6 +74,7 @@ HWTEST_F(DcameraSourceCallbackProxyTest, dcamera_source_callback_proxy_test_001, DHLOGI("DcameraSourceCallbackProxyTest::dcamera_source_callback_proxy_test_001"); sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_NE(samgr, nullptr); sptr remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_CAMERA_SOURCE_SA_ID); sptr callbackProxy(new DCameraSourceCallbackProxy(remoteObject)); EXPECT_EQ(false, callbackProxy == nullptr); @@ -98,6 +99,7 @@ HWTEST_F(DcameraSourceCallbackProxyTest, dcamera_source_callback_proxy_test_002, DHLOGI("DcameraSourceCallbackProxyTest::dcamera_source_callback_proxy_test_002"); sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_NE(samgr, nullptr); sptr remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_CAMERA_SOURCE_SA_ID); sptr callbackProxy(new DCameraSourceCallbackProxy(remoteObject)); EXPECT_EQ(false, callbackProxy == nullptr); @@ -122,6 +124,7 @@ HWTEST_F(DcameraSourceCallbackProxyTest, dcamera_source_callback_proxy_test_003, DHLOGI("DcameraSourceCallbackProxyTest::dcamera_source_callback_proxy_test_003"); sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_NE(samgr, nullptr); sptr remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_CAMERA_SOURCE_SA_ID); sptr callbackProxy(new DCameraSourceCallbackProxy(remoteObject)); EXPECT_EQ(false, callbackProxy == nullptr); @@ -145,6 +148,7 @@ HWTEST_F(DcameraSourceCallbackProxyTest, dcamera_source_callback_proxy_test_004, DHLOGI("DcameraSourceCallbackProxyTest::dcamera_source_callback_proxy_test_004"); sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_NE(samgr, nullptr); sptr remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_CAMERA_SOURCE_SA_ID); sptr callbackProxy(new DCameraSourceCallbackProxy(remoteObject)); EXPECT_EQ(false, callbackProxy == nullptr); @@ -183,6 +187,7 @@ HWTEST_F(DcameraSourceCallbackProxyTest, CheckParams_001, TestSize.Level1) DHLOGI("DcameraSourceCallbackProxyTest::CheckParams_001"); sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_NE(samgr, nullptr); sptr remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_CAMERA_SOURCE_SA_ID); sptr callbackProxy(new DCameraSourceCallbackProxy(remoteObject)); @@ -210,6 +215,7 @@ HWTEST_F(DcameraSourceCallbackProxyTest, OnDataSyncTrigger_001, TestSize.Level1) DHLOGI("DcameraSourceCallbackProxyTest::OnDataSyncTrigger_001"); sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_NE(samgr, nullptr); sptr remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_CAMERA_SOURCE_SA_ID); sptr callbackProxy(new DCameraSourceCallbackProxy(remoteObject)); @@ -245,6 +251,7 @@ HWTEST_F(DcameraSourceCallbackProxyTest, OnHardwareStateChanged_001, TestSize.Le DHLOGI("DcameraSourceCallbackProxyTest::OnHardwareStateChanged_001"); sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_NE(samgr, nullptr); sptr remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_CAMERA_SOURCE_SA_ID); sptr callbackProxy(new DCameraSourceCallbackProxy(remoteObject)); diff --git a/services/cameraservice/sourceservice/test/unittest/common/distributedcamera/distributed_camera_source_service_test.cpp b/services/cameraservice/sourceservice/test/unittest/common/distributedcamera/distributed_camera_source_service_test.cpp index 418c0cdc..7caa25a3 100644 --- a/services/cameraservice/sourceservice/test/unittest/common/distributedcamera/distributed_camera_source_service_test.cpp +++ b/services/cameraservice/sourceservice/test/unittest/common/distributedcamera/distributed_camera_source_service_test.cpp @@ -180,6 +180,7 @@ HWTEST_F(DistributedCameraSourceServiceTest, dcamera_source_service_test_006, Te std::string params = "test006"; sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_NE(samgr, nullptr); sptr remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_CAMERA_SOURCE_SA_ID); sptr callbackProxy(new DCameraSourceCallbackProxy(remoteObject)); testSrcService_->listener_ = std::make_shared(); diff --git a/services/cameraservice/sourceservice/test/unittest/common/distributedcameramgr/dcamera_source_service_ipc_test.cpp b/services/cameraservice/sourceservice/test/unittest/common/distributedcameramgr/dcamera_source_service_ipc_test.cpp index 0a22b70c..4e8a425e 100644 --- a/services/cameraservice/sourceservice/test/unittest/common/distributedcameramgr/dcamera_source_service_ipc_test.cpp +++ b/services/cameraservice/sourceservice/test/unittest/common/distributedcameramgr/dcamera_source_service_ipc_test.cpp @@ -142,6 +142,7 @@ HWTEST_F(DCameraSourceServiceIpcTest, dcamera_source_service_ipc_test_005, TestS DCameraSourceServiceIpc::GetInstance().Init(); sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_NE(samgr, nullptr); wptr remote = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_CAMERA_SINK_SA_ID); DCameraSourceServiceIpc::GetInstance().OnSinkRemoteCamSrvDied(remote); DCameraSourceServiceIpc::GetInstance().UnInit(); 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 d2c7c0d3..9aac898e 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 @@ -269,7 +269,7 @@ bool FpsControllerProcess::IsDropFrame(float incomingFps) bool FpsControllerProcess::ReduceFrameRateByUniformStrategy(int32_t incomingFrmRate) { DHLOGD("Frame control, reduce frame rate by uniform rate strategy"); - if (incomingFrmRate > targetFrameRate_) { + if (incomingFrmRate <= targetFrameRate_) { DHLOGD("incoming fps not more than targetFrameRate_, not drop"); return false; } -- Gitee