mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
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 --HG-- extra : rebase_source : 1f018612fbaf43867f5c92e59d62d718a3b08535
This commit is contained in:
parent
8921e3dab6
commit
116cef615e
@ -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;
|
||||
|
@ -36,6 +36,7 @@ function test() {
|
||||
ok(vpq.creationTime <= performance.now(), "creationTime should be in the past");
|
||||
ok(vpq.totalVideoFrames > 0, "totalVideoFrames should be > 0");
|
||||
ok(vpq.droppedVideoFrames >= 0, "droppedVideoFrames should be >= 0");
|
||||
ok(vpq.droppedVideoFrames <= vpq.totalVideoFrames, "droppedVideoFrames should be <= totalVideoFrames");
|
||||
ok(vpq.corruptedVideoFrames >= 0, "corruptedVideoFrames should be >= 0");
|
||||
|
||||
SpecialPowers.pushPrefEnv({"set": [["media.video_stats.enabled", false]]}, function () {
|
||||
|
Loading…
Reference in New Issue
Block a user