Bug 1286738 - part3-mediasource: Enable fennec vp9 only if we have hw deocder. r=jya
MozReview-Commit-ID: BwAZTrgXcaP
--- a/dom/media/Benchmark.cpp
+++ b/dom/media/Benchmark.cpp
@@ -30,17 +30,17 @@ bool VP9Benchmark::sHasRunTest = false;
// static
bool
VP9Benchmark::IsVP9DecodeFast()
{
MOZ_ASSERT(NS_IsMainThread());
#ifdef MOZ_WIDGET_ANDROID
- return true;
+ return false;
#else
bool hasPref = Preferences::HasUserValue(sBenchmarkFpsPref);
uint32_t hadRecentUpdate = Preferences::GetUint(sBenchmarkFpsVersionCheck, 0U);
if (!sHasRunTest && (!hasPref || hadRecentUpdate != sBenchmarkVersionID)) {
sHasRunTest = true;
RefPtr<WebMDemuxer> demuxer =
--- a/dom/media/mediasource/MediaSource.cpp
+++ b/dom/media/mediasource/MediaSource.cpp
@@ -28,16 +28,20 @@
#include "nsPIDOMWindow.h"
#include "nsString.h"
#include "nsThreadUtils.h"
#include "mozilla/Logging.h"
#include "nsServiceManagerUtils.h"
#include "mozilla/gfx/gfxVars.h"
#include "mozilla/Sprintf.h"
+#ifdef MOZ_WIDGET_ANDROID
+#include "AndroidBridge.h"
+#endif
+
struct JSContext;
class JSObject;
mozilla::LogModule* GetMediaSourceLog()
{
static mozilla::LazyLogModule sLogModule("MediaSource");
return sLogModule;
}
@@ -66,17 +70,22 @@ namespace mozilla {
// 3. The CPU is considered to be fast enough
static bool
IsWebMForced(DecoderDoctorDiagnostics* aDiagnostics)
{
bool mp4supported =
DecoderTraits::IsMP4TypeAndEnabled(NS_LITERAL_CSTRING("video/mp4"),
aDiagnostics);
bool hwsupported = gfx::gfxVars::CanUseHardwareVideoDecoding();
+#ifdef MOZ_WIDGET_ANDROID
+ return !mp4supported || !hwsupported || VP9Benchmark::IsVP9DecodeFast() ||
+ java::HardwareCodecCapabilityUtils::HasHWVP9();
+#else
return !mp4supported || !hwsupported || VP9Benchmark::IsVP9DecodeFast();
+#endif
}
namespace dom {
/* static */
nsresult
MediaSource::IsTypeSupported(const nsAString& aType, DecoderDoctorDiagnostics* aDiagnostics)
{