!93 修改HiSysEvent打点

Merge pull request !93 from william/master
This commit is contained in:
openharmony_ci
2022-06-15 02:05:27 +00:00
committed by Gitee
29 changed files with 304 additions and 94 deletions
+1
View File
@@ -20,6 +20,7 @@ ohos_shared_library("distributed_screen_utils") {
include_dirs = [
"//utils/native/base/include",
"include",
"//base/hiviewdfx/hisysevent/interfaces/native/innerkits/hisysevent/include",
"//base/hiviewdfx/hitrace/interfaces/native/innerkits/include/hitrace_meter",
]
+1
View File
@@ -55,6 +55,7 @@ enum DScreenErrorCode {
ERR_DH_SCREEN_SA_DSCREEN_NEGOTIATE_CODEC_FAIL = -500031,
ERR_DH_SCREEN_SA_LOAD_TIMEOUT = -500032,
ERR_DH_SCREEN_SA_HIDUMPER_ERROR = -500033,
ERR_DH_SCREEN_SA_ENABLE_JSON_ERROR = -500034,
// Transport component error code
ERR_DH_SCREEN_TRANS_ERROR = -51000,
ERR_DH_SCREEN_TRANS_TIMEOUT = -51001,
+25 -8
View File
@@ -22,15 +22,32 @@
namespace OHOS {
namespace DistributedHardware {
const std::string SA_ERROR = "DSCREEN_SA_START_ERROR";
const std::string WINDOW_ERROR = "DSCREEN_WINDOW_ERROR";
const std::string VIRTUALSCREEN_ERROR = "DSCREEN_VIRTUALSCREEN_ERROR";
const std::string VIDEO_DECODER_ERROR = "DSCREEN_VIDEO_DECODER_ERROR";
const std::string VIDEO_ENCODER_ERROR = "DSCREEN_VIDEO_ENCODER_ERROR";
const std::string SOFTBUS_SESSIONSERVER_ERROR = "DSCREEN_SOFTBUS_SESSIONSERVER_ERROR";
const std::string SOFTBUS_SESSION_ERROR = "DSCREEN_SOFTBUS_SESSION_ERROR";
const std::string DSCREEN_INIT_FAIL = "DSCREEN_INIT_FAIL";
const std::string DSCREEN_REGISTER_FAIL = "DSCREEN_REGISTER_FAIL";
const std::string DSCREEN_UNREGISTER_FAIL = "DSCREEN_UNREGISTER_FAIL";
const std::string DSCREEN_OPT_FAIL = "DSCREEN_OPT_FAIL";
void ReportScreenEvent(const std::string &eventName, const std::string &errMsg);
const std::string DSCREEN_INIT = "DSCREEN_INIT";
const std::string DSCREEN_REGISTER = "DSCREEN_REGISTER";
const std::string DSCREEN_UNREGISTER = "DSCREEN_UNREGISTER";
const std::string DSCREEN_PROJECT_START = "DSCREEN_PROJECT_START";
const std::string DSCREEN_PROJECT_END = "DSCREEN_PROJECT_END";
const std::string DSCREEN_EXIT = "DSCREEN_EXIT";
void ReportSaFail(const std::string &eventName, int32_t errCode, int32_t saId, const std::string &errMsg);
void ReportRegisterFail(const std::string &eventName, int32_t errCode, const std::string &devId,
const std::string &dhId, const std::string &errMsg);
void ReportUnRegisterFail(const std::string &eventName, int32_t errCode, const std::string &devId,
const std::string &dhId, const std::string &errMsg);
void ReportOptFail(const std::string &eventName, int32_t errCode, const std::string &errMsg);
void ReportSaEvent(const std::string &eventName, int32_t saId, const std::string &errMsg);
void ReportRegisterScreenEvent(const std::string &eventName, const std::string &devId, const std::string &dhId,
const std::string &errMsg);
void ReportUnRegisterScreenEvent(const std::string &eventName, const std::string &devId, const std::string &dhId,
const std::string &errMsg);
void ReportScreenMirrorEvent(const std::string &eventName, const std::string &devId, const std::string &dhId,
const std::string &errMsg);
} // namespace DistributedHardware
} // namespace OHOS
#endif
+107 -4
View File
@@ -12,23 +12,126 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "dscreen_hisysevent.h"
#include <unistd.h>
#include "dscreen_errcode.h"
#include "dscreen_log.h"
#include "dscreen_hisysevent.h"
namespace OHOS {
namespace DistributedHardware {
void ReportScreenEvent(const std::string &eventName, const std::string &errMsg)
void ReportSaFail(const std::string &eventName, int32_t errCode, int32_t saId, const std::string &errMsg)
{
int32_t res = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_SCREEN,
eventName,
OHOS::HiviewDFX::HiSysEvent::EventType::FAULT,
"PID", getpid(),
"UID", getuid(),
"ERRCODE", errCode,
"SAID", saId,
"MSG", errMsg);
if (res != DH_SUCCESS) {
DHLOGE("Write HiSysEvent error, res:%d", res);
}
}
void ReportRegisterFail(const std::string &eventName, int32_t errCode, const std::string &devId,
const std::string &dhId, const std::string &errMsg)
{
int32_t res = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_SCREEN,
eventName,
OHOS::HiviewDFX::HiSysEvent::EventType::FAULT,
"ERRCODE", errCode,
"DEVID", devId,
"DHID", dhId,
"MSG", errMsg);
if (res != DH_SUCCESS) {
DHLOGE("Write HiSysEvent error, res:%d", res);
}
}
void ReportUnRegisterFail(const std::string &eventName, int32_t errCode, const std::string &devId,
const std::string &dhId, const std::string &errMsg)
{
int32_t res = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_SCREEN,
eventName,
OHOS::HiviewDFX::HiSysEvent::EventType::FAULT,
"ERRCODE", errCode,
"DEVID", devId,
"DHID", dhId,
"MSG", errMsg);
if (res != DH_SUCCESS) {
DHLOGE("Write HiSysEvent error, res:%d", res);
}
}
void ReportOptFail(const std::string &eventName, int32_t errCode, const std::string &errMsg)
{
int32_t res = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_SCREEN,
eventName,
OHOS::HiviewDFX::HiSysEvent::EventType::FAULT,
"ERRCODE", errCode,
"MSG", errMsg);
if (res != DH_SUCCESS) {
DHLOGE("Write HiSysEvent error, res:%d", res);
}
}
void ReportSaEvent(const std::string &eventName, int32_t saId, const std::string &errMsg)
{
int32_t res = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_SCREEN,
eventName,
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR,
"SAID", saId,
"MSG", errMsg);
if (res != DH_SUCCESS) {
DHLOGE("Write HiSysEvent error, res:%d", res);
}
}
void ReportRegisterScreenEvent(const std::string &eventName, const std::string &devId, const std::string &dhId,
const std::string &errMsg)
{
int32_t res = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_SCREEN,
eventName,
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR,
"DEVID", devId,
"DHID", dhId,
"MSG", errMsg);
if (res != DH_SUCCESS) {
DHLOGE("Write HiSysEvent error, res:%d", res);
}
}
void ReportUnRegisterScreenEvent(const std::string &eventName, const std::string &devId, const std::string &dhId,
const std::string &errMsg)
{
int32_t res = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_SCREEN,
eventName,
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR,
"DEVID", devId,
"DHID", dhId,
"MSG", errMsg);
if (res != DH_SUCCESS) {
DHLOGE("Write HiSysEvent error, res:%d", res);
}
}
void ReportScreenMirrorEvent(const std::string &eventName, const std::string &devId, const std::string &dhId,
const std::string &errMsg)
{
int32_t res = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_SCREEN,
eventName,
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR,
"DEVID", devId,
"DHID", dhId,
"MSG", errMsg);
if (res != DH_SUCCESS) {
DHLOGE("Write HiSysEvent error, res:%d", res);
+52 -40
View File
@@ -39,49 +39,61 @@
domain: DISTSCREEN
SA_ERROR:
__BASE: {type: FAULT, level: CRITICAL, desc: dscreen sa error occured}
PID: {type: INT32, desc: dscreen pid}
UID: {type: INT32, desc: dscreen uid}
MSG: {type: STRING, desc: dscreen sa error info}
DSCREEN_INIT_FAIL:
__BASE: {type: FAULT, level: CRITICAL, desc: dscreen init sa event}
ERRCODE: {type: INT32, desc: dscreen init fail error code}
SAID: {type: INT32, desc: dscreen SAID}
MSG: {type: STRING, desc: dscreen init sa event}
VIRTUALSCREEN_ERROR:
__BASE: {type: FAULT, level: CRITICAL, desc: virtual screen error occured}
PID: {type: INT32, desc: dscreen pid}
UID: {type: INT32, desc: dscreen uid}
MSG: {type: STRING, desc: dscreen virtual screen error info}
DSCREEN_REGISTER_FAIL:
__BASE: {type: FAULT, level: CRITICAL, desc: dscreen register event}
ERRCODE: {type: INT32, desc: dscreen register fail error code}
DEVID: {type: STRING, desc: dscreen devId}
DHID: {type: STRING, desc: dscreen dhId}
MSG: {type: STRING, desc: dscreen register event}
SOFTBUS_SESSIONSERVER_ERROR:
__BASE: {type: FAULT, level: CRITICAL, desc: softbus sessionserver error occured}
PID: {type: INT32, desc: dscreen pid}
UID: {type: INT32, desc: dscreen uid}
PKGNAME: {type: STRING, desc: softbus package name}
SESSIONNAME: {type: STRING, desc: softbus session name}
MSG: {type: STRING, desc: dscreen softbus sessionserver error info}
DSCREEN_UNREGISTER_FAIL:
__BASE: {type: FAULT, level: CRITICAL, desc: dscreen unregister event}
ERRCODE: {type: INT32, desc: dscreen unregister fail error code}
DEVID: {type: STRING, desc: dscreen devId}
DHID: {type: STRING, desc: dscreen dhId}
MSG: {type: STRING, desc: dscreen unregister event}
SOFTBUS_SESSION_ERROR:
__BASE: {type: FAULT, level: CRITICAL, desc: softbus session error occured}
PID: {type: INT32, desc: dscreen pid}
UID: {type: INT32, desc: dscreen uid}
MYSESSIONNAME: {type: STRING, desc: softbus my session name}
PEERSESSIONNAME: {type: STRING, desc: softbus peer session name}
PEERDEVID: {type: STRING, desc: peer network id}
MSG: {type: STRING, desc: dscreen softbus session error info}
DSCREEN_OPT_FAIL:
__BASE: {type: FAULT, level: CRITICAL, desc: dscreen opt event}
ERRCODE: {type: INT32, desc: dscreen opt fail error code}
MSG: {type: STRING, desc: dscreen opt event}
VIDEO_ENCODER_ERROR:
__BASE: {type: FAULT, level: CRITICAL, desc: video encoder error occured}
PID: {type: INT32, desc: dscreen pid}
UID: {type: INT32, desc: dscreen uid}
MSG: {type: STRING, desc: dscreen video encoder error info}
DSCREEN_INIT:
__BASE: {type: BEHAVIOR, level: MINOR, desc: dscreen init sa event}
SAID: {type: INT32, desc: dscreen SAID}
MSG: {type: STRING, desc: dscreen init sa event}
VIDEO_DECODER_ERROR:
__BASE: {type: FAULT, level: CRITICAL, desc: video decoder error occured}
PID: {type: INT32, desc: dscreen pid}
UID: {type: INT32, desc: dscreen uid}
MSG: {type: STRING, desc: dscreen video decoder error info}
DSCREEN_EXIT:
__BASE: {type: BEHAVIOR, level: MINOR, desc: dscreen release sa event}
SAID: {type: INT32, desc: dscreen SAID}
MSG: {type: STRING, desc: dscreen release sa event}
WINDOW_ERROR:
__BASE: {type: FAULT, level: CRITICAL, desc: screenregion window error occured}
PID: {type: INT32, desc: dscreen pid}
UID: {type: INT32, desc: dscreen uid}
MSG: {type: STRING, desc: dscreen virtual window error info}
DSCREEN_REGISTER:
__BASE: {type: BEHAVIOR, level: MINOR, desc: dscreen register event}
DEVID: {type: STRING, desc: dscreen devId}
DHID: {type: STRING, desc: dscreen dhId}
MSG: {type: STRING, desc: dscreen register event}
DSCREEN_UNREGISTER:
__BASE: {type: BEHAVIOR, level: MINOR, desc: dscreen unregister event}
DEVID: {type: STRING, desc: dscreen devId}
DHID: {type: STRING, desc: dscreen dhId}
MSG: {type: STRING, desc: dscreen unregister event}
DSCREEN_PROJECT_START:
__BASE: {type: BEHAVIOR, level: MINOR, desc: dscreen open event}
DEVID: {type: STRING, desc: dscreen devId}
DHID: {type: STRING, desc: dscreen dhId}
MSG: {type: STRING, desc: dscreen open event}
DSCREEN_PROJECT_END:
__BASE: {type: BEHAVIOR, level: MINOR, desc: dscreen close event}
DEVID: {type: STRING, desc: dscreen devId}
DHID: {type: STRING, desc: dscreen dhId}
MSG: {type: STRING, desc: dscreen close event}
@@ -16,6 +16,7 @@
#include <unistd.h>
#include "dscreen_constants.h"
#include "dscreen_errcode.h"
#include "dscreen_hisysevent.h"
#include "dscreen_log.h"
@@ -42,7 +43,8 @@ void DScreenSinkLoadCallback::OnLoadSystemAbilitySuccess(
void DScreenSinkLoadCallback::OnLoadSystemAbilityFail(int32_t systemAbilityId)
{
DHLOGE("load screen SA failed, systemAbilityId:%d", systemAbilityId);
ReportScreenEvent(SA_ERROR, "dscreen sink OnLoadSystemAbilityFail.");
ReportSaFail(DSCREEN_INIT_FAIL, ERR_DH_SCREEN_SA_SINKPROXY_NOT_INIT, DISTRIBUTED_HARDWARE_SCREEN_SINK_SA_ID,
"dscreen sink OnLoadSystemAbilityFail.");
}
}
}
@@ -51,6 +51,8 @@ int32_t DScreenSinkHandler::InitSink(const std::string &params)
sptr<ISystemAbilityManager> samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
if (!samgr) {
DHLOGE("Failed to get system ability mgr.");
ReportSaFail(DSCREEN_INIT_FAIL, ERR_DH_SCREEN_SA_GET_SAMGR_FAIL, DISTRIBUTED_HARDWARE_SCREEN_SINK_SA_ID,
"dscreen sink get samgr failed.");
return ERR_DH_SCREEN_SA_GET_SAMGR_FAIL;
}
sptr<DScreenSinkLoadCallback> loadCallback = new DScreenSinkLoadCallback(params);
@@ -59,7 +61,8 @@ int32_t DScreenSinkHandler::InitSink(const std::string &params)
if (ret != ERR_OK) {
DHLOGE("Failed to Load systemAbility, systemAbilityId:%d, ret code:%d",
DISTRIBUTED_HARDWARE_SCREEN_SINK_SA_ID, ret);
ReportScreenEvent(SA_ERROR, "dscreen sink LoadSystemAbility call failed.");
ReportSaFail(DSCREEN_INIT_FAIL, ret, DISTRIBUTED_HARDWARE_SCREEN_SINK_SA_ID,
"dscreen sink LoadSystemAbility call failed.");
return ERR_DH_SCREEN_SA_GET_SINKPROXY_FAIL;
}
}
@@ -68,7 +71,8 @@ int32_t DScreenSinkHandler::InitSink(const std::string &params)
[this]() { return dScreenSinkProxy_ != nullptr; });
if (!waitStatus) {
DHLOGE("screen load sa timeout");
ReportScreenEvent(SA_ERROR, "dscreen sink sa load timeout.");
ReportSaFail(DSCREEN_INIT_FAIL, ERR_DH_SCREEN_SA_LOAD_TIMEOUT, DISTRIBUTED_HARDWARE_SCREEN_SINK_SA_ID,
"dscreen sink sa load timeout.");
return ERR_DH_SCREEN_SA_LOAD_TIMEOUT;
}
@@ -85,10 +89,13 @@ void DScreenSinkHandler::FinishStartSA(const std::string &params,
dScreenSinkProxy_ = iface_cast<IDScreenSink>(remoteObject);
if ((!dScreenSinkProxy_) || (!dScreenSinkProxy_->AsObject())) {
DHLOGE("Failed to get dscreen sink proxy.");
ReportSaFail(DSCREEN_INIT_FAIL, ERR_DH_SCREEN_SA_SINKPROXY_NOT_INIT, DISTRIBUTED_HARDWARE_SCREEN_SINK_SA_ID,
"dscreen sink get proxy failed.");
return;
}
dScreenSinkProxy_->InitSink(params);
proxyConVar_.notify_one();
ReportSaEvent(DSCREEN_INIT, DISTRIBUTED_HARDWARE_SCREEN_SINK_SA_ID, "dscreen sink sa load success.");
}
int32_t DScreenSinkHandler::ReleaseSink()
@@ -97,6 +104,8 @@ int32_t DScreenSinkHandler::ReleaseSink()
std::lock_guard<std::mutex> lock(proxyMutex_);
if (!dScreenSinkProxy_) {
DHLOGE("screen sink proxy not init.");
ReportSaFail(DSCREEN_INIT_FAIL, ERR_DH_SCREEN_SA_SINKPROXY_NOT_INIT, DISTRIBUTED_HARDWARE_SCREEN_SINK_SA_ID,
"dscreen sink proxy not init.");
return ERR_DH_SCREEN_SA_SINKPROXY_NOT_INIT;
}
@@ -16,6 +16,7 @@
#include <unistd.h>
#include "dscreen_constants.h"
#include "dscreen_errcode.h"
#include "dscreen_hisysevent.h"
#include "dscreen_log.h"
@@ -41,7 +42,8 @@ void DScreenSourceLoadCallback::OnLoadSystemAbilitySuccess(
void DScreenSourceLoadCallback::OnLoadSystemAbilityFail(int32_t systemAbilityId)
{
DHLOGE("load screen SA failed, systemAbilityId:%d", systemAbilityId);
ReportScreenEvent(SA_ERROR, "dscreen source OnLoadSystemAbilityFail.");
ReportSaFail(DSCREEN_INIT_FAIL, ERR_DH_SCREEN_SA_SINKPROXY_NOT_INIT, DISTRIBUTED_HARDWARE_SCREEN_SOURCE_SA_ID,
"dscreen source OnLoadSystemAbilityFail.");
}
}
}
@@ -56,6 +56,8 @@ int32_t DScreenSourceHandler::InitSource(const std::string &params)
sptr<ISystemAbilityManager> samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
if (!samgr) {
DHLOGE("Failed to get system ability mgr.");
ReportSaFail(DSCREEN_INIT_FAIL, ERR_DH_SCREEN_SA_GET_SAMGR_FAIL, DISTRIBUTED_HARDWARE_SCREEN_SOURCE_SA_ID,
"dscreen source get samgr failed.");
return ERR_DH_SCREEN_SA_GET_SAMGR_FAIL;
}
sptr<DScreenSourceLoadCallback> loadCallback = new DScreenSourceLoadCallback(params);
@@ -64,7 +66,8 @@ int32_t DScreenSourceHandler::InitSource(const std::string &params)
if (ret != ERR_OK) {
DHLOGE("Failed to Load systemAbility, systemAbilityId:%d, ret code:%d",
DISTRIBUTED_HARDWARE_SCREEN_SOURCE_SA_ID, ret);
ReportScreenEvent(SA_ERROR, "dscreen source LoadSystemAbility call failed.");
ReportSaFail(DSCREEN_INIT_FAIL, ret, DISTRIBUTED_HARDWARE_SCREEN_SOURCE_SA_ID,
"dscreen source LoadSystemAbility call failed.");
return ERR_DH_SCREEN_SA_GET_SOURCEPROXY_FAIL;
}
}
@@ -73,7 +76,8 @@ int32_t DScreenSourceHandler::InitSource(const std::string &params)
[this]() { return (dScreenSourceProxy_ != nullptr); });
if (!waitStatus) {
DHLOGE("screen load sa timeout.");
ReportScreenEvent(SA_ERROR, "dscreen source sa load timeout.");
ReportSaFail(DSCREEN_INIT_FAIL, ERR_DH_SCREEN_SA_LOAD_TIMEOUT, DISTRIBUTED_HARDWARE_SCREEN_SOURCE_SA_ID,
"dscreen source sa load timeout.");
return ERR_DH_SCREEN_SA_LOAD_TIMEOUT;
}
@@ -90,10 +94,13 @@ void DScreenSourceHandler::FinishStartSA(const std::string &params,
dScreenSourceProxy_ = iface_cast<IDScreenSource>(remoteObject);
if ((!dScreenSourceProxy_) || (!dScreenSourceProxy_->AsObject())) {
DHLOGE("Failed to get dscreen source proxy.");
ReportSaFail(DSCREEN_INIT_FAIL, ERR_DH_SCREEN_SA_SOURCEPROXY_NOT_INIT, DISTRIBUTED_HARDWARE_SCREEN_SOURCE_SA_ID,
"dscreen source get proxy failed.");
return;
}
dScreenSourceProxy_->InitSource(params, dScreenSourceCallback_);
proxyConVar_.notify_one();
ReportSaEvent(DSCREEN_INIT, DISTRIBUTED_HARDWARE_SCREEN_SOURCE_SA_ID, "dscreen source sa load success.");
}
int32_t DScreenSourceHandler::ReleaseSource()
@@ -102,6 +109,8 @@ int32_t DScreenSourceHandler::ReleaseSource()
std::lock_guard<std::mutex> lock(proxyMutex_);
if (!dScreenSourceProxy_) {
DHLOGE("screen source proxy not init.");
ReportSaFail(DSCREEN_INIT_FAIL, ERR_DH_SCREEN_SA_SOURCEPROXY_NOT_INIT, DISTRIBUTED_HARDWARE_SCREEN_SOURCE_SA_ID,
"dscreen source proxy not init.");
return ERR_DH_SCREEN_SA_SOURCEPROXY_NOT_INIT;
}
int32_t ret = dScreenSourceProxy_->ReleaseSource();
@@ -64,7 +64,6 @@ sptr<Surface> ScreenClientWindowAdapter::CreateWindow(std::shared_ptr<WindowProp
sptr<Rosen::Window> window = Rosen::Window::Create(windowName, option);
if (window == nullptr || window->GetSurfaceNode() == nullptr) {
DHLOGE("Create screen client window failed.");
ReportScreenEvent(WINDOW_ERROR, "create window failed.");
return nullptr;
}
auto surface = window->GetSurfaceNode()->GetSurface();
@@ -113,7 +112,6 @@ int32_t ScreenClientWindowAdapter::ShowWindow(int32_t windowId)
}
if (OHOS::Rosen::WMError::WM_OK != window->Show()) {
DHLOGE("Show window failed.");
ReportScreenEvent(WINDOW_ERROR, "show window failed.");
return ERR_DH_SCREEN_SCREENCLIENT_SHOW_WINDOW_ERROR;
}
DHLOGD("Show window (windowId = %d) success.", windowId);
+10 -8
View File
@@ -137,19 +137,21 @@ int32_t VDecDemo::Stop()
isRunning_.store(false);
if (inputLoop_ != nullptr && inputLoop_->joinable()) {
unique_lock<mutex> lock(signal_->inMutex_);
signal_->inQueue_.push(INDEX_CONSTANT);
signal_->inCond_.notify_all();
lock.unlock();
{
unique_lock<mutex> inLock(signal_->inMutex_);
signal_->inQueue_.push(INDEX_CONSTANT);
signal_->inCond_.notify_all();
}
inputLoop_->join();
inputLoop_.reset();
}
if (outputLoop_ != nullptr && outputLoop_->joinable()) {
unique_lock<mutex> lock(signal_->outMutex_);
signal_->outQueue_.push(INDEX_CONSTANT);
signal_->outCond_.notify_all();
lock.unlock();
{
unique_lock<mutex> outLock(signal_->outMutex_);
signal_->outQueue_.push(INDEX_CONSTANT);
signal_->outCond_.notify_all();
}
outputLoop_->join();
outputLoop_.reset();
}
@@ -18,6 +18,7 @@ import(
ohos_shared_library("distributed_screen_sink") {
include_dirs = [
"//base/hiviewdfx/hisysevent/interfaces/native/innerkits/hisysevent/include",
"//third_party/json/include",
"//utils/native/base/include",
"//utils/system/safwk/native/include",
@@ -24,6 +24,7 @@
#include "dscreen_constants.h"
#include "dscreen_errcode.h"
#include "dscreen_hisysevent.h"
#include "dscreen_log.h"
#include "dscreen_util.h"
@@ -78,6 +79,7 @@ int32_t DScreenSinkService::ReleaseSink()
DHLOGI("ReleaseSink");
ScreenRegionManager::GetInstance().ReleaseAllRegions();
DHLOGI("exit sink sa process");
ReportSaEvent(DSCREEN_EXIT, DISTRIBUTED_HARDWARE_SCREEN_SINK_SA_ID, "dscreen sink sa exit success.");
exit(0);
return DH_SUCCESS;
}
@@ -17,6 +17,7 @@
#include "dscreen_constants.h"
#include "dscreen_errcode.h"
#include "dscreen_hisysevent.h"
#include "dscreen_log.h"
#include "dscreen_util.h"
#include "screen_client.h"
@@ -99,17 +100,20 @@ int32_t ScreenRegion::SetUp()
windowId_ = ScreenClient::GetInstance().AddWindow(windowProperty);
if (windowId_ < 0) {
DHLOGE("AddWindow failed.");
ReportOptFail(DSCREEN_OPT_FAIL, ERR_DH_SCREEN_SA_DSCREEN_SCREENGION_SETUP_FAILED, "AddWindow failed.");
return ERR_DH_SCREEN_SA_DSCREEN_SCREENGION_SETUP_FAILED;
}
int32_t ret = ScreenClient::GetInstance().ShowWindow(windowId_);
if (ret != DH_SUCCESS) {
DHLOGE("show window failed.");
ReportOptFail(DSCREEN_OPT_FAIL, ret, "show window failed.");
return ERR_DH_SCREEN_SA_DSCREEN_SCREENGION_SETUP_FAILED;
}
sptr<Surface> surface = ScreenClient::GetInstance().GetSurface(windowId_);
if (!surface) {
DHLOGE("get window surface failed.");
ReportOptFail(DSCREEN_OPT_FAIL, ERR_DH_SCREEN_SA_DSCREEN_SCREENGION_SETUP_FAILED, "get window surface failed.");
return ERR_DH_SCREEN_SA_DSCREEN_SCREENGION_SETUP_FAILED;
}
@@ -18,6 +18,7 @@ import(
ohos_shared_library("distributed_screen_source") {
include_dirs = [
"//base/hiviewdfx/hisysevent/interfaces/native/innerkits/hisysevent/include",
"//third_party/json/include",
"${windowmanager_path}/interfaces/innerkits/dm",
"//utils/native/base/include",
@@ -97,6 +97,7 @@ private:
void HandleDisable(const std::string &taskId);
void HandleConnect();
void HandleDisconnect();
int32_t CheckJsonData(json &attrJson);
int32_t NegotiateCodecType(const std::string &remoteCodecInfoStr);
int32_t SetUp();
int32_t Start();
@@ -20,6 +20,7 @@
#include "dscreen_constants.h"
#include "dscreen_errcode.h"
#include "dscreen_hisysevent.h"
#include "dscreen_log.h"
#include "dscreen_util.h"
#include "screen_manager_adapter.h"
@@ -182,8 +183,7 @@ void DScreen::HandleTask(const std::shared_ptr<Task> &task)
void DScreen::HandleEnable(const std::string &param, const std::string &taskId)
{
DHLOGI("HandleEnable, devId: %s, dhId: %s", GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str());
if (curState_ == ENABLED || curState_ == ENABLING ||
curState_ == CONNECTING || curState_ == CONNECTED) {
if (curState_ == ENABLED || curState_ == ENABLING || curState_ == CONNECTING || curState_ == CONNECTED) {
dscreenCallback_->OnRegResult(shared_from_this(), taskId, DH_SUCCESS, "");
return;
}
@@ -194,19 +194,13 @@ void DScreen::HandleEnable(const std::string &param, const std::string &taskId)
}
json attrJson = json::parse(param, nullptr, false);
if (attrJson.is_discarded()) {
DHLOGE("enable param json is invalid.");
int32_t ret = CheckJsonData(attrJson);
if (ret != DH_SUCCESS) {
DHLOGE("check json data failed.");
dscreenCallback_->OnRegResult(shared_from_this(), taskId, ERR_DH_SCREEN_SA_ENABLE_FAILED,
"enable param json is invalid.");
return;
}
if (!attrJson.contains(KEY_SCREEN_WIDTH) ||
!attrJson.contains(KEY_SCREEN_HEIGHT) ||
!attrJson.contains(KEY_CODECTYPE)) {
DHLOGE("enable param is invalid.");
dscreenCallback_->OnRegResult(shared_from_this(), taskId, ERR_DH_SCREEN_SA_ENABLE_FAILED,
"enable param is invalid.");
ReportRegisterFail(DSCREEN_REGISTER_FAIL, ERR_DH_SCREEN_SA_ENABLE_FAILED, GetAnonyString(devId_).c_str(),
GetAnonyString(dhId_).c_str(), "check json data failed.");
return;
}
@@ -214,11 +208,13 @@ void DScreen::HandleEnable(const std::string &param, const std::string &taskId)
videoParam_->SetScreenHeight(attrJson[KEY_SCREEN_HEIGHT]);
// negotiate codecType
int32_t ret = NegotiateCodecType(attrJson[KEY_CODECTYPE]);
ret = NegotiateCodecType(attrJson[KEY_CODECTYPE]);
if (ret != DH_SUCCESS) {
DHLOGE("negotiate codec type failed.");
dscreenCallback_->OnRegResult(shared_from_this(), taskId, ERR_DH_SCREEN_SA_ENABLE_FAILED,
"negotiate codec type failed.");
ReportRegisterFail(DSCREEN_REGISTER_FAIL, ERR_DH_SCREEN_SA_ENABLE_FAILED, GetAnonyString(devId_).c_str(),
GetAnonyString(dhId_).c_str(), "negotiate codec type failed.");
return;
}
@@ -227,11 +223,30 @@ void DScreen::HandleEnable(const std::string &param, const std::string &taskId)
DHLOGE("create virtual screen failed.");
dscreenCallback_->OnRegResult(shared_from_this(), taskId, ERR_DH_SCREEN_SA_ENABLE_FAILED,
"create virtual screen failed.");
ReportRegisterFail(DSCREEN_REGISTER_FAIL, ERR_DH_SCREEN_SA_ENABLE_FAILED, GetAnonyString(devId_).c_str(),
GetAnonyString(dhId_).c_str(), "create virtual screen failed.");
return;
}
screenId_ = screenId;
SetState(ENABLED);
dscreenCallback_->OnRegResult(shared_from_this(), taskId, DH_SUCCESS, "");
ReportRegisterScreenEvent(DSCREEN_REGISTER, GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str(),
"dscreen enable success.");
}
int32_t DScreen::CheckJsonData(json &attrJson)
{
if (attrJson.is_discarded()) {
DHLOGE("enable param json is invalid.");
return ERR_DH_SCREEN_SA_ENABLE_JSON_ERROR;
}
if (!attrJson.contains(KEY_SCREEN_WIDTH) || !attrJson.contains(KEY_SCREEN_HEIGHT) ||
!attrJson.contains(KEY_CODECTYPE)) {
DHLOGE("enable param is invalid.");
return ERR_DH_SCREEN_SA_ENABLE_JSON_ERROR;
}
return DH_SUCCESS;
}
int32_t DScreen::NegotiateCodecType(const std::string &remoteCodecInfoStr)
@@ -284,10 +299,14 @@ void DScreen::HandleDisable(const std::string &taskId)
DHLOGE("remove virtual screen failed.");
dscreenCallback_->OnUnregResult(shared_from_this(), taskId, ERR_DH_SCREEN_SA_DISABLE_FAILED,
"remove virtual screen failed.");
ReportUnRegisterFail(DSCREEN_UNREGISTER_FAIL, ERR_DH_SCREEN_SA_DISABLE_FAILED, GetAnonyString(devId_).c_str(),
GetAnonyString(dhId_).c_str(), "remove virtual screen failed.");
return;
}
SetState(DISABLED);
dscreenCallback_->OnUnregResult(shared_from_this(), taskId, DH_SUCCESS, "");
ReportUnRegisterScreenEvent(DSCREEN_UNREGISTER, GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str(),
"dscreen disable success.");
}
void DScreen::HandleConnect()
@@ -311,6 +330,8 @@ void DScreen::HandleConnect()
return;
}
SetState(CONNECTED);
ReportScreenMirrorEvent(DSCREEN_PROJECT_START, GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str(),
"dscreen connect success");
}
void DScreen::HandleDisconnect()
@@ -329,6 +350,8 @@ void DScreen::HandleDisconnect()
return;
}
SetState(ENABLED);
ReportScreenMirrorEvent(DSCREEN_PROJECT_END, GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str(),
"dscreen disconnect success");
}
int32_t DScreen::SetUp()
@@ -49,7 +49,6 @@ uint64_t ScreenMgrAdapter::CreateVirtualScreen(const std::string &devId, const s
Rosen::DMError err = Rosen::ScreenManager::GetInstance().DestroyVirtualScreen(iter->second);
if (err != Rosen::DMError::DM_OK) {
DHLOGE("remove virtual screen failed, screenId:%ulld", iter->second);
ReportScreenEvent(VIRTUALSCREEN_ERROR, "destroy virtual screen failed.");
return SCREEN_ID_INVALID;
}
screenIdMap_.erase(screenName);
@@ -66,9 +65,6 @@ uint64_t ScreenMgrAdapter::CreateVirtualScreen(const std::string &devId, const s
};
uint64_t screenId = Rosen::ScreenManager::GetInstance().CreateVirtualScreen(option);
if (screenId == SCREEN_ID_INVALID) {
ReportScreenEvent(VIRTUALSCREEN_ERROR, "create virtual screen failed.");
}
screenIdMap_.emplace(screenName, screenId);
return screenId;
}
@@ -119,7 +115,6 @@ int32_t ScreenMgrAdapter::RemoveVirtualScreen(uint64_t screenId)
Rosen::DMError err = Rosen::ScreenManager::GetInstance().DestroyVirtualScreen(screenId);
if (err != Rosen::DMError::DM_OK) {
DHLOGE("remove virtual screen failed, screenId:%ulld", screenId);
ReportScreenEvent(VIRTUALSCREEN_ERROR, "destroy virtual screen failed.");
return ERR_DH_SCREEN_SA_REMOVE_VIRTUALSCREEN_FAIL;
}
return DH_SUCCESS;
@@ -24,6 +24,7 @@
#include "dscreen_constants.h"
#include "dscreen_errcode.h"
#include "dscreen_hisysevent.h"
#include "dscreen_log.h"
#include "dscreen_util.h"
@@ -94,6 +95,7 @@ int32_t DScreenSourceService::ReleaseSource()
return ret;
}
DHLOGI("exit source sa process");
ReportSaEvent(DSCREEN_EXIT, DISTRIBUTED_HARDWARE_SCREEN_SOURCE_SA_ID, "dscreen source sa exit success.");
exit(0);
return DH_SUCCESS;
}
@@ -110,6 +112,8 @@ int32_t DScreenSourceService::RegisterDistributedHardware(const std::string &dev
if (ret != DH_SUCCESS) {
DHLOGE("enable distributedScreen failed. devId: %s, dhId: %s, reqId: %s, attrs: %s",
GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str(), reqId.c_str(), attrs.c_str());
ReportRegisterFail(DSCREEN_REGISTER_FAIL, ret, GetAnonyString(devId).c_str(),
GetAnonyString(dhId).c_str(), "enable distributedScreen failed.");
return ERR_DH_SCREEN_SA_ENABLE_FAILED;
}
return DH_SUCCESS;
@@ -123,6 +127,8 @@ int32_t DScreenSourceService::UnregisterDistributedHardware(const std::string &d
if (ret != DH_SUCCESS) {
DHLOGE("disable distributedScreen failed. devId: %s, dhId: %s, reqId: %s",
GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str(), reqId.c_str());
ReportUnRegisterFail(DSCREEN_REGISTER_FAIL, ret, GetAnonyString(devId).c_str(),
GetAnonyString(dhId).c_str(), "disable distributedScreen failed.");
return ERR_DH_SCREEN_SA_DISABLE_FAILED;
}
return DH_SUCCESS;
@@ -19,6 +19,7 @@
#include "dscreen_constants.h"
#include "dscreen_errcode.h"
#include "dscreen_hisysevent.h"
#include "dscreen_log.h"
#include "dscreen_util.h"
@@ -77,6 +78,7 @@ int32_t ScreenDataChannelImpl::OpenSession()
SoftbusAdapter::GetInstance().OpenSoftbusSession(DATA_SESSION_NAME, DATA_SESSION_NAME, peerDevId_);
if (sessionId < 0) {
DHLOGE("%s: Open screen session failed, ret: %d", LOG_TAG, sessionId);
ReportOptFail(DSCREEN_OPT_FAIL, sessionId, "Open screen session failed");
return ERR_DH_SCREEN_TRANS_ERROR;
}
sessionId_ = sessionId;
@@ -79,7 +79,6 @@ int32_t ImageSinkDecoder::StartDecoder()
ret = videoDecoder_->Start();
if (ret != Media::MSERR_OK) {
DHLOGE("%s: Start decoder failed.", LOG_TAG);
ReportScreenEvent(VIDEO_DECODER_ERROR, "video decoder start failed.");
return ERR_DH_SCREEN_CODEC_START_FAILED;
}
StartInputThread();
@@ -104,7 +103,6 @@ int32_t ImageSinkDecoder::StopDecoder()
ret = videoDecoder_->Stop();
if (ret != Media::MSERR_OK) {
DHLOGE("%s: Stop decoder failed.", LOG_TAG);
ReportScreenEvent(VIDEO_DECODER_ERROR, "video decoder stop failed.");
return ERR_DH_SCREEN_CODEC_STOP_FAILED;
}
StopInputThread();
@@ -16,6 +16,7 @@
#include "image_sink_processor.h"
#include "dscreen_errcode.h"
#include "dscreen_hisysevent.h"
#include "dscreen_hitrace.h"
#include "dscreen_log.h"
@@ -49,6 +50,7 @@ int32_t ImageSinkProcessor::ReleaseImageProcessor()
DHLOGI("%s: ReleaseImageProcessor.", LOG_TAG);
if (imageDecoder_ == nullptr) {
DHLOGE("%s: Decoder is null.", LOG_TAG);
ReportOptFail(DSCREEN_OPT_FAIL, ERR_DH_SCREEN_TRANS_NULL_VALUE, "ReleaseImageProcessor Decoder is null.");
return ERR_DH_SCREEN_TRANS_NULL_VALUE;
}
@@ -57,6 +59,7 @@ int32_t ImageSinkProcessor::ReleaseImageProcessor()
FinishTrace(DSCREEN_HITRACE_LABEL);
if (ret != DH_SUCCESS) {
DHLOGE("%s: ReleaseDecoder failed.", LOG_TAG);
ReportOptFail(DSCREEN_OPT_FAIL, ret, "ReleaseDecoder failed.");
return ret;
}
@@ -68,6 +71,7 @@ int32_t ImageSinkProcessor::StartImageProcessor()
DHLOGI("%s: StartImageProcessor.", LOG_TAG);
if (imageDecoder_ == nullptr) {
DHLOGE("%s: Decoder is null.", LOG_TAG);
ReportOptFail(DSCREEN_OPT_FAIL, ERR_DH_SCREEN_TRANS_NULL_VALUE, "StartImageProcessor Decoder is null.");
return ERR_DH_SCREEN_TRANS_NULL_VALUE;
}
@@ -76,6 +80,7 @@ int32_t ImageSinkProcessor::StartImageProcessor()
FinishTrace(DSCREEN_HITRACE_LABEL);
if (ret != DH_SUCCESS) {
DHLOGE("%s: StartDecoder failed ret:%d.", LOG_TAG, ret);
ReportOptFail(DSCREEN_OPT_FAIL, ret, "StartDecoder failed.");
return ret;
}
@@ -87,6 +92,7 @@ int32_t ImageSinkProcessor::StopImageProcessor()
DHLOGI("%s: StopImageProcessor.", LOG_TAG);
if (imageDecoder_ == nullptr) {
DHLOGE("%s: Decoder is null.", LOG_TAG);
ReportOptFail(DSCREEN_OPT_FAIL, ERR_DH_SCREEN_TRANS_NULL_VALUE, "StopImageProcessor Decoder is null.");
return ERR_DH_SCREEN_TRANS_NULL_VALUE;
}
@@ -95,6 +101,7 @@ int32_t ImageSinkProcessor::StopImageProcessor()
FinishTrace(DSCREEN_HITRACE_LABEL);
if (ret != DH_SUCCESS) {
DHLOGE("%s: StopDecoder failed ret:%d.", LOG_TAG, ret);
ReportOptFail(DSCREEN_OPT_FAIL, ret, "StopDecoder failed.");
return ret;
}
@@ -106,12 +113,14 @@ int32_t ImageSinkProcessor::SetImageSurface(sptr<Surface> &surface)
DHLOGI("%s: SetImageSurface.", LOG_TAG);
if (imageDecoder_ == nullptr) {
DHLOGE("%s: Decoder is null.", LOG_TAG);
ReportOptFail(DSCREEN_OPT_FAIL, ERR_DH_SCREEN_TRANS_NULL_VALUE, "SetImageSurface Decoder is null.");
return ERR_DH_SCREEN_TRANS_NULL_VALUE;
}
int32_t ret = imageDecoder_->SetOutputSurface(surface);
if (ret != DH_SUCCESS) {
DHLOGE("%s: SetOutputSurface failed ret:%d.", LOG_TAG, ret);
ReportOptFail(DSCREEN_OPT_FAIL, ret, "SetOutputSurface failed.");
return ret;
}
@@ -123,12 +132,14 @@ int32_t ImageSinkProcessor::ProcessImage(const std::shared_ptr<DataBuffer> &data
DHLOGI("%s: ProcessImage.", LOG_TAG);
if (imageDecoder_ == nullptr) {
DHLOGE("%s: Decoder is null.", LOG_TAG);
ReportOptFail(DSCREEN_OPT_FAIL, ERR_DH_SCREEN_TRANS_NULL_VALUE, "processImage Decoder is null.");
return ERR_DH_SCREEN_TRANS_NULL_VALUE;
}
int32_t ret = imageDecoder_->InputScreenData(data);
if (ret != DH_SUCCESS) {
DHLOGE("%s: InputScreenData failed ret:%d.", LOG_TAG, ret);
ReportOptFail(DSCREEN_OPT_FAIL, ret, "InputScreenData failed.");
return ret;
}
@@ -18,6 +18,7 @@ import(
ohos_shared_library("distributed_screen_sinktrans") {
include_dirs = [
"//base/hiviewdfx/hisysevent/interfaces/native/innerkits/hisysevent/include",
"//third_party/json/include",
"//foundation/graphic/graphic_2d/interfaces/innerkits/surface",
"${fwk_common_path}/utils/include",
@@ -16,6 +16,7 @@
#include "screen_sink_trans.h"
#include "dscreen_errcode.h"
#include "dscreen_hisysevent.h"
#include "dscreen_hitrace.h"
#include "dscreen_log.h"
#include "image_sink_processor.h"
@@ -247,6 +248,7 @@ int32_t ScreenSinkTrans::RegisterChannelListener()
int32_t ret = screenChannel_->CreateSession(listener);
if (ret != DH_SUCCESS) {
DHLOGE("%s: Register channel listenner failed ret: %d.", LOG_TAG, ret);
ReportOptFail(DSCREEN_OPT_FAIL, ret, "dscreen sink Create session failed.");
return ret;
}
@@ -266,6 +268,7 @@ int32_t ScreenSinkTrans::RegisterProcessorListener(const VideoParam &localParam,
int32_t ret = imageProcessor_->ConfigureImageProcessor(localParam, remoteParam, listener);
if (ret != DH_SUCCESS) {
DHLOGE("%s: Config image processor failed ret: %d.", LOG_TAG, ret);
ReportOptFail(DSCREEN_OPT_FAIL, ret, "Config image processor failed.");
return ret;
}
@@ -85,7 +85,6 @@ int32_t ImageSourceEncoder::StartEncoder()
ret = videoEncoder_->Start();
if (ret != Media::MSERR_OK) {
DHLOGE("%s: Start encoder failed.", LOG_TAG);
ReportScreenEvent(VIDEO_ENCODER_ERROR, "video encoder start failed.");
return ERR_DH_SCREEN_CODEC_START_FAILED;
}
@@ -108,7 +107,6 @@ int32_t ImageSourceEncoder::StopEncoder()
ret = videoEncoder_->Stop();
if (ret != Media::MSERR_OK) {
DHLOGE("%s: Stop encoder failed.", LOG_TAG);
ReportScreenEvent(VIDEO_ENCODER_ERROR, "video encoder stop failed.");
return ERR_DH_SCREEN_CODEC_STOP_FAILED;
}
@@ -16,6 +16,7 @@
#include "image_source_processor.h"
#include "dscreen_errcode.h"
#include "dscreen_hisysevent.h"
#include "dscreen_hitrace.h"
#include "dscreen_log.h"
@@ -47,6 +48,7 @@ int32_t ImageSourceProcessor::ReleaseImageProcessor()
DHLOGI("%s: ReleaseImageProcessor.", LOG_TAG);
if (!imageEncoder_) {
DHLOGE("%s: Create screen encoder failed.", LOG_TAG);
ReportOptFail(DSCREEN_OPT_FAIL, ERR_DH_SCREEN_TRANS_NULL_VALUE, "ReleaseImageProcessor encoder is nullptr.");
return ERR_DH_SCREEN_TRANS_NULL_VALUE;
}
@@ -55,6 +57,7 @@ int32_t ImageSourceProcessor::ReleaseImageProcessor()
FinishTrace(DSCREEN_HITRACE_LABEL);
if (ret != DH_SUCCESS) {
DHLOGE("%s: Release screen encoder failed ret: %d.", LOG_TAG, ret);
ReportOptFail(DSCREEN_OPT_FAIL, ret, "Release screen encoder failed.");
return ret;
}
@@ -66,6 +69,7 @@ int32_t ImageSourceProcessor::StartImageProcessor()
DHLOGI("%s: StartImageProcessor.", LOG_TAG);
if (!imageEncoder_) {
DHLOGE("%s: Create screen encoder failed.", LOG_TAG);
ReportOptFail(DSCREEN_OPT_FAIL, ERR_DH_SCREEN_TRANS_NULL_VALUE, "StartImageProcessor encoder is nullptr.");
return ERR_DH_SCREEN_TRANS_NULL_VALUE;
}
@@ -74,6 +78,7 @@ int32_t ImageSourceProcessor::StartImageProcessor()
FinishTrace(DSCREEN_HITRACE_LABEL);
if (ret != DH_SUCCESS) {
DHLOGE("%s: Start screen encoder failed ret: %d.", LOG_TAG, ret);
ReportOptFail(DSCREEN_OPT_FAIL, ret, "Start screen encoder failed.");
return ret;
}
@@ -85,6 +90,7 @@ int32_t ImageSourceProcessor::StopImageProcessor()
DHLOGI("%s: StopImageProcessor.", LOG_TAG);
if (!imageEncoder_) {
DHLOGE("%s: Create screen encoder failed.", LOG_TAG);
ReportOptFail(DSCREEN_OPT_FAIL, ERR_DH_SCREEN_TRANS_NULL_VALUE, "StopImageProcessor encoder is nullptr.");
return ERR_DH_SCREEN_TRANS_NULL_VALUE;
}
@@ -93,6 +99,7 @@ int32_t ImageSourceProcessor::StopImageProcessor()
FinishTrace(DSCREEN_HITRACE_LABEL);
if (ret != DH_SUCCESS) {
DHLOGE("%s: Stop screen encoder failed ret: %d.", LOG_TAG, ret);
ReportOptFail(DSCREEN_OPT_FAIL, ret, "Stop screen encoder failed.");
return ret;
}
@@ -18,6 +18,7 @@ import(
ohos_shared_library("distributed_screen_sourcetrans") {
include_dirs = [
"//base/hiviewdfx/hisysevent/interfaces/native/innerkits/hisysevent/include",
"//third_party/json/include",
"//foundation/graphic/graphic_2d/interfaces/innerkits/surface",
"${fwk_common_path}/utils/include",
@@ -18,6 +18,7 @@
#include <chrono>
#include "dscreen_errcode.h"
#include "dscreen_hisysevent.h"
#include "dscreen_hitrace.h"
#include "dscreen_log.h"
#include "image_source_processor.h"
@@ -267,6 +268,7 @@ int32_t ScreenSourceTrans::RegisterChannelListener()
int32_t ret = screenChannel_->CreateSession(listener);
if (ret != DH_SUCCESS) {
DHLOGE("%s: Create session failed ret: %d.", LOG_TAG);
ReportOptFail(DSCREEN_OPT_FAIL, ret, "dscreen source Create session failed.");
return ret;
}
@@ -285,6 +287,7 @@ int32_t ScreenSourceTrans::RegisterProcessorListener(const VideoParam &localPara
int32_t ret = imageProcessor_->ConfigureImageProcessor(localParam, remoteParam, listener);
if (ret != DH_SUCCESS) {
DHLOGE("%s: Config image processor failed ret: %d.", LOG_TAG, ret);
ReportOptFail(DSCREEN_OPT_FAIL, ret, "Config image processor failed.");
return ret;
}
@@ -111,7 +111,6 @@ int32_t SoftbusAdapter::CreateSoftbusSessionServer(const std::string &pkgname, c
int32_t ret = CreateSessionServer(pkgname.c_str(), sessionName.c_str(), &sessListener_);
if (ret != DH_SUCCESS) {
DHLOGE("%s: CreateSessionServer failed.", LOG_TAG);
ReportScreenEvent(SOFTBUS_SESSIONSERVER_ERROR, "create session server failed.");
return ret;
}
} else {
@@ -139,7 +138,6 @@ int32_t SoftbusAdapter::RemoveSoftbusSessionServer(const std::string &pkgname, c
int32_t ret = RemoveSessionServer(pkgname.c_str(), sessionName.c_str());
if (ret != DH_SUCCESS) {
DHLOGE("%s: RemoveSessionServer failed.", LOG_TAG);
ReportScreenEvent(SOFTBUS_SESSIONSERVER_ERROR, "remove session server failed.");
return ret;
}
@@ -181,7 +179,6 @@ int32_t SoftbusAdapter::OpenSoftbusSession(const std::string &mySessionName, con
int32_t sessionId = OpenSession(mySessionName.c_str(), peerSessionName.c_str(), peerDevId.c_str(), "0", &attr);
if (sessionId < 0) {
DHLOGE("%s: OpenSession failed sessionId:%d.", LOG_TAG, sessionId);
ReportScreenEvent(SOFTBUS_SESSION_ERROR, "open session failed.");
return ERR_DH_SCREEN_ADAPTER_OPEN_SESSION_FAIL;
}