Bug 1137529: Prefer Apple's VDA hardware acceleration for Hi-Def videos. r=rillian

With some GPUs (such as Intel HD-x000), Apple VideoTool box provides poor
decoding speed, causing us to drop frames for most HD videos.
VDA is around 50 times faster on those machines (31ms average to decode a 4K
frame with VT, while 0.6ms average with VDA)
This commit is contained in:
Jean-Yves Avenard 2015-03-02 10:48:28 +11:00
Родитель 04ed53a51a
Коммит 79e326a1c4
1 изменённых файлов: 8 добавлений и 3 удалений

Просмотреть файл

@ -27,6 +27,9 @@ PRLogModuleInfo* GetAppleMediaLog() {
namespace mozilla {
// This defines the resolution height over which VDA will be prefered.
#define VDA_RESOLUTION_THRESHOLD 720
bool AppleDecoderModule::sInitialized = false;
bool AppleDecoderModule::sIsVTAvailable = false;
bool AppleDecoderModule::sIsVTHWAvailable = false;
@ -47,12 +50,12 @@ AppleDecoderModule::Init()
{
MOZ_ASSERT(NS_IsMainThread(), "Must be on main thread.");
sForceVDA = Preferences::GetBool("media.apple.forcevda", false);
if (sInitialized) {
return;
}
Preferences::AddBoolVarCache(&sForceVDA, "media.apple.forcevda", false);
// dlopen VideoDecodeAcceleration.framework if it's available.
sIsVDAAvailable = AppleVDALinker::Link();
@ -163,7 +166,9 @@ AppleDecoderModule::CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aC
{
nsRefPtr<MediaDataDecoder> decoder;
if (sIsVDAAvailable && (!sIsVTHWAvailable || sForceVDA)) {
if (sIsVDAAvailable &&
(!sIsVTHWAvailable || sForceVDA ||
aConfig.image_height >= VDA_RESOLUTION_THRESHOLD)) {
decoder =
AppleVDADecoder::CreateVDADecoder(aConfig,
aVideoTaskQueue,