media: Add PlayReady key system in media histograms
Previously, PlayReady related EME queries and playbacks reported as
`Unknown` key system in the histograms.
- Added `PlayReady` key system variant to "KeySystem"
- Added `PlayReady.HardwareSecure` variants to
"KeySystemWithRobustness"
Now the browser reports with `PlayReady.HardwareSecure` for the
following key systems:
- "com.microsoft.playready.recommendation" with "3000" robustness
- "com.microsoft.playready.recommendation.3000"
- Other PlayReady non hardware secure ones will be reported as Unknown.
Tests:
- Tried three different PlayReady playbacks:
a) "com.microsoft.playready.recommendation.3000": HardwareSecure
b) "com.microsoft.playready.recommendation" with 3000 robustness:
HardwareSecure
c) "com.microsoft.playready.recommendation" with 2000 robustness:
Unknown
- Captured histograms (chrome://histograms/#playready): See
http://shortn/_2m2Pyw1C4a
Bug: 378869813
Change-Id: I31ddc89d80e31a2b59a0d4153410c02b9a3a88b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6404530
Commit-Queue: Sangbaek Park <sangbaekpark@chromium.org>
Reviewed-by: Evan Liu <evliu@google.com>
Reviewed-by: Xiaohan Wang <xhwang@chromium.org>
Reviewed-by: Vikram Pasupathy <vpasupathy@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1444961}
diff --git a/media/base/key_systems.cc b/media/base/key_systems.cc
index 69f068f..1def771 100644
--- a/media/base/key_systems.cc
+++ b/media/base/key_systems.cc
@@ -18,11 +18,17 @@
const char kHardwareSecureForUMA[] = "HardwareSecure";
const char kSoftwareSecureForUMA[] = "SoftwareSecure";
+#if BUILDFLAG(IS_WIN)
+const char kPlayReadyKeySystemNameForUMA[] = "PlayReady";
+const char kPlayReadyKeySystemBase[] = "com.microsoft.playready";
+#endif // BUILDFLAG(IS_WIN)
+
enum KeySystemForUkm {
// These values reported to UKM. Do not change their ordinal values.
kUnknownKeySystemForUkm = 0,
kClearKeyKeySystemForUkm,
kWidevineKeySystemForUkm,
+ kPlayReadyKeySystemForUkm,
};
} // namespace
@@ -45,6 +51,14 @@
return key_system_name;
}
+#if BUILDFLAG(IS_WIN)
+ if (key_system == kPlayReadyKeySystemBase &&
+ use_hw_secure_codecs.value_or(false)) {
+ return std::string(kPlayReadyKeySystemNameForUMA) + "." +
+ kHardwareSecureForUMA;
+ }
+#endif // BUILDFLAG(IS_WIN)
+
// For Clear Key and unknown key systems we don't to differentiate between
// software and hardware security.
@@ -58,6 +72,12 @@
// Returns an int mapping to `key_system` suitable for UKM reporting. CdmConfig
// is not needed here because we can report CdmConfig fields in UKM directly.
MEDIA_EXPORT int GetKeySystemIntForUKM(const std::string& key_system) {
+#if BUILDFLAG(IS_WIN)
+ if (key_system == kPlayReadyKeySystemBase) {
+ return KeySystemForUkm::kPlayReadyKeySystemForUkm;
+ }
+#endif // BUILDFLAG(IS_WIN)
+
if (key_system == kWidevineKeySystem) {
return KeySystemForUkm::kWidevineKeySystemForUkm;
}
diff --git a/tools/metrics/histograms/metadata/media/histograms.xml b/tools/metrics/histograms/metadata/media/histograms.xml
index 270bdcf..93e982c 100644
--- a/tools/metrics/histograms/metadata/media/histograms.xml
+++ b/tools/metrics/histograms/metadata/media/histograms.xml
@@ -80,11 +80,16 @@
<variants name="KeySystem">
<variant name="ClearKey" summary="Clear Key key system"/>
+ <variant name="PlayReady" summary="PlayReady key system"/>
<variant name="Widevine" summary="Widevine key system"/>
</variants>
<variants name="KeySystemWithRobustness">
<variant name="ClearKey" summary="Clear Key key system"/>
+ <variant name="PlayReady.HardwareSecure"
+ summary="Hardware secure PlayReady key system"/>
+ <variant name="PlayReady.SoftwareSecure"
+ summary="Software secure PlayReady key system"/>
<variant name="Widevine.HardwareSecure"
summary="Hardware secure Widevine key system"/>
<variant name="Widevine.SoftwareSecure"