diff --git a/dom/media/eme/EMEUtils.cpp b/dom/media/eme/EMEUtils.cpp index 3600de750734..ece3636bd662 100644 --- a/dom/media/eme/EMEUtils.cpp +++ b/dom/media/eme/EMEUtils.cpp @@ -154,4 +154,17 @@ IsClearkeyKeySystem(const nsAString& aKeySystem) return !CompareUTF8toUTF16(kEMEKeySystemClearkey, aKeySystem); } +CDMType +ToCDMTypeTelemetryEnum(const nsString& aKeySystem) +{ + if (!CompareUTF8toUTF16(kEMEKeySystemWidevine, aKeySystem)) { + return CDMType::eWidevine; + } else if (!CompareUTF8toUTF16(kEMEKeySystemClearkey, aKeySystem)) { + return CDMType::eClearKey; + } else if (!CompareUTF8toUTF16(kEMEKeySystemPrimetime, aKeySystem)) { + return CDMType::ePrimetime; + } + return CDMType::eUnknown; +} + } // namespace mozilla diff --git a/dom/media/eme/EMEUtils.h b/dom/media/eme/EMEUtils.h index f21e3b1563a2..bbeaf1226cfa 100644 --- a/dom/media/eme/EMEUtils.h +++ b/dom/media/eme/EMEUtils.h @@ -106,6 +106,16 @@ KeySystemToGMPName(const nsAString& aKeySystem); bool IsClearkeyKeySystem(const nsAString& aKeySystem); +enum CDMType { + eClearKey = 0, + ePrimetime = 1, + eWidevine = 2, + eUnknown = 3 +}; + +CDMType +ToCDMTypeTelemetryEnum(const nsString& aKeySystem); + } // namespace mozilla #endif // EME_LOG_H_ diff --git a/dom/media/eme/MediaKeySession.cpp b/dom/media/eme/MediaKeySession.cpp index e4f472a2cf01..103c77e64fce 100644 --- a/dom/media/eme/MediaKeySession.cpp +++ b/dom/media/eme/MediaKeySession.cpp @@ -199,6 +199,9 @@ MediaKeySession::GenerateRequest(const nsAString& aInitDataType, return promise.forget(); } + Telemetry::Accumulate(Telemetry::VIDEO_CDM_GENERATE_REQUEST_CALLED, + ToCDMTypeTelemetryEnum(mKeySystem)); + // Convert initData to base64 for easier logging. // Note: CreateSession() Move()s the data out of the array, so we have // to copy it here. diff --git a/dom/media/eme/MediaKeys.cpp b/dom/media/eme/MediaKeys.cpp index b972ffaa4c8b..a7a24c824c80 100644 --- a/dom/media/eme/MediaKeys.cpp +++ b/dom/media/eme/MediaKeys.cpp @@ -401,26 +401,6 @@ MediaKeys::Init(ErrorResult& aRv) return promise.forget(); } -enum CDMCreatedType { - eClearKey = 0, - ePrimetime = 1, - eWidevine = 2, - eUnknown = 3 -}; - -static CDMCreatedType -ToCDMCreatedTelemetryEnum(const nsString& aKeySystem) -{ - if (!CompareUTF8toUTF16(kEMEKeySystemWidevine, aKeySystem)) { - return CDMCreatedType::eWidevine; - } else if (!CompareUTF8toUTF16(kEMEKeySystemClearkey, aKeySystem)) { - return CDMCreatedType::eClearKey; - } else if (!CompareUTF8toUTF16(kEMEKeySystemPrimetime, aKeySystem)) { - return CDMCreatedType::ePrimetime; - } - return CDMCreatedType::eUnknown; -} - void MediaKeys::OnCDMCreated(PromiseId aId, const nsACString& aNodeId, const uint32_t aPluginId) { @@ -440,7 +420,7 @@ MediaKeys::OnCDMCreated(PromiseId aId, const nsACString& aNodeId, const uint32_t mKeySystem, MediaKeySystemStatus::Cdm_created); - Telemetry::Accumulate(Telemetry::VIDEO_CDM_CREATED, ToCDMCreatedTelemetryEnum(mKeySystem)); + Telemetry::Accumulate(Telemetry::VIDEO_CDM_CREATED, ToCDMTypeTelemetryEnum(mKeySystem)); } already_AddRefed diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json index 4382d649d8b4..e9190548719f 100644 --- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -8716,6 +8716,15 @@ "description": "Note the type of CDM (0=ClearKey, 1=Primetime, 2=Widevine, 3=unknown) every time we successfully instantiate an EME MediaKeys object.", "releaseChannelCollection": "opt-out" }, + "VIDEO_CDM_GENERATE_REQUEST_CALLED": { + "alert_emails": ["cpearce@mozilla.com"], + "expires_in_version": "58", + "bug_numbers": [1305552], + "kind": "enumerated", + "n_values": 6, + "description": "Note the type of CDM (0=ClearKey, 1=Primetime, 2=Widevine, 3=unknown) every time we call MediaKeySession.generateRequest().", + "releaseChannelCollection": "opt-out" + }, "MEDIA_CODEC_USED": { "alert_emails": ["cpearce@mozilla.com"], "expires_in_version": "never",