diff --git a/services/media_monitor/common/include/media_monitor_info.h b/services/media_monitor/common/include/media_monitor_info.h index dd98811a89c2db1439fdc073a93d68d2f263295c..824edf448bfab9514ca9fdc786fbb22dfdd87355 100644 --- a/services/media_monitor/common/include/media_monitor_info.h +++ b/services/media_monitor/common/include/media_monitor_info.h @@ -62,7 +62,8 @@ enum EventId { STREAM_STANDBY = 22, AI_VOICE_NOISE_SUPPRESSION = 23, VOLUME_SUBSCRIBE = 24, - SMARTPA_STATUS = 25 + SMARTPA_STATUS = 25, + JANK_PLAYBACK = 26 }; enum EventType { diff --git a/services/media_monitor/server/include/event_aggregate.h b/services/media_monitor/server/include/event_aggregate.h index 480560bad1656ddcc775dcc68a7727215eea1762..0498ec5c5da250440394bdec37f9579fec4663fd 100644 --- a/services/media_monitor/server/include/event_aggregate.h +++ b/services/media_monitor/server/include/event_aggregate.h @@ -68,6 +68,7 @@ private: void HandleStreamChangeForVolume(std::shared_ptr &bean); void HandlePipeChange(std::shared_ptr &bean); void HandleFocusMigrate(std::shared_ptr &bean); + void HandleJankPlaybackEvent(std::shared_ptr &bean); void AddToDeviceUsage(std::shared_ptr &bean, uint64_t curruntTime); void AddToStreamUsage(std::shared_ptr &bean, uint64_t curruntTime); diff --git a/services/media_monitor/server/include/media_event_base_writer.h b/services/media_monitor/server/include/media_event_base_writer.h index 0e6c6551baa3ebce938ab2ae9ce1d6dec35b8831..85ca5907b85f05cd7c34f80c378121503582481b 100644 --- a/services/media_monitor/server/include/media_event_base_writer.h +++ b/services/media_monitor/server/include/media_event_base_writer.h @@ -35,6 +35,7 @@ public: void WriteLoadConfigError(std::shared_ptr &bean); void WriteLoadEffectEngineError(std::shared_ptr &bean); + void WriteJankPlaybackError(std::shared_ptr &bean); void WriteAudioStartupError(std::shared_ptr &bean); void WriteStreamExhastedError(std::shared_ptr &bean); void WriteStreamCreateError(std::shared_ptr &bean); diff --git a/services/media_monitor/server/src/event_aggregate.cpp b/services/media_monitor/server/src/event_aggregate.cpp index ae3eba5b76db9038dcb5616a4dafda7314a30afc..b29430c0010422fc0b8a6f63f33eb22d6989e24c 100644 --- a/services/media_monitor/server/src/event_aggregate.cpp +++ b/services/media_monitor/server/src/event_aggregate.cpp @@ -113,6 +113,9 @@ void EventAggregate::UpdateAggregateEventList(std::shared_ptr &bean) case AUDIO_FOCUS_MIGRATE: HandleFocusMigrate(bean); break; + case JANK_PLAYBACK: + HandleJankPlaybackEvent(bean); + break; default: break; } @@ -632,6 +635,12 @@ void EventAggregate::HandleFocusMigrate(std::shared_ptr &bean) mediaMonitorPolicy_.WriteEvent(bean->GetEventId(), bean); } +void EventAggregate::HandleJankPlaybackEvent(std::shared_ptr &bean) +{ + MEDIA_LOG_D("Handle jank playback event"); + mediaMonitorPolicy_.WriteEvent(bean->GetEventId(), bean); +} + void EventAggregate::WriteInfo(int32_t fd, std::string &dumpString) { if (fd != -1) { diff --git a/services/media_monitor/server/src/media_event_base_writer.cpp b/services/media_monitor/server/src/media_event_base_writer.cpp index e47cd2841edea95b9622f8420b9fdfd050607764..4ce668601bc10968f5b1e559a22301c48d22470c 100644 --- a/services/media_monitor/server/src/media_event_base_writer.cpp +++ b/services/media_monitor/server/src/media_event_base_writer.cpp @@ -194,6 +194,23 @@ void MediaEventBaseWriter::WriteLoadEffectEngineError(std::shared_ptr #endif } +void MediaEventBaseWriter::WriteJankPlaybackError(std::shared_ptr &bean) +{ + MEDIA_LOG_D("Write jank playback error"); + if (bean == nullptr) { + MEDIA_LOG_E("eventBean is nullptr"); + return; + } +#ifdef MONITOR_ENABLE_HISYSEVENT + HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::AUDIO, "JANK_PLAYBACK", + HiviewDFX::HiSysEvent::EventType::FAULT, + "REASON", static_cast(bean->GetIntValue("REASON")), + "PERIOD_MS", static_cast(bean->GetIntValue("PERIOD_MS")), + "PIPE_TYPE", static_cast(bean->GetIntValue("PIPE_TYPE")), + "HDI_ADAPTER", static_cast(bean->GetIntValue("HDI_ADAPTER"))); +#endif +} + void MediaEventBaseWriter::WriteAudioStartupError(std::shared_ptr &bean) { MEDIA_LOG_D("Write audio startup error"); diff --git a/services/media_monitor/server/src/media_monitor_policy.cpp b/services/media_monitor/server/src/media_monitor_policy.cpp index e6c9a9b85bfe9689b89cf78441474b03a62be720..c2d7e1a1f66ed5213525b49752e53ce8e82eb3c1 100644 --- a/services/media_monitor/server/src/media_monitor_policy.cpp +++ b/services/media_monitor/server/src/media_monitor_policy.cpp @@ -207,6 +207,9 @@ void MediaMonitorPolicy::WriteFaultEvent(EventId eventId, std::shared_ptr