Bug 1662212 - Add telemetry to track play time of encrypted HTMLMediaElements. r=drno

Add 3 probes
- Play time for encrypted elements.
- Play time for Clearkey elements.
- Play time for Widevine elements.

Differential Revision: https://phabricator.services.mozilla.com/D88895
This commit is contained in:
Bryce Seager van Dyk
2020-09-10 22:04:39 +00:00
parent fe261d0833
commit baea16f9ef
2 changed files with 59 additions and 0 deletions

View File

@@ -4848,6 +4848,29 @@ void HTMLMediaElement::ReportTelemetry() {
LOG(LogLevel::Debug,
("%p VIDEO_HIDDEN_PLAY_TIME_MS = %f", this, hiddenPlayTime));
if (this->IsEncrypted()) {
Telemetry::Accumulate(Telemetry::VIDEO_ENCRYPTED_PLAY_TIME_MS,
SECONDS_TO_MS(playTime));
LOG(LogLevel::Debug,
("%p VIDEO_ENCRYPTED_PLAY_TIME_MS = %f", this, playTime));
}
if (mMediaKeys) {
nsAutoString keySystem;
mMediaKeys->GetKeySystem(keySystem);
if (IsClearkeyKeySystem(keySystem)) {
Telemetry::Accumulate(Telemetry::VIDEO_CLEARKEY_PLAY_TIME_MS,
SECONDS_TO_MS(playTime));
LOG(LogLevel::Debug,
("%p VIDEO_CLEARKEY_PLAY_TIME_MS = %f", this, playTime));
} else if (IsWidevineKeySystem(keySystem)) {
Telemetry::Accumulate(Telemetry::VIDEO_WIDEVINE_PLAY_TIME_MS,
SECONDS_TO_MS(playTime));
LOG(LogLevel::Debug,
("%p VIDEO_WIDEVINE_PLAY_TIME_MS = %f", this, playTime));
}
}
if (playTime > 0.0) {
// We have actually played something -> Report some valid-video telemetry.