Bug 1097116 - Disable Android MediaCodec on PowerVR devices r=cpearce

--HG--
extra : rebase_source : 8c852f321f5755f4af702011f6cf72ba9c605104
This commit is contained in:
James Willcox 2014-11-26 15:16:08 -06:00
parent 4628c09c1a
commit 1cda29e8cc

View File

@ -24,6 +24,7 @@
#include "apple/AppleDecoderModule.h" #include "apple/AppleDecoderModule.h"
#endif #endif
#ifdef MOZ_WIDGET_ANDROID #ifdef MOZ_WIDGET_ANDROID
#include "nsIGfxInfo.h"
#include "AndroidBridge.h" #include "AndroidBridge.h"
#endif #endif
@ -180,6 +181,27 @@ IsAppleAvailable()
#endif #endif
} }
static bool
IsAndroidAvailable()
{
#ifndef MOZ_WIDGET_ANDROID
return false;
#else
// PowerVR is very slow at texture allocation for some reason, which causes poor performance.
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
nsString vendor;
if (NS_FAILED(gfxInfo->GetAdapterVendorID(vendor)) ||
vendor.Find("Imagination") == 0) {
printf_stderr("SNORP: not doing video for PowerVR\n");
return nullptr;
}
// We need android.media.MediaCodec which exists in API level 16 and higher.
return AndroidBridge::Bridge()->GetAPIVersion() >= 16;
#endif
}
static bool static bool
IsGonkMP4DecoderAvailable() IsGonkMP4DecoderAvailable()
{ {
@ -194,10 +216,7 @@ HavePlatformMPEGDecoders()
// We have H.264/AAC platform decoders on Windows Vista and up. // We have H.264/AAC platform decoders on Windows Vista and up.
IsVistaOrLater() || IsVistaOrLater() ||
#endif #endif
#ifdef MOZ_WIDGET_ANDROID IsAndroidAvailable() ||
// We need android.media.MediaCodec which exists in API level 16 and higher.
(AndroidBridge::Bridge()->GetAPIVersion() >= 16) ||
#endif
IsFFmpegAvailable() || IsFFmpegAvailable() ||
IsAppleAvailable() || IsAppleAvailable() ||
IsGonkMP4DecoderAvailable() || IsGonkMP4DecoderAvailable() ||