Backed out 6 changesets (bug 1681043) for causing multiple failures.

CLOSED TREE

Backed out changeset ea075101dc94 (bug 1681043)
Backed out changeset 64d8abe2104d (bug 1681043)
Backed out changeset 5ecb208a85d3 (bug 1681043)
Backed out changeset 9319fdd0389c (bug 1681043)
Backed out changeset 25a015e84cc4 (bug 1681043)
Backed out changeset e8fac91d4012 (bug 1681043)
This commit is contained in:
Mihai Alexandru Michis 2021-01-04 07:43:08 +02:00
parent f7895c0e34
commit f8a41209af
24 changed files with 227 additions and 420 deletions

View File

@ -1323,6 +1323,7 @@ void ContentChild::InitXPCOM(
DataStorage::SetCachedStorageEntries(aXPCOMInit.dataStorage());
PDMFactory::SetSupported(aXPCOMInit.codecsSupported());
// Initialize the RemoteDecoderManager thread and its associated PBackground
// channel.
RemoteDecoderManagerChild::Init();
@ -4452,14 +4453,6 @@ IPCResult ContentChild::RecvFlushFOGData(FlushFOGDataResolver&& aResolver) {
return IPC_OK();
}
IPCResult ContentChild::RecvUpdateMediaCodecsSupported(
RemoteDecodeIn aLocation,
const PDMFactory::MediaCodecsSupported& aSupported) {
RemoteDecoderManagerChild::SetSupported(aLocation, aSupported);
return IPC_OK();
}
} // namespace dom
#if defined(__OpenBSD__) && defined(MOZ_SANDBOX)

View File

@ -837,10 +837,6 @@ class ContentChild final : public PContentChild,
private:
mozilla::ipc::IPCResult RecvFlushFOGData(FlushFOGDataResolver&& aResolver);
mozilla::ipc::IPCResult RecvUpdateMediaCodecsSupported(
RemoteDecodeIn aLocation,
const PDMFactory::MediaCodecsSupported& aSupported);
#ifdef NIGHTLY_BUILD
virtual PContentChild::Result OnMessageReceived(const Message& aMsg) override;
#else

View File

@ -30,7 +30,6 @@
# include "mozilla/a11y/AccessibleWrap.h"
# include "mozilla/a11y/Compatibility.h"
#endif
#include <map>
#include <utility>
#include "BrowserParent.h"
@ -38,6 +37,7 @@
#include "Geolocation.h"
#include "GfxInfoBase.h"
#include "MMPrinter.h"
#include "PDMFactory.h"
#include "PreallocatedProcessManager.h"
#include "ProcessPriorityManager.h"
#include "SandboxHal.h"
@ -66,7 +66,6 @@
#include "mozilla/PresShell.h"
#include "mozilla/ProcessHangMonitor.h"
#include "mozilla/ProcessHangMonitorIPC.h"
#include "mozilla/RDDProcessManager.h"
#include "mozilla/ScopeExit.h"
#include "mozilla/ScriptPreloader.h"
#include "mozilla/Services.h"
@ -368,9 +367,6 @@ namespace dom {
LazyLogModule gProcessLog("Process");
static std::map<RemoteDecodeIn, PDMFactory::MediaCodecsSupported>
sCodecsSupported;
/* static */
LogModule* ContentParent::GetLog() { return gProcessLog; }
@ -1505,16 +1501,6 @@ void ContentParent::BroadcastThemeUpdate(widget::ThemeChangeKind aKind) {
}
}
/*static */
void ContentParent::BroadcastMediaCodecsSupportedUpdate(
RemoteDecodeIn aLocation,
const PDMFactory::MediaCodecsSupported& aSupported) {
sCodecsSupported[aLocation] = aSupported;
for (auto* cp : AllProcesses(eAll)) {
Unused << cp->SendUpdateMediaCodecsSupported(aLocation, aSupported);
}
}
const nsACString& ContentParent::GetRemoteType() const { return mRemoteType; }
void ContentParent::Init() {
@ -2802,9 +2788,9 @@ bool ContentParent::InitInternal(ProcessPriority aInitialPriority) {
// Send the dynamic scalar definitions to the new process.
TelemetryIPC::GetDynamicScalarDefinitions(xpcomInit.dynamicScalarDefs());
for (auto const& [location, supported] : sCodecsSupported) {
Unused << SendUpdateMediaCodecsSupported(location, supported);
}
// Pre-calculate the various PlatformDecoderModule (PDM) supported on this
// machine.
xpcomInit.codecsSupported() = PDMFactory::Supported();
// Must send screen info before send initialData
ScreenManager& screenManager = ScreenManager::GetSingleton();
@ -2903,12 +2889,6 @@ bool ContentParent::InitInternal(ProcessPriority aInitialPriority) {
gpm->AddListener(this);
if (StaticPrefs::media_rdd_process_enabled()) {
// Ensure the RDD process has been started.
RDDProcessManager* rdd = RDDProcessManager::Get();
rdd->LaunchRDDProcess();
}
nsStyleSheetService* sheetService = nsStyleSheetService::GetInstance();
if (sheetService) {
// This looks like a lot of work, but in a normal browser session we just

View File

@ -257,10 +257,6 @@ class ContentParent final
static void BroadcastThemeUpdate(widget::ThemeChangeKind);
static void BroadcastMediaCodecsSupportedUpdate(
RemoteDecodeIn aLocation,
const PDMFactory::MediaCodecsSupported& aSupported);
const nsACString& GetRemoteType() const override;
virtual void DoGetRemoteType(nsACString& aRemoteType,

View File

@ -146,7 +146,6 @@ using class mozilla::dom::SessionHistoryInfo from "mozilla/dom/SessionHistoryEnt
using struct nsPoint from "nsPoint.h";
using struct mozilla::dom::LoadingSessionHistoryInfo from "mozilla/dom/SessionHistoryEntry.h";
using mozilla::PDMFactory::MediaCodecsSupported from "PDMFactory.h";
using mozilla::RemoteDecodeIn from "mozilla/RemoteDecoderManagerChild.h";
using mozilla::dom::PerformanceTimingData from "mozilla/dom/PerformanceTiming.h";
union ChromeRegistryItem
@ -328,6 +327,7 @@ struct XPCOMInitData
nsCString[] requestedLocales;
DynamicScalarDefinition[] dynamicScalarDefs;
SystemParameterKVPair[] systemParameters;
MediaCodecsSupported codecsSupported;
};
struct VisitedQueryResult
@ -947,9 +947,6 @@ child:
async DispatchBeforeUnloadToSubtree(MaybeDiscardedBrowsingContext aStartingAt)
returns (PermitUnloadResult result);
// Update the cached list of codec supported in the given process.
async UpdateMediaCodecsSupported(RemoteDecodeIn aLocation, MediaCodecsSupported aSupported);
parent:
/**
* This is a temporary way to pass index and length through parent process.

View File

@ -15,7 +15,6 @@ using mozilla::dom::NativeThreadId from "mozilla/dom/NativeThreadId.h";
using moveonly mozilla::UntrustedModulesData from "mozilla/UntrustedModulesData.h";
using moveonly mozilla::ModulePaths from "mozilla/UntrustedModulesData.h";
using moveonly mozilla::ModulesMapResult from "mozilla/UntrustedModulesData.h";
using mozilla::PDMFactory::MediaCodecsSupported from "PDMFactory.h";
namespace mozilla {
@ -59,10 +58,6 @@ child:
async GetModulesTrust(ModulePaths aModPaths, bool aRunAtNormalPriority)
returns (ModulesMapResult? modMapResult);
// Update the cached list of codec supported following a check in the
// RDD parent.
async UpdateMediaCodecsSupported(MediaCodecsSupported aSupported);
};
} // namespace mozilla

View File

@ -6,12 +6,11 @@
#include "RDDChild.h"
#include "mozilla/RDDProcessManager.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/MemoryReportRequest.h"
#include "mozilla/gfx/GPUProcessManager.h"
#include "mozilla/gfx/gfxVars.h"
#include "mozilla/ipc/CrashReporterHost.h"
#include "mozilla/ipc/Endpoint.h"
#include "mozilla/gfx/gfxVars.h"
#include "mozilla/gfx/GPUProcessManager.h"
#if defined(XP_LINUX) && defined(MOZ_SANDBOX)
# include "mozilla/SandboxBroker.h"
@ -139,13 +138,6 @@ mozilla::ipc::IPCResult RDDChild::RecvGetModulesTrust(
#endif // defined(XP_WIN)
}
mozilla::ipc::IPCResult RDDChild::RecvUpdateMediaCodecsSupported(
const PDMFactory::MediaCodecsSupported& aSupported) {
dom::ContentParent::BroadcastMediaCodecsSupportedUpdate(
RemoteDecodeIn::RddProcess, aSupported);
return IPC_OK();
}
void RDDChild::ActorDestroy(ActorDestroyReason aWhy) {
if (aWhy == AbnormalShutdown) {
GenerateCrashReport(OtherPid());

View File

@ -6,10 +6,11 @@
#ifndef _include_dom_media_ipc_RDDChild_h_
#define _include_dom_media_ipc_RDDChild_h_
#include "mozilla/PRDDChild.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/gfx/GPUProcessListener.h"
#include "mozilla/gfx/gfxVarReceiver.h"
#include "mozilla/ipc/CrashReporterHelper.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/gfx/gfxVarReceiver.h"
#include "mozilla/gfx/GPUProcessListener.h"
namespace mozilla {
@ -44,8 +45,6 @@ class RDDChild final : public PRDDChild,
mozilla::ipc::IPCResult RecvGetModulesTrust(
ModulePaths&& aModPaths, bool aRunAtNormalPriority,
GetModulesTrustResolver&& aResolver);
mozilla::ipc::IPCResult RecvUpdateMediaCodecsSupported(
const PDMFactory::MediaCodecsSupported& aSupported);
bool SendRequestMemoryReport(const uint32_t& aGeneration,
const bool& aAnonymize,

View File

@ -6,31 +6,27 @@
#include "RDDParent.h"
#if defined(XP_WIN)
# include <dwrite.h>
# include <process.h>
# include "WMF.h"
# include "WMFDecoderModule.h"
# include "mozilla/WinDllServices.h"
# include "mozilla/gfx/DeviceManagerDx.h"
# include "WMF.h"
# include <process.h>
# include <dwrite.h>
# include "mozilla/WinDllServices.h"
#else
# include <unistd.h>
#endif
#include "PDMFactory.h"
#include "chrome/common/ipc_channel.h"
#include "gfxConfig.h"
#include "mozilla/Assertions.h"
#include "mozilla/HangDetails.h"
#include "mozilla/Preferences.h"
#include "mozilla/RemoteDecoderManagerChild.h"
#include "mozilla/RemoteDecoderManagerParent.h"
#include "mozilla/ScopeExit.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/dom/MemoryReportRequest.h"
#include "mozilla/gfx/gfxVars.h"
#include "mozilla/ipc/CrashReporterClient.h"
#include "mozilla/ipc/ProcessChild.h"
#include "mozilla/gfx/gfxVars.h"
#include "gfxConfig.h"
#if defined(XP_LINUX) && defined(MOZ_SANDBOX)
# include "mozilla/Sandbox.h"
@ -41,14 +37,14 @@
#endif
#if defined(XP_MACOSX) && defined(MOZ_SANDBOX)
# include "RDDProcessHost.h"
# include "mozilla/Sandbox.h"
# include "nsMacUtilsImpl.h"
# include "RDDProcessHost.h"
#endif
#include "ProcessUtils.h"
#include "nsDebugImpl.h"
#include "nsThreadManager.h"
#include "ProcessUtils.h"
namespace mozilla {
@ -124,9 +120,6 @@ mozilla::ipc::IPCResult RDDParent::RecvInit(
gfxVars::ApplyUpdate(var);
}
auto supported = PDMFactory::Supported();
Unused << SendUpdateMediaCodecsSupported(supported);
#if defined(MOZ_SANDBOX)
# if defined(XP_MACOSX)
// Close all current connections to the WindowServer. This ensures that the
@ -153,18 +146,6 @@ mozilla::ipc::IPCResult RDDParent::RecvInit(
}
IPCResult RDDParent::RecvUpdateVar(const GfxVarUpdate& aUpdate) {
#if defined(XP_WIN)
auto scopeExit = MakeScopeExit(
[couldUseHWDecoder = gfx::gfxVars::CanUseHardwareVideoDecoding()] {
if (couldUseHWDecoder != gfx::gfxVars::CanUseHardwareVideoDecoding()) {
// The capabilities of the system may have changed, force a refresh by
// re-initializing the WMF PDM.
WMFDecoderModule::Init();
Unused << RDDParent::GetSingleton()->SendUpdateMediaCodecsSupported(
PDMFactory::Supported(true /* force refresh */));
}
});
#endif
gfxVars::ApplyUpdate(aUpdate);
return IPC_OK();
}

View File

@ -100,96 +100,75 @@ void RDDProcessManager::OnPreferenceChange(const char16_t* aData) {
}
}
RefPtr<GenericNonExclusivePromise> RDDProcessManager::LaunchRDDProcess() {
MOZ_ASSERT(NS_IsMainThread());
if (!Get()) {
// Shutdown?
return GenericNonExclusivePromise::CreateAndReject(NS_ERROR_NOT_AVAILABLE,
__func__);
}
if (mNumProcessAttempts && !StaticPrefs::media_rdd_retryonfailure_enabled()) {
// We failed to start the RDD process earlier, abort now.
return GenericNonExclusivePromise::CreateAndReject(NS_ERROR_NOT_AVAILABLE,
__func__);
}
if (mLaunchRDDPromise && mProcess) {
return mLaunchRDDPromise;
}
std::vector<std::string> extraArgs;
nsCString parentBuildID(mozilla::PlatformBuildID());
extraArgs.push_back("-parentBuildID");
extraArgs.push_back(parentBuildID.get());
// The subprocess is launched asynchronously, so we
// wait for the promise to be resolved to acquire the IPDL actor.
mProcess = new RDDProcessHost(this);
if (!mProcess->Launch(extraArgs)) {
mNumProcessAttempts++;
DestroyProcess();
return GenericNonExclusivePromise::CreateAndReject(NS_ERROR_NOT_AVAILABLE,
__func__);
}
mLaunchRDDPromise = mProcess->LaunchPromise()->Then(
GetMainThreadSerialEventTarget(), __func__,
[this](bool) {
if (!Get()) {
// Shutdown?
return GenericNonExclusivePromise::CreateAndReject(
NS_ERROR_NOT_AVAILABLE, __func__);
}
mRDDChild = mProcess->GetActor();
mProcessToken = mProcess->GetProcessToken();
// Flush any pref updates that happened during
// launch and weren't included in the blobs set
// up in LaunchRDDProcess.
for (const mozilla::dom::Pref& pref : mQueuedPrefs) {
Unused << NS_WARN_IF(!mRDDChild->SendPreferenceUpdate(pref));
}
mQueuedPrefs.Clear();
CrashReporter::AnnotateCrashReport(
CrashReporter::Annotation::RDDProcessStatus, "Running"_ns);
if (!CreateVideoBridge()) {
mNumProcessAttempts++;
DestroyProcess();
return GenericNonExclusivePromise::CreateAndReject(
NS_ERROR_NOT_AVAILABLE, __func__);
}
return GenericNonExclusivePromise::CreateAndResolve(true, __func__);
},
[this](nsresult aError) {
if (Get()) {
mNumProcessAttempts++;
DestroyProcess();
}
return GenericNonExclusivePromise::CreateAndReject(aError, __func__);
});
return mLaunchRDDPromise;
}
auto RDDProcessManager::EnsureRDDProcessAndCreateBridge(
base::ProcessId aOtherProcess) -> RefPtr<EnsureRDDPromise> {
return InvokeAsync(
GetMainThreadSerialEventTarget(), __func__,
[aOtherProcess, this]() -> RefPtr<EnsureRDDPromise> {
return LaunchRDDProcess()->Then(
if (!Get()) {
// Shutdown?
return EnsureRDDPromise::CreateAndReject(NS_ERROR_NOT_AVAILABLE,
__func__);
}
if (mProcess) {
return mProcess->LaunchPromise()->Then(
GetMainThreadSerialEventTarget(), __func__,
[aOtherProcess, this](bool) {
ipc::Endpoint<PRemoteDecoderManagerChild> endpoint;
if (!CreateContentBridge(aOtherProcess, &endpoint)) {
return EnsureRDDPromise::CreateAndReject(
NS_ERROR_NOT_AVAILABLE, __func__);
}
return EnsureRDDPromise::CreateAndResolve(std::move(endpoint),
__func__);
},
[](nsresult aError) {
return EnsureRDDPromise::CreateAndReject(aError, __func__);
});
}
if (mNumProcessAttempts &&
!StaticPrefs::media_rdd_retryonfailure_enabled()) {
// We failed to start the RDD process earlier, abort now.
return EnsureRDDPromise::CreateAndReject(NS_ERROR_NOT_AVAILABLE,
__func__);
}
// Launch the RDD process.
std::vector<std::string> extraArgs;
nsCString parentBuildID(mozilla::PlatformBuildID());
extraArgs.push_back("-parentBuildID");
extraArgs.push_back(parentBuildID.get());
// The subprocess is launched asynchronously, so we
// wait for the promise to be resolved to acquire the IPDL actor.
mProcess = new RDDProcessHost(this);
if (!mProcess->Launch(extraArgs)) {
DestroyProcess();
return EnsureRDDPromise::CreateAndReject(NS_ERROR_NOT_AVAILABLE,
__func__);
}
return mProcess->LaunchPromise()->Then(
GetMainThreadSerialEventTarget(), __func__,
[aOtherProcess, this]() {
if (!Get()) {
// Shutdown?
return EnsureRDDPromise::CreateAndReject(NS_ERROR_NOT_AVAILABLE,
__func__);
[aOtherProcess, this](bool) {
mRDDChild = mProcess->GetActor();
mProcessToken = mProcess->GetProcessToken();
// Flush any pref updates that happened during
// launch and weren't included in the blobs set
// up in LaunchRDDProcess.
for (const mozilla::dom::Pref& pref : mQueuedPrefs) {
Unused << NS_WARN_IF(!mRDDChild->SendPreferenceUpdate(pref));
}
mQueuedPrefs.Clear();
CrashReporter::AnnotateCrashReport(
CrashReporter::Annotation::RDDProcessStatus, "Running"_ns);
ipc::Endpoint<PRemoteDecoderManagerChild> endpoint;
if (!CreateContentBridge(aOtherProcess, &endpoint)) {
if (!CreateVideoBridge() ||
!CreateContentBridge(aOtherProcess, &endpoint)) {
mNumProcessAttempts++;
return EnsureRDDPromise::CreateAndReject(NS_ERROR_NOT_AVAILABLE,
__func__);
}
@ -197,7 +176,9 @@ auto RDDProcessManager::EnsureRDDProcessAndCreateBridge(
return EnsureRDDPromise::CreateAndResolve(std::move(endpoint),
__func__);
},
[](nsresult aError) {
[this](nsresult aError) {
mNumProcessAttempts++;
DestroyProcess();
return EnsureRDDPromise::CreateAndReject(aError, __func__);
});
});
@ -286,11 +267,6 @@ bool RDDProcessManager::CreateVideoBridge() {
GPUProcessManager* gpuManager = GPUProcessManager::Get();
base::ProcessId gpuProcessPid = gpuManager ? gpuManager->GPUProcessPid() : -1;
// Build content device data first; this ensure that the GPU process is fully
// ready.
ContentDeviceData contentDeviceData;
gfxPlatform::GetPlatform()->BuildContentDeviceData(&contentDeviceData);
// The child end is the producer of video frames; the parent end is the
// consumer.
base::ProcessId childPid = RDDProcessPid();
@ -302,9 +278,13 @@ bool RDDProcessManager::CreateVideoBridge() {
if (NS_FAILED(rv)) {
MOZ_LOG(sPDMLog, LogLevel::Debug,
("Could not create video bridge: %d", int(rv)));
DestroyProcess();
return false;
}
ContentDeviceData contentDeviceData;
gfxPlatform::GetPlatform()->BuildContentDeviceData(&contentDeviceData);
mRDDChild->SendInitVideoBridge(std::move(childPipe),
mNumUnexpectedCrashes == 0, contentDeviceData);
if (gpuProcessPid != -1) {

View File

@ -31,8 +31,6 @@ class RDDProcessManager final : public RDDProcessHost::Listener {
using EnsureRDDPromise =
MozPromise<ipc::Endpoint<PRemoteDecoderManagerChild>, nsresult, true>;
// Launch a new RDD process asynchronously
RefPtr<GenericNonExclusivePromise> LaunchRDDProcess();
// If not using a RDD process, launch a new RDD process asynchronously and
// create a RemoteDecoderManager bridge
RefPtr<EnsureRDDPromise> EnsureRDDProcessAndCreateBridge(
@ -106,9 +104,6 @@ class RDDProcessManager final : public RDDProcessHost::Listener {
// the initial map is passed in command-line arguments) to be sent
// when the process can receive IPC messages.
nsTArray<dom::Pref> mQueuedPrefs;
// Promise will be resolved when the RDD process has been fully started and
// VideoBridge configured. Only accessed on the main thread.
RefPtr<GenericNonExclusivePromise> mLaunchRDDPromise;
};
} // namespace mozilla

View File

@ -5,7 +5,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "RemoteDecoderManagerChild.h"
#include "PDMFactory.h"
#include "RemoteAudioDecoder.h"
#include "RemoteMediaDataDecoder.h"
#include "RemoteVideoDecoder.h"
@ -46,11 +45,6 @@ static StaticRefPtr<RemoteDecoderManagerChild>
sRemoteDecoderManagerChildForGPUProcess;
static UniquePtr<nsTArray<RefPtr<Runnable>>> sRecreateTasks;
static StaticDataMutex<Maybe<PDMFactory::MediaCodecsSupported>> sGPUSupported(
"RDMC::sGPUSupported");
static StaticDataMutex<Maybe<PDMFactory::MediaCodecsSupported>> sRDDSupported(
"RDMC::sRDDSupported");
class ShutdownObserver final : public nsIObserver {
public:
NS_DECL_ISUPPORTS
@ -196,30 +190,18 @@ nsISerialEventTarget* RemoteDecoderManagerChild::GetManagerThread() {
bool RemoteDecoderManagerChild::Supports(
RemoteDecodeIn aLocation, const SupportDecoderParams& aParams,
DecoderDoctorDiagnostics* aDiagnostics) {
Maybe<PDMFactory::MediaCodecsSupported> supported;
RefPtr<PDMFactory> pdm;
switch (aLocation) {
case RemoteDecodeIn::RddProcess: {
auto supportedRDD = sRDDSupported.Lock();
supported = *supportedRDD;
case RemoteDecodeIn::RddProcess:
pdm = PDMFactory::PDMFactoryForRdd();
break;
}
case RemoteDecodeIn::GpuProcess: {
auto supportedGPU = sGPUSupported.Lock();
supported = *supportedGPU;
case RemoteDecodeIn::GpuProcess:
pdm = PDMFactory::PDMFactoryForGpu();
break;
}
default:
return false;
}
if (!supported) {
// We haven't received the correct information yet from either the GPU or
// the RDD process; assume it is supported to prevent false negative.
return true;
}
// We can ignore the SupportDecoderParams argument for now as creation of the
// decoder will actually fail later and fallback PDMs will be tested on later.
return PDMFactory::SupportsMimeType(aParams.MimeType(), *supported);
return pdm->Supports(aParams, aDiagnostics);
}
/* static */
@ -592,23 +574,4 @@ void RemoteDecoderManagerChild::HandleFatalError(const char* aMsg) const {
dom::ContentChild::FatalErrorIfNotUsingGPUProcess(aMsg, OtherPid());
}
void RemoteDecoderManagerChild::SetSupported(
RemoteDecodeIn aLocation,
const PDMFactory::MediaCodecsSupported& aSupported) {
switch (aLocation) {
case RemoteDecodeIn::GpuProcess: {
auto supported = sGPUSupported.Lock();
*supported = Some(aSupported);
break;
}
case RemoteDecodeIn::RddProcess: {
auto supported = sRDDSupported.Lock();
*supported = Some(aSupported);
break;
}
default:
MOZ_CRASH("Not to be used for any other process");
}
}
} // namespace mozilla

View File

@ -5,10 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef include_dom_media_ipc_RemoteDecoderManagerChild_h
#define include_dom_media_ipc_RemoteDecoderManagerChild_h
#include "GPUVideoImage.h"
#include "ipc/EnumSerializer.h"
#include "mozilla/EnumTypeTraits.h"
#include "mozilla/PRemoteDecoderManagerChild.h"
#include "mozilla/layers/VideoBridgeUtils.h"
@ -20,8 +17,6 @@ enum class RemoteDecodeIn {
Unspecified,
RddProcess,
GpuProcess,
SENTINEL,
};
class RemoteDecoderManagerChild final
@ -37,8 +32,6 @@ class RemoteDecoderManagerChild final
static RemoteDecoderManagerChild* GetSingleton(RemoteDecodeIn aLocation);
static void Init();
static void SetSupported(RemoteDecodeIn aLocation,
const PDMFactory::MediaCodecsSupported& aSupported);
// Can be called from any thread.
static bool Supports(RemoteDecodeIn aLocation,
@ -121,12 +114,4 @@ class RemoteDecoderManagerChild final
} // namespace mozilla
namespace IPC {
template <>
struct ParamTraits<mozilla::RemoteDecodeIn>
: public ContiguousEnumSerializer<mozilla::RemoteDecodeIn,
mozilla::RemoteDecodeIn::Unspecified,
mozilla::RemoteDecodeIn::SENTINEL> {};
} // namespace IPC
#endif // include_dom_media_ipc_RemoteDecoderManagerChild_h

View File

@ -6,9 +6,6 @@
#include "PDMFactory.h"
#ifdef MOZ_AV1
# include "AOMDecoder.h"
#endif
#include "AgnosticDecoderModule.h"
#include "AudioTrimmer.h"
#include "BlankDecoderModule.h"
@ -19,12 +16,8 @@
#include "MP4Decoder.h"
#include "MediaChangeMonitor.h"
#include "MediaInfo.h"
#include "OpusDecoder.h"
#include "TheoraDecoder.h"
#include "VPXDecoder.h"
#include "VideoUtils.h"
#include "VorbisDecoder.h"
#include "WAVDecoder.h"
#include "VPXDecoder.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/RemoteDecoderManagerChild.h"
#include "mozilla/RemoteDecoderModule.h"
@ -61,6 +54,10 @@
namespace mozilla {
// Set on the main thread, in content processes before any PDMFactory will ever
// be created; never modified after.
static Maybe<PDMFactory::MediaCodecsSupported> sSupported;
extern already_AddRefed<PlatformDecoderModule> CreateNullDecoderModule();
class PDMFactoryImpl final {
@ -71,6 +68,8 @@ class PDMFactoryImpl final {
} else if (XRE_IsRDDProcess()) {
InitRddPDMs();
} else if (XRE_IsContentProcess()) {
MOZ_DIAGNOSTIC_ASSERT(sSupported.isSome(),
"PDMFactory accessed while not initialized");
InitContentPDMs();
} else {
MOZ_DIAGNOSTIC_ASSERT(
@ -232,6 +231,31 @@ PDMFactory::PDMFactory() {
PDMFactory::~PDMFactory() = default;
PDMFactory::PDMFactory(const RemoteDecodeIn& aProcess) {
switch (aProcess) {
case RemoteDecodeIn::RddProcess:
CreateRddPDMs();
break;
case RemoteDecodeIn::GpuProcess:
CreateGpuPDMs();
break;
default:
MOZ_CRASH("Not to be used for any other process");
}
}
/* static */
already_AddRefed<PDMFactory> PDMFactory::PDMFactoryForRdd() {
RefPtr<PDMFactory> pdm = new PDMFactory(RemoteDecodeIn::RddProcess);
return pdm.forget();
}
/* static */
already_AddRefed<PDMFactory> PDMFactory::PDMFactoryForGpu() {
RefPtr<PDMFactory> pdm = new PDMFactory(RemoteDecodeIn::GpuProcess);
return pdm.forget();
}
/* static */
void PDMFactory::EnsureInit() {
{
@ -390,6 +414,15 @@ bool PDMFactory::Supports(const SupportDecoderParams& aParams,
if (mEMEPDM) {
return mEMEPDM->Supports(aParams, aDiagnostics);
}
if (VPXDecoder::IsVPX(aParams.MimeType(),
VPXDecoder::VP8 | VPXDecoder::VP9) &&
!aParams.mConfig.GetAsVideoInfo()->HasAlpha()) {
// Work around bug 1521370, where trying to instantiate an external decoder
// could cause a crash.
// We always ship a VP8/VP9 decoder (libvpx) and optionally we have ffvpx.
// So we can speed up the test by assuming that this codec is supported.
return true;
}
RefPtr<PlatformDecoderModule> current =
GetDecoderModule(aParams, aDiagnostics);
@ -609,10 +642,13 @@ void PDMFactory::SetCDMProxy(CDMProxy* aProxy) {
}
/* static */
PDMFactory::MediaCodecsSupported PDMFactory::Supported(bool aForceRefresh) {
MOZ_ASSERT(NS_IsMainThread());
PDMFactory::MediaCodecsSupported PDMFactory::Supported() {
if (XRE_IsContentProcess()) {
return *sSupported;
}
MOZ_ASSERT(XRE_IsParentProcess());
static auto calculate = []() {
static MediaCodecsSupported supported = []() {
auto pdm = MakeRefPtr<PDMFactory>();
MediaCodecsSupported supported;
// H264 and AAC depends on external framework that must be dynamically
@ -626,18 +662,6 @@ PDMFactory::MediaCodecsSupported PDMFactory::Supported(bool aForceRefresh) {
if (pdm->SupportsMimeType("video/avc"_ns, nullptr)) {
supported += MediaCodecs::H264;
}
if (pdm->SupportsMimeType("video/vp9"_ns, nullptr)) {
supported += MediaCodecs::VP9;
}
if (pdm->SupportsMimeType("video/vp8"_ns, nullptr)) {
supported += MediaCodecs::VP8;
}
if (pdm->SupportsMimeType("video/av1"_ns, nullptr)) {
supported += MediaCodecs::AV1;
}
if (pdm->SupportsMimeType("video/theora"_ns, nullptr)) {
supported += MediaCodecs::Theora;
}
if (pdm->SupportsMimeType("audio/mp4a-latm"_ns, nullptr)) {
supported += MediaCodecs::AAC;
}
@ -645,64 +669,28 @@ PDMFactory::MediaCodecsSupported PDMFactory::Supported(bool aForceRefresh) {
if (pdm->SupportsMimeType("audio/mpeg"_ns, nullptr)) {
supported += MediaCodecs::MP3;
}
if (pdm->SupportsMimeType("audio/opus"_ns, nullptr)) {
supported += MediaCodecs::Opus;
}
if (pdm->SupportsMimeType("audio/vorbis"_ns, nullptr)) {
supported += MediaCodecs::Vorbis;
}
if (pdm->SupportsMimeType("audio/flac"_ns, nullptr)) {
supported += MediaCodecs::Flac;
}
if (pdm->SupportsMimeType("audio/x-wav"_ns, nullptr)) {
supported += MediaCodecs::Wave;
}
// The codecs below are potentially always supported as we ship native
// support for them. If they are disabled through pref, it will be handled
// in MediaDecoder class that could use those.
supported += MediaCodecs::VP9;
supported += MediaCodecs::VP8;
supported += MediaCodecs::AV1;
supported += MediaCodecs::Theora;
supported += MediaCodecs::Opus;
supported += MediaCodecs::Vorbis;
supported += MediaCodecs::Flac;
supported += MediaCodecs::Wave;
return supported;
};
static MediaCodecsSupported supported = calculate();
if (aForceRefresh) {
supported = calculate();
}
}();
return supported;
}
/* static */
bool PDMFactory::SupportsMimeType(const nsACString& aMimeType,
const MediaCodecsSupported& aSupported) {
if (MP4Decoder::IsH264(aMimeType)) {
return aSupported.contains(MediaCodecs::H264);
}
if (VPXDecoder::IsVP9(aMimeType)) {
return aSupported.contains(MediaCodecs::VP9);
}
if (VPXDecoder::IsVP8(aMimeType)) {
return aSupported.contains(MediaCodecs::VP8);
}
if (AOMDecoder::IsAV1(aMimeType)) {
return aSupported.contains(MediaCodecs::AV1);
}
if (TheoraDecoder::IsTheora(aMimeType)) {
return aSupported.contains(MediaCodecs::Theora);
}
if (MP4Decoder::IsAAC(aMimeType)) {
return aSupported.contains(MediaCodecs::AAC);
}
if (aMimeType.EqualsLiteral("audio/mpeg")) {
return aSupported.contains(MediaCodecs::MP3);
}
if (OpusDataDecoder::IsOpus(aMimeType)) {
return aSupported.contains(MediaCodecs::Opus);
}
if (VorbisDataDecoder::IsVorbis(aMimeType)) {
return aSupported.contains(MediaCodecs::Vorbis);
}
if (aMimeType.EqualsLiteral("audio/flac")) {
return aSupported.contains(MediaCodecs::Flac);
}
if (WaveDataDecoder::IsWave(aMimeType)) {
return aSupported.contains(MediaCodecs::Wave);
}
return false;
void PDMFactory::SetSupported(const MediaCodecsSupported& aSupported) {
MOZ_ASSERT(NS_IsMainThread());
sSupported = Some(aSupported);
}
} // namespace mozilla

View File

@ -44,6 +44,11 @@ class PDMFactory final {
PDMFactory();
// To be called in the content process only, used to determine which PDMs are
// usable in their respective process.
static already_AddRefed<PDMFactory> PDMFactoryForRdd();
static already_AddRefed<PDMFactory> PDMFactoryForGpu();
// Factory method that creates the appropriate PlatformDecoderModule for
// the platform we're running on.
RefPtr<PDMCreateDecoderPromise> CreateDecoder(
@ -87,12 +92,15 @@ class PDMFactory final {
using MediaCodecsSupported = EnumSet<MediaCodecs>;
static MediaCodecsSupported Supported(bool aForceRefresh = false);
static bool SupportsMimeType(const nsACString& aMimeType,
const MediaCodecsSupported& aSupported);
static MediaCodecsSupported Supported();
static void SetSupported(const MediaCodecsSupported& aSupported);
private:
virtual ~PDMFactory();
// Will set PDM list for the required process.
// This is used to determine which PDMs are available on the given process
// from the content process.
explicit PDMFactory(const RemoteDecodeIn& aProcess);
void CreatePDMs();
void CreateNullPDM();

View File

@ -315,8 +315,6 @@ class PlatformDecoderModule {
virtual nsresult Startup() { return NS_OK; }
// Indicates if the PlatformDecoderModule supports decoding of aMimeType.
// The answer to both SupportsMimeType and Supports doesn't guarantee that
// creation of a decoder will actually succeed.
virtual bool SupportsMimeType(
const nsACString& aMimeType,
DecoderDoctorDiagnostics* aDiagnostics) const = 0;

View File

@ -15,6 +15,7 @@
#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
@ -27,6 +28,7 @@ extern Boolean VTIsHardwareDecodeSupported(CMVideoCodecType codecType)
namespace mozilla {
bool AppleDecoderModule::sInitialized = false;
bool AppleDecoderModule::sCanUseHardwareVideoDecoder = true;
bool AppleDecoderModule::sCanUseVP9Decoder = false;
/* static */
@ -35,6 +37,8 @@ void AppleDecoderModule::Init() {
return;
}
sCanUseHardwareVideoDecoder = gfx::gfxVars::CanUseHardwareVideoDecoding();
sInitialized = true;
if (RegisterSupplementalVP9Decoder()) {
sCanUseVP9Decoder = CanCreateVP9Decoder();
@ -130,7 +134,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 (!VTIsHardwareDecodeSupported ||
if (!sCanUseHardwareVideoDecoder || !VTIsHardwareDecodeSupported ||
!VTIsHardwareDecodeSupported(kCMVideoCodecType_VP9)) {
return false;
}

View File

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

View File

@ -21,7 +21,6 @@
#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__)
@ -582,7 +581,7 @@ CFDictionaryRef AppleVTDecoder::CreateDecoderSpecification() {
const void* specKeys[] = {
kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder};
const void* specValues[1];
if (gfx::gfxVars::CanUseHardwareVideoDecoding()) {
if (AppleDecoderModule::sCanUseHardwareVideoDecoder) {
specValues[0] = kCFBooleanTrue;
} else {
// This GPU is blacklisted for hardware decoding.

View File

@ -68,16 +68,15 @@ WMFDecoderModule::~WMFDecoderModule() {
}
}
static bool IsRemoteAcceleratedCompositor(
layers::KnowsCompositor* aKnowsCompositor) {
if (!aKnowsCompositor) {
static bool IsRemoteAcceleratedCompositor(const SupportDecoderParams& aParams) {
if (!aParams.mKnowsCompositor) {
return false;
}
TextureFactoryIdentifier ident =
aKnowsCompositor->GetTextureFactoryIdentifier();
aParams.mKnowsCompositor->GetTextureFactoryIdentifier();
return ident.mParentBackend != LayersBackend::LAYERS_BASIC &&
!aKnowsCompositor->UsingSoftwareWebRender() &&
!aParams.mKnowsCompositor->UsingSoftwareWebRender() &&
ident.mParentProcessType == GeckoProcessType_GPU;
}
@ -173,13 +172,6 @@ nsresult WMFDecoderModule::Startup() {
already_AddRefed<MediaDataDecoder> WMFDecoderModule::CreateVideoDecoder(
const CreateDecoderParams& aParams) {
// In GPU process, only support decoding if an accelerated compositor is
// known.
if (XRE_IsGPUProcess() &&
!IsRemoteAcceleratedCompositor(aParams.mKnowsCompositor)) {
return nullptr;
}
UniquePtr<WMFVideoMFTManager> manager(new WMFVideoMFTManager(
aParams.VideoConfig(), aParams.mKnowsCompositor, aParams.mImageContainer,
aParams.mRate.mValue, aParams.mOptions, sDXVAEnabled));
@ -209,11 +201,6 @@ already_AddRefed<MediaDataDecoder> WMFDecoderModule::CreateVideoDecoder(
already_AddRefed<MediaDataDecoder> WMFDecoderModule::CreateAudioDecoder(
const CreateDecoderParams& aParams) {
if (XRE_IsGPUProcess()) {
// Only allow video in the GPU process.
return nullptr;
}
UniquePtr<WMFAudioMFTManager> manager(
new WMFAudioMFTManager(aParams.AudioConfig()));
@ -249,26 +236,41 @@ static bool CanCreateWMFDecoder() {
/* static */
bool WMFDecoderModule::HasH264() {
if (XRE_IsContentProcess()) {
return PDMFactory::Supported().contains(PDMFactory::MediaCodecs::H264);
}
return CanCreateWMFDecoder<CLSID_CMSH264DecoderMFT>();
}
/* static */
bool WMFDecoderModule::HasVP8() {
if (XRE_IsContentProcess()) {
return PDMFactory::Supported().contains(PDMFactory::MediaCodecs::VP8);
}
return sUsableVPXMFT && CanCreateWMFDecoder<CLSID_WebmMfVpxDec>();
}
/* static */
bool WMFDecoderModule::HasVP9() {
if (XRE_IsContentProcess()) {
return PDMFactory::Supported().contains(PDMFactory::MediaCodecs::VP9);
}
return sUsableVPXMFT && CanCreateWMFDecoder<CLSID_WebmMfVpxDec>();
}
/* static */
bool WMFDecoderModule::HasAAC() {
if (XRE_IsContentProcess()) {
return PDMFactory::Supported().contains(PDMFactory::MediaCodecs::AAC);
}
return CanCreateWMFDecoder<CLSID_CMSAACDecMFT>();
}
/* static */
bool WMFDecoderModule::HasMP3() {
if (XRE_IsContentProcess()) {
return PDMFactory::Supported().contains(PDMFactory::MediaCodecs::MP3);
}
return CanCreateWMFDecoder<CLSID_CMP3DecMediaObject>();
}
@ -283,14 +285,13 @@ bool WMFDecoderModule::SupportsMimeType(
bool WMFDecoderModule::Supports(const SupportDecoderParams& aParams,
DecoderDoctorDiagnostics* aDiagnostics) const {
// In GPU process, only support decoding if video. This only gives a hint of
// what the GPU decoder *may* support. The actual check will occur in
// CreateVideoDecoder.
const auto& trackInfo = aParams.mConfig;
if (XRE_IsGPUProcess() && !trackInfo.GetAsVideoInfo()) {
// In GPU process, only support decoding if an accelerated compositor is
// known.
if (XRE_IsGPUProcess() && !IsRemoteAcceleratedCompositor(aParams)) {
return false;
}
const auto& trackInfo = aParams.mConfig;
const auto* videoInfo = trackInfo.GetAsVideoInfo();
// Temporary - forces use of VPXDecoder when alpha is present.
// Bug 1263836 will handle alpha scenario once implemented. It will shift

View File

@ -4,29 +4,26 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "GPUChild.h"
#include "gfxConfig.h"
#include "GfxInfoBase.h"
#include "gfxPlatform.h"
#include "GPUProcessHost.h"
#include "GPUProcessManager.h"
#include "GfxInfoBase.h"
#include "VRProcessManager.h"
#include "gfxConfig.h"
#include "gfxPlatform.h"
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/Telemetry.h"
#include "mozilla/TelemetryIPC.h"
#include "mozilla/dom/CheckerboardReportService.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/MemoryReportRequest.h"
#include "mozilla/gfx/gfxVars.h"
#if defined(XP_WIN)
# include "mozilla/gfx/DeviceManagerDx.h"
#endif
#include "mozilla/HangDetails.h"
#include "mozilla/RemoteDecoderManagerChild.h" // For RemoteDecodeIn
#include "mozilla/Unused.h"
#include "mozilla/ipc/Endpoint.h"
#include "mozilla/layers/APZInputBridgeChild.h"
#include "mozilla/layers/LayerTreeOwnerTracker.h"
#include "mozilla/Unused.h"
#include "mozilla/HangDetails.h"
#include "nsIGfxInfo.h"
#include "nsIObserverService.h"
@ -300,13 +297,6 @@ mozilla::ipc::IPCResult GPUChild::RecvBHRThreadHang(
return IPC_OK();
}
mozilla::ipc::IPCResult GPUChild::RecvUpdateMediaCodecsSupported(
const PDMFactory::MediaCodecsSupported& aSupported) {
dom::ContentParent::BroadcastMediaCodecsSupportedUpdate(
RemoteDecodeIn::GpuProcess, aSupported);
return IPC_OK();
}
class DeferredDeleteGPUChild : public Runnable {
public:
explicit DeferredDeleteGPUChild(UniquePtr<GPUChild>&& aChild)

View File

@ -68,8 +68,6 @@ class GPUChild final : public ipc::CrashReporterHelper<GeckoProcessType_GPU>,
mozilla::ipc::IPCResult RecvUsedFallback(const Fallback& aFallback,
const nsCString& aMessage);
mozilla::ipc::IPCResult RecvBHRThreadHang(const HangDetails& aDetails);
mozilla::ipc::IPCResult RecvUpdateMediaCodecsSupported(
const PDMFactory::MediaCodecsSupported& aSupported);
bool SendRequestMemoryReport(const uint32_t& aGeneration,
const bool& aAnonymize,

View File

@ -6,32 +6,22 @@
#ifdef XP_WIN
# include "WMF.h"
# include "WMFDecoderModule.h"
#endif
#include "GLContextProvider.h"
#include "GPUParent.h"
#include "GPUProcessHost.h"
#include "GPUProcessManager.h"
#include "GfxInfoBase.h"
#include "ProcessUtils.h"
#include "VRGPUChild.h"
#include "VRManager.h"
#include "VRManagerParent.h"
#include "VsyncBridgeParent.h"
#include "cairo.h"
#include "gfxConfig.h"
#include "gfxCrashReporterUtils.h"
#include "GfxInfoBase.h"
#include "gfxPlatform.h"
#include "GLContextProvider.h"
#include "GPUProcessHost.h"
#include "GPUProcessManager.h"
#include "mozilla/Assertions.h"
#include "mozilla/HangDetails.h"
#include "mozilla/PerfStats.h"
#include "mozilla/Preferences.h"
#include "mozilla/RemoteDecoderManagerChild.h"
#include "mozilla/RemoteDecoderManagerParent.h"
#include "mozilla/ScopeExit.h"
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/Telemetry.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/RemoteDecoderManagerChild.h"
#include "mozilla/RemoteDecoderManagerParent.h"
#include "mozilla/dom/MemoryReportRequest.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/gfxVars.h"
@ -39,37 +29,43 @@
#include "mozilla/ipc/CrashReporterClient.h"
#include "mozilla/ipc/ProcessChild.h"
#include "mozilla/layers/APZInputBridgeParent.h"
#include "mozilla/layers/APZPublicUtils.h" // for apz::InitializeGlobalState
#include "mozilla/layers/APZThreadUtils.h"
#include "mozilla/layers/APZPublicUtils.h" // for apz::InitializeGlobalState
#include "mozilla/layers/CompositorBridgeParent.h"
#include "mozilla/layers/CompositorManagerParent.h"
#include "mozilla/layers/CompositorThread.h"
#include "mozilla/layers/ImageBridgeParent.h"
#include "mozilla/layers/LayerTreeOwnerTracker.h"
#include "mozilla/layers/MemoryReportingMLGPU.h"
#include "mozilla/layers/UiCompositorControllerParent.h"
#include "mozilla/layers/MemoryReportingMLGPU.h"
#include "mozilla/layers/VideoBridgeParent.h"
#include "mozilla/webrender/RenderThread.h"
#include "mozilla/webrender/WebRenderAPI.h"
#include "mozilla/HangDetails.h"
#include "mozilla/Preferences.h"
#include "nscore.h"
#include "nsDebugImpl.h"
#include "nsIGfxInfo.h"
#include "nsThreadManager.h"
#include "nscore.h"
#include "prenv.h"
#include "ProcessUtils.h"
#include "VRGPUChild.h"
#include "VRManager.h"
#include "VRManagerParent.h"
#include "VsyncBridgeParent.h"
#include "cairo.h"
#include "skia/include/core/SkGraphics.h"
#if defined(XP_WIN)
# include <dwrite.h>
# include <process.h>
# include "mozilla/WindowsVersion.h"
# include "mozilla/gfx/DeviceManagerDx.h"
# include "mozilla/widget/WinCompositorWindowThread.h"
# include "mozilla/WindowsVersion.h"
# include <process.h>
# include <dwrite.h>
#else
# include <unistd.h>
#endif
#ifdef MOZ_WIDGET_GTK
# include <gtk/gtk.h>
# include "skia/include/ports/SkTypeface_cairo.h"
#endif
#ifdef MOZ_GECKO_PROFILER
@ -146,7 +142,9 @@ bool GPUParent::Init(base::ProcessId aParentPid, const char* aParentBuildID,
LayerTreeOwnerTracker::Initialize();
CompositorBridgeParent::InitializeStatics();
mozilla::ipc::SetThisProcessName("GPU Process");
#ifdef XP_WIN
wmf::MFStartup();
#endif
return true;
}
@ -297,19 +295,6 @@ mozilla::ipc::IPCResult GPUParent::RecvInit(
RecvGetDeviceStatus(&data);
Unused << SendInitComplete(data);
// Dispatch a task to run when idle that will determine which codecs are
// usable. The primary goal is to determine if the media feature pack is
// installed.
MOZ_ALWAYS_SUCCEEDS(NS_DispatchToCurrentThreadQueue(
NS_NewRunnableFunction(
"GPUParent::Supported",
[]() {
auto supported = PDMFactory::Supported();
Unused << GPUParent::GetSingleton()->SendUpdateMediaCodecsSupported(
supported);
}),
2000 /* 2 seconds timeout */, EventQueuePriority::Idle));
Telemetry::AccumulateTimeDelta(Telemetry::GPU_PROCESS_INITIALIZATION_TIME_MS,
mLaunchTime);
return IPC_OK();
@ -378,18 +363,6 @@ mozilla::ipc::IPCResult GPUParent::RecvInitProfiler(
}
mozilla::ipc::IPCResult GPUParent::RecvUpdateVar(const GfxVarUpdate& aUpdate) {
#if defined(XP_WIN)
auto scopeExit = MakeScopeExit(
[couldUseHWDecoder = gfx::gfxVars::CanUseHardwareVideoDecoding()] {
if (couldUseHWDecoder != gfx::gfxVars::CanUseHardwareVideoDecoding()) {
// The capabilities of the system may have changed, force a refresh by
// re-initializing the WMF PDM.
WMFDecoderModule::Init();
Unused << GPUParent::GetSingleton()->SendUpdateMediaCodecsSupported(
PDMFactory::Supported(true /* force refresh */));
}
});
#endif
gfxVars::ApplyUpdate(aUpdate);
return IPC_OK();
}

View File

@ -35,7 +35,6 @@ using mozilla::Telemetry::DiscardedData from "mozilla/TelemetryComms.h";
using mozilla::gfx::Feature from "gfxFeature.h";
using mozilla::gfx::Fallback from "gfxFallback.h";
using mozilla::layers::LayersId from "mozilla/layers/LayersTypes.h";
using mozilla::PDMFactory::MediaCodecsSupported from "PDMFactory.h";
namespace mozilla {
namespace gfx {
@ -155,10 +154,6 @@ child:
async UsedFallback(Fallback aFallback, nsCString message);
async BHRThreadHang(HangDetails aDetails);
// Update the cached list of codec supported following a check in the
// GPU parent.
async UpdateMediaCodecsSupported(MediaCodecsSupported aSupported);
};
} // namespace gfx