Bug 1543032 - Extend metrics for dropped frames - r=padenot

This patch adds the number of dropped frames for each step of the process
(read/sink/compositor) and gives us more insight about where frames are
dropped, as opposed to the getVideoPlaybackQuality() API which gives the grand
total.

Differential Revision: https://phabricator.services.mozilla.com/D27488
This commit is contained in:
Tarek Ziadé
2019-04-16 11:50:38 +00:00
parent 20b93db244
commit 11a8e938dc
6 changed files with 69 additions and 34 deletions

View File

@@ -313,22 +313,21 @@ HTMLVideoElement::GetVideoPlaybackQuality() {
TotalPlayTime(), VideoWidth(), VideoHeight());
corruptedFrames = 0;
} else {
FrameStatisticsData stats =
mDecoder->GetFrameStatistics().GetFrameStatisticsData();
if (sizeof(totalFrames) >= sizeof(stats.mParsedFrames)) {
totalFrames = stats.mPresentedFrames + stats.mDroppedFrames;
droppedFrames = stats.mDroppedFrames;
FrameStatistics* stats = &mDecoder->GetFrameStatistics();
if (sizeof(totalFrames) >= sizeof(stats->GetParsedFrames())) {
totalFrames = stats->GetTotalFrames();
droppedFrames = stats->GetDroppedFrames();
} else {
uint64_t total = stats.mPresentedFrames + stats.mDroppedFrames;
uint64_t total = stats->GetTotalFrames();
const auto maxNumber = std::numeric_limits<uint32_t>::max();
if (total <= maxNumber) {
totalFrames = uint32_t(total);
droppedFrames = uint32_t(stats.mDroppedFrames);
droppedFrames = uint32_t(stats->GetDroppedFrames());
} else {
// Too big number(s) -> Resize everything to fit in 32 bits.
double ratio = double(maxNumber) / double(total);
totalFrames = maxNumber; // === total * ratio
droppedFrames = uint32_t(double(stats.mDroppedFrames) * ratio);
droppedFrames = uint32_t(double(stats->GetDroppedFrames()) * ratio);
}
}
corruptedFrames = 0;