diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp index 0630cb3c4b6a..b2b2359dd2ca 100644 --- a/dom/html/HTMLMediaElement.cpp +++ b/dom/html/HTMLMediaElement.cpp @@ -3099,50 +3099,52 @@ HTMLMediaElement::ReportTelemetry() } } - double playTime = mPlayTime.Total(); - double hiddenPlayTime = mHiddenPlayTime.Total(); - - Telemetry::Accumulate(Telemetry::VIDEO_PLAY_TIME_MS, SECONDS_TO_MS(playTime)); - LOG(LogLevel::Debug, ("%p VIDEO_PLAY_TIME_MS = %f", this, playTime)); - - Telemetry::Accumulate(Telemetry::VIDEO_HIDDEN_PLAY_TIME_MS, SECONDS_TO_MS(hiddenPlayTime)); - LOG(LogLevel::Debug, ("%p VIDEO_HIDDEN_PLAY_TIME_MS = %f", this, hiddenPlayTime)); - - if (playTime > 0.0 && - mMediaInfo.HasVideo() && + if (mMediaInfo.HasVideo() && mMediaInfo.mVideo.mImage.height > 0) { - // We have actually played some valid video -> Report hidden/total ratio. - uint32_t hiddenPercentage = uint32_t(hiddenPlayTime / playTime * 100.0 + 0.5); + // We have a valid video. + double playTime = mPlayTime.Total(); + double hiddenPlayTime = mHiddenPlayTime.Total(); - // Keyed by audio+video or video alone, and by a resolution range. - nsCString key(mMediaInfo.HasAudio() ? "AV," : "V,"); - static const struct { int32_t mH; const char* mRes; } sResolutions[] = { - { 240, "0 0.0) { + // We have actually played something -> Report hidden/total ratio. + uint32_t hiddenPercentage = uint32_t(hiddenPlayTime / playTime * 100.0 + 0.5); + + // Keyed by audio+video or video alone, and by a resolution range. + nsCString key(mMediaInfo.HasAudio() ? "AV," : "V,"); + static const struct { int32_t mH; const char* mRes; } sResolutions[] = { + { 240, "0