0

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}
This commit is contained in:
Sangbaek Park
2025-04-09 14:49:33 -07:00
committed by Chromium LUCI CQ
parent c6e94a5a99
commit cdae312dcb
2 changed files with 25 additions and 0 deletions
media/base
tools/metrics/histograms/metadata/media

@ -18,11 +18,17 @@ const char kUnknownKeySystemNameForUMA[] = "Unknown";
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 @@ std::string GetKeySystemNameForUMA(const std::string& key_system,
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 @@ std::string GetKeySystemNameForUMA(const std::string& key_system,
// 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;
}

@ -80,11 +80,16 @@ chromium-metrics-reviews@google.com.
<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"