diff --git a/config.gni b/config.gni index 8b7d3ee9d1b1131b4e12e841711fe3e13469364f..9d2468ec01f8eae2402daef11f087a8368454583 100644 --- a/config.gni +++ b/config.gni @@ -239,6 +239,11 @@ declare_args() { defined(global_parts_info.powermgr_power_manager)) { multimedia_player_framework_support_power_manager = true } + multimedia_player_framework_support_json = false + if (defined(global_parts_info) && + defined(global_parts_info.third_party_json)) { + multimedia_player_framework_support_json = true + } } player_framework_defines = [] @@ -331,6 +336,10 @@ if (multimedia_player_framework_support_mediasource) { player_framework_defines += [ "SUPPORT_MEDIA_SOURCE" ] } +if (multimedia_player_framework_support_json) { + player_framework_defines += [ "SUPPORT_JSON" ] +} + # Config path MEDIA_PLAYER_ROOT_DIR = "//foundation/multimedia/player_framework" MEDIA_PLAYER_AVCODEC = "//foundation/multimedia/av_codec" diff --git a/services/utils/include/media_dfx.h b/services/utils/include/media_dfx.h index 114232e6c2d110446739756afea262ff1d2ad482..7ca7bae19ad41cf8ebd026077d4a49bdcb1eb947 100644 --- a/services/utils/include/media_dfx.h +++ b/services/utils/include/media_dfx.h @@ -25,13 +25,17 @@ #include "nocopyable.h" #include "hisysevent.h" #include "meta/meta.h" +#ifdef SUPPORT_JSON #include "nlohmann/json.hpp" +#endif #include #include namespace OHOS { namespace Media { +#ifdef SUPPORT_JSON using json = nlohmann::json; +#endif enum CallType { AVPLAYER, AVRECORDER, @@ -71,7 +75,9 @@ public: private: void StatisicsHiSysEventWrite(CallType callType, OHOS::HiviewDFX::HiSysEvent::EventType type, const std::vector& infoArr); +#ifdef SUPPORT_JSON void ParseOneEvent(const std::pair> &listPair, json& metaInfoJson); +#endif std::string msg_; }; diff --git a/services/utils/media_dfx.cpp b/services/utils/media_dfx.cpp index 066c1c6feef5f451ba302e62cbd600f88d715e91..3048fcff18829eece9ef64edfa8914b680abbfac 100644 --- a/services/utils/media_dfx.cpp +++ b/services/utils/media_dfx.cpp @@ -215,6 +215,7 @@ void MediaEvent::CommonStatisicsEventWrite(CallType callType, OHOS::HiviewDFX::H return; } std::vector infoArr; +#ifdef SUPPORT_JSON for (const auto& kv : infoMap) { json jsonArray; json eventInfoJson; @@ -229,10 +230,12 @@ void MediaEvent::CommonStatisicsEventWrite(CallType callType, OHOS::HiviewDFX::H jsonArray.push_back(eventInfoJson); infoArr.push_back(jsonArray.dump()); } - +#endif StatisicsHiSysEventWrite(callType, type, infoArr); } + +#ifdef SUPPORT_JSON void MediaEvent::ParseOneEvent(const std::pair> &listPair, json& metaInfoJson) { @@ -265,6 +268,7 @@ void MediaEvent::ParseOneEvent(const std::pair& infoArr)