Bug 1681043 - P4. Stop checking on gfxVars::CanUseHardwareVideoDecoding on mac. r=alwu

gfxVars::CanUseHardwareVideoDecoding is often set after the first use of the PDMFactory; in this case this would disable HW VP9 decoding for the entire session of the browser.

This value will always end up being true on macOS, so ignore its value in the static Init method.

Differential Revision: https://phabricator.services.mozilla.com/D100307
This commit is contained in:
Jean-Yves Avenard 2021-01-06 08:33:20 +00:00
Родитель dfb40277e0
Коммит 3631cb632e
3 изменённых файлов: 3 добавлений и 7 удалений

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

@ -15,7 +15,6 @@
#include "mozilla/DebugOnly.h"
#include "mozilla/Logging.h"
#include "mozilla/StaticPrefs_media.h"
#include "mozilla/gfx/gfxVars.h"
extern "C" {
// Only exists from MacOS 11
@ -28,7 +27,6 @@ extern Boolean VTIsHardwareDecodeSupported(CMVideoCodecType codecType)
namespace mozilla {
bool AppleDecoderModule::sInitialized = false;
bool AppleDecoderModule::sCanUseHardwareVideoDecoder = true;
bool AppleDecoderModule::sCanUseVP9Decoder = false;
/* static */
@ -37,8 +35,6 @@ void AppleDecoderModule::Init() {
return;
}
sCanUseHardwareVideoDecoder = gfx::gfxVars::CanUseHardwareVideoDecoding();
sInitialized = true;
if (RegisterSupplementalVP9Decoder()) {
sCanUseVP9Decoder = CanCreateVP9Decoder();
@ -134,7 +130,7 @@ bool AppleDecoderModule::CanCreateVP9Decoder() {
// warning as VTIsHardwareDecodeSupported is only available from macOS 10.13.
if (__builtin_available(macOS 10.13, *)) {
// Only use VP9 decoder if it's hardware accelerated.
if (!sCanUseHardwareVideoDecoder || !VTIsHardwareDecodeSupported ||
if (!VTIsHardwareDecodeSupported ||
!VTIsHardwareDecodeSupported(kCMVideoCodecType_VP9)) {
return false;
}

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

@ -36,7 +36,6 @@ class AppleDecoderModule : public PlatformDecoderModule {
static void Init();
static bool sCanUseHardwareVideoDecoder;
static bool sCanUseVP9Decoder;
static constexpr int kCMVideoCodecType_VP9{'vp09'};

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

@ -21,6 +21,7 @@
#include "mozilla/ArrayUtils.h"
#include "mozilla/Logging.h"
#include "mozilla/TaskQueue.h"
#include "mozilla/gfx/gfxVars.h"
#include "nsThreadUtils.h"
#define LOG(...) DDMOZ_LOG(sPDMLog, mozilla::LogLevel::Debug, __VA_ARGS__)
@ -581,7 +582,7 @@ CFDictionaryRef AppleVTDecoder::CreateDecoderSpecification() {
const void* specKeys[] = {
kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder};
const void* specValues[1];
if (AppleDecoderModule::sCanUseHardwareVideoDecoder) {
if (gfx::gfxVars::CanUseHardwareVideoDecoding()) {
specValues[0] = kCFBooleanTrue;
} else {
// This GPU is blacklisted for hardware decoding.