Bug 1311877 - VideoPlaybackQuality.totalVideoFrameCount is presented+dropped - r=jya
totalVideoFrameCount was previously incorrectly set to the number of demuxed frames. According to the current W3C specs [1], it should instead be the total number of frames that have been presented, plus frames that have been discarded. Also added a check that discarded<=total in mochitest. [1] https://wicg.github.io/media-playback-quality/#concepts MozReview-Commit-ID: Gnv1roM5n0A
This commit is contained in:
@@ -254,19 +254,19 @@ HTMLVideoElement::GetVideoPlaybackQuality()
|
||||
FrameStatisticsData stats =
|
||||
mDecoder->GetFrameStatistics().GetFrameStatisticsData();
|
||||
if (sizeof(totalFrames) >= sizeof(stats.mParsedFrames)) {
|
||||
totalFrames = stats.mParsedFrames;
|
||||
totalFrames = stats.mPresentedFrames + stats.mDroppedFrames;
|
||||
droppedFrames = stats.mDroppedFrames;
|
||||
} else {
|
||||
auto maxStat = std::max(stats.mParsedFrames, stats.mDroppedFrames);
|
||||
uint64_t total = stats.mPresentedFrames + stats.mDroppedFrames;
|
||||
const auto maxNumber = std::numeric_limits<uint32_t>::max();
|
||||
if (maxStat <= maxNumber) {
|
||||
totalFrames = static_cast<uint32_t>(stats.mParsedFrames);
|
||||
droppedFrames = static_cast<uint32_t>(stats.mDroppedFrames);
|
||||
if (total <= maxNumber) {
|
||||
totalFrames = uint32_t(total);
|
||||
droppedFrames = uint32_t(stats.mDroppedFrames);
|
||||
} else {
|
||||
// Too big number(s) -> Resize everything to fit in 32 bits.
|
||||
double ratio = double(maxNumber) / double(maxStat);
|
||||
totalFrames = double(stats.mParsedFrames) * ratio;
|
||||
droppedFrames = double(stats.mDroppedFrames) * ratio;
|
||||
double ratio = double(maxNumber) / double(total);
|
||||
totalFrames = maxNumber; // === total * ratio
|
||||
droppedFrames = uint32_t(double(stats.mDroppedFrames) * ratio);
|
||||
}
|
||||
}
|
||||
corruptedFrames = 0;
|
||||
|
||||
Reference in New Issue
Block a user