Bug 1149343 - Part2: Add HW decode blacklisting support on mac. r=mattwoodrow

This commit is contained in:
Jean-Yves Avenard 2015-03-31 14:18:38 +11:00
parent 0427f54e6b
commit b10106d3f9
2 changed files with 14 additions and 1 deletions

View File

@ -21,6 +21,7 @@
#include "prlog.h"
#include "VideoUtils.h"
#include <algorithm>
#include "gfxPlatform.h"
#ifdef PR_LOGGING
PRLogModuleInfo* GetAppleMediaLog();
@ -79,6 +80,11 @@ AppleVDADecoder::~AppleVDADecoder()
nsresult
AppleVDADecoder::Init()
{
if (!gfxPlatform::CanUseHardwareVideoDecoding()) {
// This GPU is blacklisted for hardware decoding.
return NS_ERROR_FAILURE;
}
if (mDecoder) {
return NS_OK;
}

View File

@ -19,6 +19,7 @@
#include "nsThreadUtils.h"
#include "prlog.h"
#include "VideoUtils.h"
#include "gfxPlatform.h"
#ifdef PR_LOGGING
PRLogModuleInfo* GetAppleMediaLog();
@ -381,7 +382,13 @@ AppleVTDecoder::CreateDecoderSpecification()
}
const void* specKeys[] = { AppleVTLinker::skPropEnableHWAccel };
const void* specValues[] = { kCFBooleanTrue };
const void* specValues[1];
if (gfxPlatform::CanUseHardwareVideoDecoding()) {
specValues[0] = kCFBooleanTrue;
} else {
// This GPU is blacklisted for hardware decoding.
specValues[0] = kCFBooleanFalse;
}
static_assert(ArrayLength(specKeys) == ArrayLength(specValues),
"Non matching keys/values array size");