diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index a141a2b75510..d44342810be1 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -5717,6 +5717,8 @@ ContentParent::RecvNotifyBenchmarkResult(const nsString& aCodecName, { if (aCodecName.EqualsLiteral("VP9")) { Preferences::SetUint(VP9Benchmark::sBenchmarkFpsPref, aDecodeFPS); + Preferences::SetUint(VP9Benchmark::sBenchmarkFpsVersionCheck, + VP9Benchmark::sBenchmarkVersionID); } return true; } diff --git a/dom/media/Benchmark.cpp b/dom/media/Benchmark.cpp index 9357889d367e..fa8a52831164 100644 --- a/dom/media/Benchmark.cpp +++ b/dom/media/Benchmark.cpp @@ -16,7 +16,12 @@ namespace mozilla { +// Update this version number to force re-running the benchmark. Such as when +// an improvement to FFVP9 or LIBVPX is deemed worthwhile. +const uint32_t VP9Benchmark::sBenchmarkVersionID = 1; + const char* VP9Benchmark::sBenchmarkFpsPref = "media.benchmark.vp9.fps"; +const char* VP9Benchmark::sBenchmarkFpsVersionCheck = "media.benchmark.vp9.versioncheck"; bool VP9Benchmark::sHasRunTest = false; bool @@ -25,8 +30,9 @@ VP9Benchmark::IsVP9DecodeFast() MOZ_ASSERT(NS_IsMainThread()); bool hasPref = Preferences::HasUserValue(sBenchmarkFpsPref); + uint32_t hadRecentUpdate = Preferences::GetUint(sBenchmarkFpsVersionCheck, 0U); - if (!sHasRunTest && !hasPref) { + if (!sHasRunTest && (!hasPref || hadRecentUpdate != sBenchmarkVersionID)) { sHasRunTest = true; RefPtr demuxer = @@ -54,6 +60,7 @@ VP9Benchmark::IsVP9DecodeFast() } } else { Preferences::SetUint(sBenchmarkFpsPref, aDecodeFps); + Preferences::SetUint(sBenchmarkFpsVersionCheck, sBenchmarkVersionID); } Telemetry::Accumulate(Telemetry::ID::VIDEO_VP9_BENCHMARK_FPS, aDecodeFps); }, diff --git a/dom/media/Benchmark.h b/dom/media/Benchmark.h index 3944c1e9e44b..f4c3dad3e350 100644 --- a/dom/media/Benchmark.h +++ b/dom/media/Benchmark.h @@ -104,6 +104,8 @@ class VP9Benchmark public: static bool IsVP9DecodeFast(); static const char* sBenchmarkFpsPref; + static const char* sBenchmarkFpsVersionCheck; + static const uint32_t sBenchmarkVersionID; static bool sHasRunTest; }; }