mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 09:15:35 +00:00
Bug 1571821 - Use total frames instead of parsed frames to calculate benchmark. r=alwu
The problem reproduces when the system is loaded and the decoder is dropping most of the frames. When there are two benchmark calculations close to each other, the measured parsed frames of the first calculation can be buffered in the decoder and reported as dropped frames on the second calculation. Then on the second calculation, the number of dropped frames can be greater than the parsed frame which will hit the assert. The number of total frames is a better measure since it counts the frames that appeared in the in VideoSink plus the total dropped frames. Differential Revision: https://phabricator.services.mozilla.com/D44478 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
eb520e111a
commit
e8c7250170
@ -13,27 +13,27 @@ namespace mozilla {
|
||||
void DecoderBenchmark::StoreScore(const nsACString& aDecoderName,
|
||||
const nsACString& aKey,
|
||||
RefPtr<FrameStatistics> aStats) {
|
||||
uint64_t parsedFrames = aStats->GetParsedFrames();
|
||||
uint64_t totalFrames = aStats->GetTotalFrames();
|
||||
uint64_t droppedFrames = aStats->GetDroppedFrames();
|
||||
|
||||
MOZ_ASSERT(droppedFrames <= parsedFrames);
|
||||
MOZ_ASSERT(parsedFrames >= mLastParsedFrames);
|
||||
MOZ_ASSERT(droppedFrames <= totalFrames);
|
||||
MOZ_ASSERT(totalFrames >= mLastTotalFrames);
|
||||
MOZ_ASSERT(droppedFrames >= mLastDroppedFrames);
|
||||
|
||||
uint64_t diffParsedFrames = parsedFrames - mLastParsedFrames;
|
||||
uint64_t diffTotalFrames = totalFrames - mLastTotalFrames;
|
||||
uint64_t diffDroppedFrames = droppedFrames - mLastDroppedFrames;
|
||||
|
||||
/* Update now in case the method returns at the if check bellow. */
|
||||
mLastParsedFrames = parsedFrames;
|
||||
mLastTotalFrames = totalFrames;
|
||||
mLastDroppedFrames = droppedFrames;
|
||||
|
||||
/* A minimum number of 10 frames is required to store the score. */
|
||||
if (diffParsedFrames < 10) {
|
||||
if (diffTotalFrames < 10) {
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t percentage =
|
||||
100 - 100 * float(diffDroppedFrames) / float(diffParsedFrames);
|
||||
100 - 100 * float(diffDroppedFrames) / float(diffTotalFrames);
|
||||
|
||||
MOZ_ASSERT(percentage >= 0);
|
||||
|
||||
|
@ -53,12 +53,12 @@ class DecoderBenchmark final {
|
||||
const nsACString& aKey);
|
||||
~DecoderBenchmark() = default;
|
||||
|
||||
// Keep the last ParsedFrames and DroppedFrames from FrameStatistics.
|
||||
// Keep the last TotalFrames and DroppedFrames from FrameStatistics.
|
||||
// FrameStatistics keep an ever-increasing counter across the entire video and
|
||||
// even when there are resolution changes. This code is called whenever there
|
||||
// is a resolution change and we need to calculate the benchmark since the
|
||||
// last call.
|
||||
uint64_t mLastParsedFrames = 0;
|
||||
uint64_t mLastTotalFrames = 0;
|
||||
uint64_t mLastDroppedFrames = 0;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user