Bug 1685399 - part12 : check video info's display and image size to verify if video is valid. r=bryce

If we're using null decoder, which generates an empty video frame (0*0), then `VideoInfo::IsValid()` would return false and we're not able to report the telemetry for that video.

Therefore, we should verify that by checking either display or image size to know if we should report the telemetry or not.

Differential Revision: https://phabricator.services.mozilla.com/D101561
This commit is contained in:
alwu 2021-01-19 19:40:21 +00:00
Родитель 8dcd3ca469
Коммит a9784ab8ab
1 изменённых файлов: 7 добавлений и 3 удалений

Просмотреть файл

@ -128,9 +128,13 @@ void TelemetryProbesReporter::PauseInvisibleVideoTimeAcculator() {
}
bool TelemetryProbesReporter::HasOwnerHadValidVideo() const {
const MediaInfo info = mOwner->GetMediaInfo();
return info.HasVideo() && info.mVideo.mImage.height > 0 &&
info.mVideo.mImage.width > 0;
// Checking both image and display dimensions helps address cases such as
// suspending, where we use a null decoder. In that case a null decoder
// produces 0x0 video frames, which might cause layout to resize the display
// size, but the image dimensions would be still non-null.
const VideoInfo info = mOwner->GetMediaInfo().mVideo;
return (info.mDisplay.height > 0 && info.mDisplay.width > 0) ||
(info.mImage.height > 0 && info.mImage.width > 0);
}
void TelemetryProbesReporter::AssertOnMainThreadAndNotShutdown() const {