Bug 1263839: P2. Force re-run of VP9 benchmark based on a version check. r?kentuckyfriedtakahe
The version number is to be manually updated when we want to re-run the test (like improvement in ffvp9 or libvpx)
MozReview-Commit-ID: 9KzYCGWvIpp
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -5712,16 +5712,18 @@ ContentParent::RecvGetAndroidSystemInfo(
bool
ContentParent::RecvNotifyBenchmarkResult(const nsString& aCodecName,
const uint32_t& aDecodeFPS)
{
if (aCodecName.EqualsLiteral("VP9")) {
Preferences::SetUint(VP9Benchmark::sBenchmarkFpsPref, aDecodeFPS);
+ Preferences::SetUint(VP9Benchmark::sBenchmarkFpsVersionCheck,
+ VP9Benchmark::sBenchmarkVersionID);
}
return true;
}
void
ContentParent::StartProfiler(nsIProfilerStartParams* aParams)
{
#ifdef MOZ_ENABLE_PROFILER_SPS
--- a/dom/media/Benchmark.cpp
+++ b/dom/media/Benchmark.cpp
@@ -11,27 +11,33 @@
#include "WebMDemuxer.h"
#include "WebMSample.h"
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
#include "mozilla/dom/ContentChild.h"
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
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<WebMDemuxer> demuxer =
new WebMDemuxer(new BufferMediaResource(sWebMSample, sizeof(sWebMSample), nullptr,
NS_LITERAL_CSTRING("video/webm")));
PDMFactory::Init();
RefPtr<Benchmark> estimiser =
@@ -49,16 +55,17 @@ VP9Benchmark::IsVP9DecodeFast()
if (XRE_IsContentProcess()) {
dom::ContentChild* contentChild = dom::ContentChild::GetSingleton();
if (contentChild) {
contentChild->SendNotifyBenchmarkResult(NS_LITERAL_STRING("VP9"),
aDecodeFps);
}
} else {
Preferences::SetUint(sBenchmarkFpsPref, aDecodeFps);
+ Preferences::SetUint(sBenchmarkFpsVersionCheck, sBenchmarkVersionID);
}
Telemetry::Accumulate(Telemetry::ID::VIDEO_VP9_BENCHMARK_FPS, aDecodeFps);
},
[]() { });
}
if (!hasPref) {
return false;
--- a/dom/media/Benchmark.h
+++ b/dom/media/Benchmark.h
@@ -99,13 +99,15 @@ private:
MozPromiseHolder<BenchmarkPromise> mPromise;
};
class VP9Benchmark
{
public:
static bool IsVP9DecodeFast();
static const char* sBenchmarkFpsPref;
+ static const char* sBenchmarkFpsVersionCheck;
+ static const uint32_t sBenchmarkVersionID;
static bool sHasRunTest;
};
}
#endif