mirror of
https://github.com/openharmony/distributed_screen.git
synced 2026-07-19 17:04:08 -04:00
hisysevent for screen
Signed-off-by: gaoqiang_strong <gaoqiang64@huawei.com>
This commit is contained in:
@@ -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",
|
||||
]
|
||||
|
||||
|
||||
@@ -22,15 +22,44 @@
|
||||
|
||||
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 SA_ERROR = "DSCREEN_INIT_FAIL";
|
||||
const std::string REGISTER_ERROR = "DSCREEN_REGISTER_FAIL";
|
||||
const std::string UNREGISTER_ERROR = "DSCREEN_UNREGISTER_FAIL";
|
||||
const std::string WINDOW_ERROR = "DSCREEN_WINDOW_FAIL";
|
||||
const std::string VIDEO_ENCODER_ERROR = "DSCREEN_ENCODE_FAIL";
|
||||
const std::string VIDEO_DECODER_ERROR = "DSCREEN_DECODE_FAIL";
|
||||
const std::string SOFTBUS_SESSIONSERVER_ERROR = "DSCREEN_CREATE_SESSIONSVR_FAIL";
|
||||
const std::string SOFTBUS_SESSION_ERROR = "DSCREEN_OPEN_SESSION_FAIL";
|
||||
|
||||
void ReportScreenEvent(const std::string &eventName, const std::string &errMsg);
|
||||
const std::string SA_START = "DSCREEN_INIT";
|
||||
const std::string ENABLE_REGISTER = "DSCREEN_REGISTER";
|
||||
const std::string DISABLE_UNREGISTER = "DSCREEN_UNREGISTER";
|
||||
const std::string PROJECT_START = "DSCREEN_PROJECT_START";
|
||||
const std::string PROJECT_END = "DSCREEN_PROJECT_END";
|
||||
const std::string SA_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 ReportWindowFail(const std::string &eventName, int32_t errCode, const std::string &errMsg);
|
||||
void ReportVideoEncoderFail(const std::string &eventName, int32_t errCode, int32_t width, int32_t height,
|
||||
uint8_t format, const std::string &errMsg);
|
||||
void ReportVideoDecoderFail(const std::string eventName, int32_t errCode, int32_t width, int32_t height,
|
||||
uint8_t format, const std::string &errMsg);
|
||||
void ReportSoftbusSessionServerFail(const std::string &eventName, int32_t errCode, const std::string &pkgName,
|
||||
const std::string &sessionName, const std::string &errMsg);
|
||||
void ReportSoftbusSessionFail(const std::string &eventName, int32_t errCode, const std::string &sessName,
|
||||
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
|
||||
@@ -12,23 +12,192 @@
|
||||
* 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 ReportWindowFail(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 ReportVideoEncoderFail(const std::string &eventName, int32_t errCode, int32_t width, int32_t height,
|
||||
uint8_t format, 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,
|
||||
"WIDTH", width,
|
||||
"HEIGHT", height,
|
||||
"FORMAT", format,
|
||||
"MSG", errMsg);
|
||||
if (res != DH_SUCCESS) {
|
||||
DHLOGE("Write HiSysEvent error, res:%d", res);
|
||||
}
|
||||
}
|
||||
|
||||
void ReportVideoDecoderFail(const std::string eventName, int32_t errCode, int32_t width, int32_t height,
|
||||
uint8_t format, 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,
|
||||
"WIDTH", width,
|
||||
"HEIGHT", height,
|
||||
"FORMAT", format,
|
||||
"MSG", errMsg);
|
||||
if (res != DH_SUCCESS) {
|
||||
DHLOGE("Write HiSysEvent error, res:%d", res);
|
||||
}
|
||||
}
|
||||
|
||||
void ReportSoftbusSessionServerFail(const std::string &eventName, int32_t errCode, const std::string &pkgName,
|
||||
const std::string &sessionName, 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,
|
||||
"PKGNAME", pkgName,
|
||||
"SESSIONNAME", sessionName,
|
||||
"MSG", errMsg);
|
||||
if (res != DH_SUCCESS) {
|
||||
DHLOGE("Write HiSysEvent error, res:%d", res);
|
||||
}
|
||||
}
|
||||
|
||||
void ReportSoftbusSessionFail(const std::string &eventName, int32_t errCode, const std::string &sessName,
|
||||
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,
|
||||
"SESSIONNAME", sessName,
|
||||
"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);
|
||||
|
||||
+77
-36
@@ -39,49 +39,90 @@
|
||||
|
||||
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: BEHAVIOR, level: MINOR, 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: BEHAVIOR, level: MINOR, 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}
|
||||
DSCREEN_UNREGISTER_FAIL:
|
||||
__BASE: {type: BEHAVIOR, level: MINOR, 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}
|
||||
|
||||
DSCREEN_WINDOW_FAIL:
|
||||
__BASE: {type: FAULT, level: CRITICAL, desc: dscreen sink window error event}
|
||||
ERRCODE: {type: INT32, desc: dscreen sink window error code}
|
||||
MSG: {type: STRING, desc: dscreen sink window error info}
|
||||
|
||||
DSCREEN_ENCODE_FAIL:
|
||||
__BASE: {type: FAULT, level: CRITICAL, desc: dscreen video encoder error event}
|
||||
ERRCODE: {type: INT32, desc: dscreen encoder error code}
|
||||
WIDTH: {type: INT32, desc: dscreen width}
|
||||
HEIGHT: {type: INT32, desc: dscreen height}
|
||||
FORMAT: {type: UINT32, desc: dscreen format}
|
||||
MSG: {type: STRING, desc: dscreen video encoder error info}
|
||||
|
||||
DSCREEN_DECODE_FAIL:
|
||||
__BASE: {type: FAULT, level: CRITICAL, desc: dscreen video decoder error event}
|
||||
ERRCODE: {type: INT32, desc: dscreen decoder error code}
|
||||
WIDTH: {type: INT32, desc: dscreen width}
|
||||
HEIGHT: {type: INT32, desc: dscreen height}
|
||||
FORMAT: {type: UINT32, desc: dscreen format}
|
||||
MSG: {type: STRING, desc: dscreen video decoder error info}
|
||||
|
||||
DSCREEN_CREATE_SESSIONSVR_FAIL:
|
||||
__BASE: {type: FAULT, level: CRITICAL, desc: dscreen softbus sessionserver error event}
|
||||
ERRCODE: {type: INT32, desc: dscreen create session server fail error code}
|
||||
PKGNAME: {type: STRING, desc: softbus package name}
|
||||
SESSIONNAME: {type: STRING, desc: softbus session name}
|
||||
MSG: {type: STRING, desc: dscreen softbus sessionserver error info}
|
||||
|
||||
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}
|
||||
DSCREEN_OPEN_SESSION_FAIL:
|
||||
__BASE: {type: FAULT, level: CRITICAL, desc: dscreen softbus session error event}
|
||||
ERRCODE: {type: INT32, desc: dscreen open session fail error code}
|
||||
SESSIONNAME: {type: STRING, desc: softbus my session name}
|
||||
MSG: {type: STRING, desc: dscreen softbus session error info}
|
||||
|
||||
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}
|
||||
+3
-1
@@ -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(SA_ERROR, 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 ¶ms)
|
||||
sptr<ISystemAbilityManager> samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
if (!samgr) {
|
||||
DHLOGE("Failed to get system ability mgr.");
|
||||
ReportSaFail(SA_ERROR, 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 ¶ms)
|
||||
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(SA_ERROR, 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 ¶ms)
|
||||
[this]() { return dScreenSinkProxy_ != nullptr; });
|
||||
if (!waitStatus) {
|
||||
DHLOGE("screen load sa timeout");
|
||||
ReportScreenEvent(SA_ERROR, "dscreen sink sa load timeout.");
|
||||
ReportSaFail(SA_ERROR, 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 ¶ms,
|
||||
dScreenSinkProxy_ = iface_cast<IDScreenSink>(remoteObject);
|
||||
if ((!dScreenSinkProxy_) || (!dScreenSinkProxy_->AsObject())) {
|
||||
DHLOGE("Failed to get dscreen sink proxy.");
|
||||
ReportSaFail(SA_ERROR, 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(SA_START, 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(SA_ERROR, 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;
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -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(SA_ERROR, 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 ¶ms)
|
||||
sptr<ISystemAbilityManager> samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
if (!samgr) {
|
||||
DHLOGE("Failed to get system ability mgr.");
|
||||
ReportSaFail(SA_ERROR, 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 ¶ms)
|
||||
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(SA_ERROR, 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 ¶ms)
|
||||
[this]() { return (dScreenSourceProxy_ != nullptr); });
|
||||
if (!waitStatus) {
|
||||
DHLOGE("screen load sa timeout.");
|
||||
ReportScreenEvent(SA_ERROR, "dscreen source sa load timeout.");
|
||||
ReportSaFail(SA_ERROR, 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 ¶ms,
|
||||
dScreenSourceProxy_ = iface_cast<IDScreenSource>(remoteObject);
|
||||
if ((!dScreenSourceProxy_) || (!dScreenSourceProxy_->AsObject())) {
|
||||
DHLOGE("Failed to get dscreen source proxy.");
|
||||
ReportSaFail(SA_ERROR, 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(SA_START, 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(SA_ERROR, 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);
|
||||
|
||||
@@ -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(SA_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.");
|
||||
ReportWindowFail(WINDOW_ERROR, 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.");
|
||||
ReportWindowFail(WINDOW_ERROR, 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.");
|
||||
ReportWindowFail(WINDOW_ERROR, 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",
|
||||
|
||||
@@ -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"
|
||||
@@ -198,6 +199,8 @@ void DScreen::HandleEnable(const std::string ¶m, const std::string &taskId)
|
||||
DHLOGE("enable param json is invalid.");
|
||||
dscreenCallback_->OnRegResult(shared_from_this(), taskId, ERR_DH_SCREEN_SA_ENABLE_FAILED,
|
||||
"enable param json is invalid.");
|
||||
ReportRegisterFail(REGISTER_ERROR, ERR_DH_SCREEN_SA_ENABLE_FAILED, GetAnonyString(devId_).c_str(),
|
||||
GetAnonyString(dhId_).c_str(), "enable param json is invalid.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -207,6 +210,8 @@ void DScreen::HandleEnable(const std::string ¶m, const std::string &taskId)
|
||||
DHLOGE("enable param is invalid.");
|
||||
dscreenCallback_->OnRegResult(shared_from_this(), taskId, ERR_DH_SCREEN_SA_ENABLE_FAILED,
|
||||
"enable param is invalid.");
|
||||
ReportRegisterFail(REGISTER_ERROR, ERR_DH_SCREEN_SA_ENABLE_FAILED, GetAnonyString(devId_).c_str(),
|
||||
GetAnonyString(dhId_).c_str(), "enable param is invalid.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -219,6 +224,8 @@ void DScreen::HandleEnable(const std::string ¶m, const std::string &taskId)
|
||||
DHLOGE("negotiate codec type failed.");
|
||||
dscreenCallback_->OnRegResult(shared_from_this(), taskId, ERR_DH_SCREEN_SA_ENABLE_FAILED,
|
||||
"negotiate codec type failed.");
|
||||
ReportRegisterFail(REGISTER_ERROR, ERR_DH_SCREEN_SA_ENABLE_FAILED, GetAnonyString(devId_).c_str(),
|
||||
GetAnonyString(dhId_).c_str(), "negotiate codec type failed.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -227,11 +234,15 @@ void DScreen::HandleEnable(const std::string ¶m, 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(REGISTER_ERROR, 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(ENABLE_REGISTER, GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str(),
|
||||
"dscreen enable success.");
|
||||
}
|
||||
|
||||
int32_t DScreen::NegotiateCodecType(const std::string &remoteCodecInfoStr)
|
||||
@@ -284,10 +295,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(UNREGISTER_ERROR, 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(DISABLE_UNREGISTER, GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str(),
|
||||
"dscreen disable success.");
|
||||
}
|
||||
|
||||
void DScreen::HandleConnect()
|
||||
@@ -311,6 +326,8 @@ void DScreen::HandleConnect()
|
||||
return;
|
||||
}
|
||||
SetState(CONNECTED);
|
||||
ReportScreenMirrorEvent(PROJECT_START, GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str(),
|
||||
"dscreen connect success");
|
||||
}
|
||||
|
||||
void DScreen::HandleDisconnect()
|
||||
@@ -329,6 +346,8 @@ void DScreen::HandleDisconnect()
|
||||
return;
|
||||
}
|
||||
SetState(ENABLED);
|
||||
ReportScreenMirrorEvent(PROJECT_END, GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str(),
|
||||
"dscreen disconnect success");
|
||||
}
|
||||
|
||||
int32_t DScreen::SetUp()
|
||||
|
||||
@@ -47,7 +47,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);
|
||||
@@ -64,9 +63,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;
|
||||
}
|
||||
@@ -117,7 +113,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(SA_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(REGISTER_ERROR, 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(UNREGISTER_ERROR, 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);
|
||||
ReportSoftbusSessionFail(SOFTBUS_SESSION_ERROR, sessionId, DATA_SESSION_NAME, "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,8 @@ int32_t ImageSinkProcessor::ReleaseImageProcessor()
|
||||
DHLOGI("%s: ReleaseImageProcessor.", LOG_TAG);
|
||||
if (imageDecoder_ == nullptr) {
|
||||
DHLOGE("%s: Decoder is null.", LOG_TAG);
|
||||
ReportVideoDecoderFail(VIDEO_DECODER_ERROR, ERR_DH_SCREEN_TRANS_NULL_VALUE, localParam_.GetVideoWidth(),
|
||||
localParam_.GetVideoHeight(), localParam_.GetVideoFormat(), "Decoder is null.");
|
||||
return ERR_DH_SCREEN_TRANS_NULL_VALUE;
|
||||
}
|
||||
|
||||
@@ -57,6 +60,8 @@ int32_t ImageSinkProcessor::ReleaseImageProcessor()
|
||||
FinishTrace(DSCREEN_HITRACE_LABEL);
|
||||
if (ret != DH_SUCCESS) {
|
||||
DHLOGE("%s: ReleaseDecoder failed.", LOG_TAG);
|
||||
ReportVideoDecoderFail(VIDEO_DECODER_ERROR, ret, localParam_.GetVideoWidth(),
|
||||
localParam_.GetVideoHeight(), localParam_.GetVideoFormat(), "ReleaseDecoder failed.");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -68,6 +73,8 @@ int32_t ImageSinkProcessor::StartImageProcessor()
|
||||
DHLOGI("%s: StartImageProcessor.", LOG_TAG);
|
||||
if (imageDecoder_ == nullptr) {
|
||||
DHLOGE("%s: Decoder is null.", LOG_TAG);
|
||||
ReportVideoDecoderFail(VIDEO_DECODER_ERROR, ERR_DH_SCREEN_TRANS_NULL_VALUE, localParam_.GetVideoWidth(),
|
||||
localParam_.GetVideoHeight(), localParam_.GetVideoFormat(), "Decoder is null.");
|
||||
return ERR_DH_SCREEN_TRANS_NULL_VALUE;
|
||||
}
|
||||
|
||||
@@ -76,6 +83,8 @@ int32_t ImageSinkProcessor::StartImageProcessor()
|
||||
FinishTrace(DSCREEN_HITRACE_LABEL);
|
||||
if (ret != DH_SUCCESS) {
|
||||
DHLOGE("%s: StartDecoder failed ret:%d.", LOG_TAG, ret);
|
||||
ReportVideoDecoderFail(VIDEO_DECODER_ERROR, ret, localParam_.GetVideoWidth(),
|
||||
localParam_.GetVideoHeight(), localParam_.GetVideoFormat(), "StartDecoder failed.");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -87,6 +96,8 @@ int32_t ImageSinkProcessor::StopImageProcessor()
|
||||
DHLOGI("%s: StopImageProcessor.", LOG_TAG);
|
||||
if (imageDecoder_ == nullptr) {
|
||||
DHLOGE("%s: Decoder is null.", LOG_TAG);
|
||||
ReportVideoDecoderFail(VIDEO_DECODER_ERROR, ERR_DH_SCREEN_TRANS_NULL_VALUE, localParam_.GetVideoWidth(),
|
||||
localParam_.GetVideoHeight(), localParam_.GetVideoFormat(), "Decoder is null.");
|
||||
return ERR_DH_SCREEN_TRANS_NULL_VALUE;
|
||||
}
|
||||
|
||||
@@ -95,6 +106,8 @@ int32_t ImageSinkProcessor::StopImageProcessor()
|
||||
FinishTrace(DSCREEN_HITRACE_LABEL);
|
||||
if (ret != DH_SUCCESS) {
|
||||
DHLOGE("%s: StopDecoder failed ret:%d.", LOG_TAG, ret);
|
||||
ReportVideoDecoderFail(VIDEO_DECODER_ERROR, ret, localParam_.GetVideoWidth(),
|
||||
localParam_.GetVideoHeight(), localParam_.GetVideoFormat(), "StopDecoder failed.");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -106,12 +119,16 @@ int32_t ImageSinkProcessor::SetImageSurface(sptr<Surface> &surface)
|
||||
DHLOGI("%s: SetImageSurface.", LOG_TAG);
|
||||
if (imageDecoder_ == nullptr) {
|
||||
DHLOGE("%s: Decoder is null.", LOG_TAG);
|
||||
ReportVideoDecoderFail(VIDEO_DECODER_ERROR, ERR_DH_SCREEN_TRANS_NULL_VALUE, localParam_.GetVideoWidth(),
|
||||
localParam_.GetVideoHeight(), localParam_.GetVideoFormat(), "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);
|
||||
ReportVideoDecoderFail(VIDEO_DECODER_ERROR, ret, localParam_.GetVideoWidth(),
|
||||
localParam_.GetVideoHeight(), localParam_.GetVideoFormat(), "SetOutputSurface failed.");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -123,12 +140,16 @@ 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);
|
||||
ReportVideoDecoderFail(VIDEO_DECODER_ERROR, ERR_DH_SCREEN_TRANS_NULL_VALUE, localParam_.GetVideoWidth(),
|
||||
localParam_.GetVideoHeight(), localParam_.GetVideoFormat(), "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);
|
||||
ReportVideoDecoderFail(VIDEO_DECODER_ERROR, ret, localParam_.GetVideoWidth(),
|
||||
localParam_.GetVideoHeight(), localParam_.GetVideoFormat(), "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,8 @@ 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);
|
||||
ReportSoftbusSessionServerFail(SOFTBUS_SESSIONSERVER_ERROR, ret, PKG_NAME,
|
||||
DATA_SESSION_NAME, "dscreen sink Create session failed.");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -266,6 +269,8 @@ 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);
|
||||
ReportVideoDecoderFail(VIDEO_DECODER_ERROR, ret, localParam.GetVideoWidth(),
|
||||
localParam.GetVideoHeight(), localParam.GetVideoFormat(), "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,8 @@ int32_t ImageSourceProcessor::ReleaseImageProcessor()
|
||||
DHLOGI("%s: ReleaseImageProcessor.", LOG_TAG);
|
||||
if (!imageEncoder_) {
|
||||
DHLOGE("%s: Create screen encoder failed.", LOG_TAG);
|
||||
ReportVideoEncoderFail(VIDEO_ENCODER_ERROR, ERR_DH_SCREEN_TRANS_NULL_VALUE, localParam_.GetVideoWidth(),
|
||||
localParam_.GetVideoHeight(), localParam_.GetVideoFormat(), "Create screen encoder failed.");
|
||||
return ERR_DH_SCREEN_TRANS_NULL_VALUE;
|
||||
}
|
||||
|
||||
@@ -55,6 +58,8 @@ int32_t ImageSourceProcessor::ReleaseImageProcessor()
|
||||
FinishTrace(DSCREEN_HITRACE_LABEL);
|
||||
if (ret != DH_SUCCESS) {
|
||||
DHLOGE("%s: Release screen encoder failed ret: %d.", LOG_TAG, ret);
|
||||
ReportVideoEncoderFail(VIDEO_ENCODER_ERROR, ret, localParam_.GetVideoWidth(),
|
||||
localParam_.GetVideoHeight(), localParam_.GetVideoFormat(), "Release screen encoder failed.");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -66,6 +71,8 @@ int32_t ImageSourceProcessor::StartImageProcessor()
|
||||
DHLOGI("%s: StartImageProcessor.", LOG_TAG);
|
||||
if (!imageEncoder_) {
|
||||
DHLOGE("%s: Create screen encoder failed.", LOG_TAG);
|
||||
ReportVideoEncoderFail(VIDEO_ENCODER_ERROR, ERR_DH_SCREEN_TRANS_NULL_VALUE, localParam_.GetVideoWidth(),
|
||||
localParam_.GetVideoHeight(), localParam_.GetVideoFormat(), "Create screen encoder failed.");
|
||||
return ERR_DH_SCREEN_TRANS_NULL_VALUE;
|
||||
}
|
||||
|
||||
@@ -74,6 +81,8 @@ int32_t ImageSourceProcessor::StartImageProcessor()
|
||||
FinishTrace(DSCREEN_HITRACE_LABEL);
|
||||
if (ret != DH_SUCCESS) {
|
||||
DHLOGE("%s: Start screen encoder failed ret: %d.", LOG_TAG, ret);
|
||||
ReportVideoEncoderFail(VIDEO_ENCODER_ERROR, ret, localParam_.GetVideoWidth(),
|
||||
localParam_.GetVideoHeight(), localParam_.GetVideoFormat(), "Start screen encoder failed.");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -85,6 +94,8 @@ int32_t ImageSourceProcessor::StopImageProcessor()
|
||||
DHLOGI("%s: StopImageProcessor.", LOG_TAG);
|
||||
if (!imageEncoder_) {
|
||||
DHLOGE("%s: Create screen encoder failed.", LOG_TAG);
|
||||
ReportVideoEncoderFail(VIDEO_ENCODER_ERROR, ERR_DH_SCREEN_TRANS_NULL_VALUE, localParam_.GetVideoWidth(),
|
||||
localParam_.GetVideoHeight(), localParam_.GetVideoFormat(), "Create screen encoder failed.");
|
||||
return ERR_DH_SCREEN_TRANS_NULL_VALUE;
|
||||
}
|
||||
|
||||
@@ -93,6 +104,8 @@ int32_t ImageSourceProcessor::StopImageProcessor()
|
||||
FinishTrace(DSCREEN_HITRACE_LABEL);
|
||||
if (ret != DH_SUCCESS) {
|
||||
DHLOGE("%s: Stop screen encoder failed ret: %d.", LOG_TAG, ret);
|
||||
ReportVideoEncoderFail(VIDEO_ENCODER_ERROR, ret, localParam_.GetVideoWidth(),
|
||||
localParam_.GetVideoHeight(), localParam_.GetVideoFormat(), "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,8 @@ int32_t ScreenSourceTrans::RegisterChannelListener()
|
||||
int32_t ret = screenChannel_->CreateSession(listener);
|
||||
if (ret != DH_SUCCESS) {
|
||||
DHLOGE("%s: Create session failed ret: %d.", LOG_TAG);
|
||||
ReportSoftbusSessionServerFail(SOFTBUS_SESSIONSERVER_ERROR, ret, PKG_NAME,
|
||||
DATA_SESSION_NAME, "dscreen source Create session failed.");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -285,6 +288,8 @@ 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);
|
||||
ReportVideoEncoderFail(VIDEO_ENCODER_ERROR, ret, localParam.GetVideoWidth(),
|
||||
localParam.GetVideoHeight(), localParam.GetVideoFormat(), "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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user