Bug 1256626: P2. Use NotifyBenchmarkResult to save VP9 result. r?jimm
MozReview-Commit-ID: privnKY1zB
--- a/dom/media/Benchmark.cpp
+++ b/dom/media/Benchmark.cpp
@@ -7,16 +7,17 @@
#include "Benchmark.h"
#include "BufferMediaResource.h"
#include "MediaData.h"
#include "PDMFactory.h"
#include "WebMDemuxer.h"
#include "WebMSample.h"
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
+#include "mozilla/dom/ContentChild.h"
namespace mozilla {
const char* VP9Benchmark::sBenchmarkFpsPref = "media.benchmark.vp9.fps";
bool VP9Benchmark::sHasRunTest = false;
bool
VP9Benchmark::IsVP9DecodeFast()
@@ -40,17 +41,25 @@ VP9Benchmark::IsVP9DecodeFast()
1, // start benchmarking after decoding this frame.
8, // loop after decoding that many frames.
TimeDuration::FromMilliseconds(
Preferences::GetUint("media.benchmark.timeout", 1000))
});
estimiser->Run()->Then(
AbstractThread::MainThread(), __func__,
[](uint32_t aDecodeFps) {
- Preferences::SetUint(sBenchmarkFpsPref, aDecodeFps);
+ if (XRE_IsContentProcess()) {
+ dom::ContentChild* contentChild = dom::ContentChild::GetSingleton();
+ if (contentChild) {
+ contentChild->SendNotifyBenchmarkResult(NS_LITERAL_STRING("VP9"),
+ aDecodeFps);
+ }
+ } else {
+ Preferences::SetUint(sBenchmarkFpsPref, aDecodeFps);
+ }
Telemetry::Accumulate(Telemetry::ID::VIDEO_VP9_BENCHMARK_FPS, aDecodeFps);
},
[]() { });
}
if (!hasPref) {
return false;
}