diff --git a/common/BUILD.gn b/common/BUILD.gn index 7dd03dcd631fe907e5d57d8a7e6079f71e38c6f3..17038a32ec9bb84f8ea382ca8bf097b4420fcf5d 100644 --- a/common/BUILD.gn +++ b/common/BUILD.gn @@ -33,6 +33,7 @@ ohos_shared_library("distributed_screen_utils") { external_deps = [ "dsoftbus_standard:softbus_client", "hiviewdfx_hilog_native:libhilog", + "bytrace_standard:bytrace_core", ] defines = [ diff --git a/interfaces/innerkits/native_cpp/screen_sink/src/dscreen_sink_handler.cpp b/interfaces/innerkits/native_cpp/screen_sink/src/dscreen_sink_handler.cpp index 8f4472cc86dbe81d3017d4c9235957fd3d9e33f3..8efd4b3fb96fe54e03e7e9f761762a1bde936749 100644 --- a/interfaces/innerkits/native_cpp/screen_sink/src/dscreen_sink_handler.cpp +++ b/interfaces/innerkits/native_cpp/screen_sink/src/dscreen_sink_handler.cpp @@ -121,7 +121,7 @@ void DScreenSinkHandler::OnRemoteSinkSvrDied(const wptr &remote) return; } std::lock_guard lock(mutex_); - if (!dScreenSinkProxy_) { + if (dScreenSinkProxy_) { dScreenSinkProxy_->AsObject()->RemoveDeathRecipient(sinkSvrRecipient_); dScreenSinkProxy_ = nullptr; } diff --git a/interfaces/innerkits/native_cpp/screen_source/src/dscreen_source_handler.cpp b/interfaces/innerkits/native_cpp/screen_source/src/dscreen_source_handler.cpp index ed5e3c0f89c79b46a453b839d4241335ae20c355..825f04a7b6277c01331a0d96ebd4e60c1147652c 100644 --- a/interfaces/innerkits/native_cpp/screen_source/src/dscreen_source_handler.cpp +++ b/interfaces/innerkits/native_cpp/screen_source/src/dscreen_source_handler.cpp @@ -151,7 +151,7 @@ void DScreenSourceHandler::OnRemoteSourceSvrDied(const wptr &remo return; } std::lock_guard lock(mutex_); - if (!dScreenSourceProxy_) { + if (dScreenSourceProxy_) { dScreenSourceProxy_->AsObject()->RemoveDeathRecipient(sourceSvrRecipient_); dScreenSourceProxy_ = nullptr; } diff --git a/services/screenservice/sinkservice/screenregionmgr/src/screenregion.cpp b/services/screenservice/sinkservice/screenregionmgr/src/screenregion.cpp index 9fdf73b13ddc1d91c21ed0ffaf6ef88eee83c99f..25bb4114b5d88e28c6643855e00caa4d4fe12f15 100644 --- a/services/screenservice/sinkservice/screenregionmgr/src/screenregion.cpp +++ b/services/screenservice/sinkservice/screenregionmgr/src/screenregion.cpp @@ -37,7 +37,7 @@ ScreenRegion::ScreenRegion(const std::string &remoteDevId, uint64_t screenId, ui ScreenRegion::~ScreenRegion() { DHLOGD("ScreenRegion deConstruct"); - if (!sinkTrans_) { + if (sinkTrans_) { sinkTrans_->Release(); } } diff --git a/services/screenservice/sourceservice/dscreenmgr/src/dscreen.cpp b/services/screenservice/sourceservice/dscreenmgr/src/dscreen.cpp index d6e73fdbbbe5acd7a50999de017b9dede06e7f7c..05506e3378372e03cc1eec44ea1367381198d96e 100644 --- a/services/screenservice/sourceservice/dscreenmgr/src/dscreen.cpp +++ b/services/screenservice/sourceservice/dscreenmgr/src/dscreen.cpp @@ -271,7 +271,7 @@ int32_t DScreen::NegotiateCodecType(const std::string &remoteCodecInfoStr) DHLOGI("codec type not support."); return ERR_DH_SCREEN_SA_DSCREEN_NEGOTIATE_CODEC_FAIL; } - + FinishTrace(DSCREEN_NEGOTIATE_CODEC_LABEL); return DH_SUCCESS; } diff --git a/services/screenservice/sourceservice/dscreenservice/src/dscreen_source_service.cpp b/services/screenservice/sourceservice/dscreenservice/src/dscreen_source_service.cpp index e1cb0ef3530824bcaaac58a418cfc7ad6d814d72..f6bac28b0f3c1b10a824c4edd7dc033bbdc8e678 100644 --- a/services/screenservice/sourceservice/dscreenservice/src/dscreen_source_service.cpp +++ b/services/screenservice/sourceservice/dscreenservice/src/dscreen_source_service.cpp @@ -81,7 +81,7 @@ int32_t DScreenSourceService::InitSource(const std::string ¶ms, const sptr dataLock(dataMutex_); while (!bufferIndexQueue_.empty()) { bufferIndexQueue_.pop(); diff --git a/services/screentransport/screensourcetrans/src/screen_source_trans.cpp b/services/screentransport/screensourcetrans/src/screen_source_trans.cpp index 6d2ef574b8f5b7ba7ce236ffcb639be1c1e0da7f..0d0133e97b6f65d4fb71ee4e2c03535458e4ef0c 100644 --- a/services/screentransport/screensourcetrans/src/screen_source_trans.cpp +++ b/services/screentransport/screensourcetrans/src/screen_source_trans.cpp @@ -121,7 +121,9 @@ int32_t ScreenSourceTrans::Stop() stopStatus = false; } isChannelReady_ = false; - sendDataThread_.join(); + if (sendDataThread_.joinable()) { + sendDataThread_.join(); + } if (!stopStatus) { DHLOGE("%s: Stop source trans failed.", LOG_TAG); @@ -309,7 +311,9 @@ void ScreenSourceTrans::OnSessionClosed() { DHLOGI("%s: OnChannelSessionClosed.", LOG_TAG); isChannelReady_ = false; - sendDataThread_.join(); + if (sendDataThread_.joinable()) { + sendDataThread_.join(); + } std::shared_ptr callback = transCallback_.lock(); if (!callback) {