зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1681043 - P5. Recalculate decoder capabilities if CanUseHardwareVideoDecoding changes. r=alwu,bryce
Not the most elegant, but reworking the PDMFactory to be fully re-initialized would be a significant change, as only the WMFDecoderModule requires it we take some shortcuts. Differential Revision: https://phabricator.services.mozilla.com/D100308
This commit is contained in:
Родитель
ec7856abd7
Коммит
19f9c7de4d
|
@ -10,6 +10,7 @@
|
||||||
# include <process.h>
|
# include <process.h>
|
||||||
|
|
||||||
# include "WMF.h"
|
# include "WMF.h"
|
||||||
|
# include "WMFDecoderModule.h"
|
||||||
# include "mozilla/WinDllServices.h"
|
# include "mozilla/WinDllServices.h"
|
||||||
# include "mozilla/gfx/DeviceManagerDx.h"
|
# include "mozilla/gfx/DeviceManagerDx.h"
|
||||||
#else
|
#else
|
||||||
|
@ -24,6 +25,7 @@
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
#include "mozilla/RemoteDecoderManagerChild.h"
|
#include "mozilla/RemoteDecoderManagerChild.h"
|
||||||
#include "mozilla/RemoteDecoderManagerParent.h"
|
#include "mozilla/RemoteDecoderManagerParent.h"
|
||||||
|
#include "mozilla/ScopeExit.h"
|
||||||
#include "mozilla/TimeStamp.h"
|
#include "mozilla/TimeStamp.h"
|
||||||
#include "mozilla/dom/MemoryReportRequest.h"
|
#include "mozilla/dom/MemoryReportRequest.h"
|
||||||
#include "mozilla/gfx/gfxVars.h"
|
#include "mozilla/gfx/gfxVars.h"
|
||||||
|
@ -151,6 +153,18 @@ mozilla::ipc::IPCResult RDDParent::RecvInit(
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCResult RDDParent::RecvUpdateVar(const GfxVarUpdate& aUpdate) {
|
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);
|
gfxVars::ApplyUpdate(aUpdate);
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
|
@ -618,8 +618,10 @@ void PDMFactory::SetCDMProxy(CDMProxy* aProxy) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
PDMFactory::MediaCodecsSupported PDMFactory::Supported() {
|
PDMFactory::MediaCodecsSupported PDMFactory::Supported(bool aForceRefresh) {
|
||||||
static MediaCodecsSupported supported = []() {
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
|
static auto calculate = []() {
|
||||||
auto pdm = MakeRefPtr<PDMFactory>();
|
auto pdm = MakeRefPtr<PDMFactory>();
|
||||||
MediaCodecsSupported supported;
|
MediaCodecsSupported supported;
|
||||||
// H264 and AAC depends on external framework that must be dynamically
|
// H264 and AAC depends on external framework that must be dynamically
|
||||||
|
@ -665,7 +667,11 @@ PDMFactory::MediaCodecsSupported PDMFactory::Supported() {
|
||||||
supported += MediaCodecs::Wave;
|
supported += MediaCodecs::Wave;
|
||||||
}
|
}
|
||||||
return supported;
|
return supported;
|
||||||
}();
|
};
|
||||||
|
static MediaCodecsSupported supported = calculate();
|
||||||
|
if (aForceRefresh) {
|
||||||
|
supported = calculate();
|
||||||
|
}
|
||||||
return supported;
|
return supported;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ class PDMFactory final {
|
||||||
|
|
||||||
using MediaCodecsSupported = EnumSet<MediaCodecs>;
|
using MediaCodecsSupported = EnumSet<MediaCodecs>;
|
||||||
|
|
||||||
static MediaCodecsSupported Supported();
|
static MediaCodecsSupported Supported(bool aForceRefresh = false);
|
||||||
static bool SupportsMimeType(const nsACString& aMimeType,
|
static bool SupportsMimeType(const nsACString& aMimeType,
|
||||||
const MediaCodecsSupported& aSupported);
|
const MediaCodecsSupported& aSupported);
|
||||||
|
|
||||||
|
|
|
@ -6,22 +6,32 @@
|
||||||
|
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
# include "WMF.h"
|
# include "WMF.h"
|
||||||
|
# include "WMFDecoderModule.h"
|
||||||
#endif
|
#endif
|
||||||
#include "GPUParent.h"
|
|
||||||
#include "gfxConfig.h"
|
|
||||||
#include "gfxCrashReporterUtils.h"
|
|
||||||
#include "GfxInfoBase.h"
|
|
||||||
#include "gfxPlatform.h"
|
|
||||||
#include "GLContextProvider.h"
|
#include "GLContextProvider.h"
|
||||||
|
#include "GPUParent.h"
|
||||||
#include "GPUProcessHost.h"
|
#include "GPUProcessHost.h"
|
||||||
#include "GPUProcessManager.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 "gfxPlatform.h"
|
||||||
#include "mozilla/Assertions.h"
|
#include "mozilla/Assertions.h"
|
||||||
|
#include "mozilla/HangDetails.h"
|
||||||
#include "mozilla/PerfStats.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/StaticPrefs_dom.h"
|
||||||
#include "mozilla/Telemetry.h"
|
#include "mozilla/Telemetry.h"
|
||||||
#include "mozilla/TimeStamp.h"
|
#include "mozilla/TimeStamp.h"
|
||||||
#include "mozilla/RemoteDecoderManagerChild.h"
|
|
||||||
#include "mozilla/RemoteDecoderManagerParent.h"
|
|
||||||
#include "mozilla/dom/MemoryReportRequest.h"
|
#include "mozilla/dom/MemoryReportRequest.h"
|
||||||
#include "mozilla/gfx/2D.h"
|
#include "mozilla/gfx/2D.h"
|
||||||
#include "mozilla/gfx/gfxVars.h"
|
#include "mozilla/gfx/gfxVars.h"
|
||||||
|
@ -29,43 +39,37 @@
|
||||||
#include "mozilla/ipc/CrashReporterClient.h"
|
#include "mozilla/ipc/CrashReporterClient.h"
|
||||||
#include "mozilla/ipc/ProcessChild.h"
|
#include "mozilla/ipc/ProcessChild.h"
|
||||||
#include "mozilla/layers/APZInputBridgeParent.h"
|
#include "mozilla/layers/APZInputBridgeParent.h"
|
||||||
#include "mozilla/layers/APZThreadUtils.h"
|
|
||||||
#include "mozilla/layers/APZPublicUtils.h" // for apz::InitializeGlobalState
|
#include "mozilla/layers/APZPublicUtils.h" // for apz::InitializeGlobalState
|
||||||
|
#include "mozilla/layers/APZThreadUtils.h"
|
||||||
#include "mozilla/layers/CompositorBridgeParent.h"
|
#include "mozilla/layers/CompositorBridgeParent.h"
|
||||||
#include "mozilla/layers/CompositorManagerParent.h"
|
#include "mozilla/layers/CompositorManagerParent.h"
|
||||||
#include "mozilla/layers/CompositorThread.h"
|
#include "mozilla/layers/CompositorThread.h"
|
||||||
#include "mozilla/layers/ImageBridgeParent.h"
|
#include "mozilla/layers/ImageBridgeParent.h"
|
||||||
#include "mozilla/layers/LayerTreeOwnerTracker.h"
|
#include "mozilla/layers/LayerTreeOwnerTracker.h"
|
||||||
#include "mozilla/layers/UiCompositorControllerParent.h"
|
|
||||||
#include "mozilla/layers/MemoryReportingMLGPU.h"
|
#include "mozilla/layers/MemoryReportingMLGPU.h"
|
||||||
|
#include "mozilla/layers/UiCompositorControllerParent.h"
|
||||||
#include "mozilla/layers/VideoBridgeParent.h"
|
#include "mozilla/layers/VideoBridgeParent.h"
|
||||||
#include "mozilla/webrender/RenderThread.h"
|
#include "mozilla/webrender/RenderThread.h"
|
||||||
#include "mozilla/webrender/WebRenderAPI.h"
|
#include "mozilla/webrender/WebRenderAPI.h"
|
||||||
#include "mozilla/HangDetails.h"
|
|
||||||
#include "mozilla/Preferences.h"
|
|
||||||
#include "nscore.h"
|
|
||||||
#include "nsDebugImpl.h"
|
#include "nsDebugImpl.h"
|
||||||
#include "nsIGfxInfo.h"
|
#include "nsIGfxInfo.h"
|
||||||
#include "nsThreadManager.h"
|
#include "nsThreadManager.h"
|
||||||
|
#include "nscore.h"
|
||||||
#include "prenv.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"
|
#include "skia/include/core/SkGraphics.h"
|
||||||
#if defined(XP_WIN)
|
#if defined(XP_WIN)
|
||||||
|
# include <dwrite.h>
|
||||||
|
# include <process.h>
|
||||||
|
|
||||||
|
# include "mozilla/WindowsVersion.h"
|
||||||
# include "mozilla/gfx/DeviceManagerDx.h"
|
# include "mozilla/gfx/DeviceManagerDx.h"
|
||||||
# include "mozilla/widget/WinCompositorWindowThread.h"
|
# include "mozilla/widget/WinCompositorWindowThread.h"
|
||||||
# include "mozilla/WindowsVersion.h"
|
|
||||||
# include <process.h>
|
|
||||||
# include <dwrite.h>
|
|
||||||
#else
|
#else
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef MOZ_WIDGET_GTK
|
#ifdef MOZ_WIDGET_GTK
|
||||||
# include <gtk/gtk.h>
|
# include <gtk/gtk.h>
|
||||||
|
|
||||||
# include "skia/include/ports/SkTypeface_cairo.h"
|
# include "skia/include/ports/SkTypeface_cairo.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef MOZ_GECKO_PROFILER
|
#ifdef MOZ_GECKO_PROFILER
|
||||||
|
@ -374,6 +378,18 @@ mozilla::ipc::IPCResult GPUParent::RecvInitProfiler(
|
||||||
}
|
}
|
||||||
|
|
||||||
mozilla::ipc::IPCResult GPUParent::RecvUpdateVar(const GfxVarUpdate& aUpdate) {
|
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);
|
gfxVars::ApplyUpdate(aUpdate);
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче