diff options
Diffstat (limited to 'ipc/glue/UtilityAudioDecoderParent.cpp')
-rw-r--r-- | ipc/glue/UtilityAudioDecoderParent.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/ipc/glue/UtilityAudioDecoderParent.cpp b/ipc/glue/UtilityAudioDecoderParent.cpp index 2eb0936a38..ed6327061b 100644 --- a/ipc/glue/UtilityAudioDecoderParent.cpp +++ b/ipc/glue/UtilityAudioDecoderParent.cpp @@ -42,7 +42,8 @@ namespace mozilla::ipc { -UtilityAudioDecoderParent::UtilityAudioDecoderParent() +UtilityAudioDecoderParent::UtilityAudioDecoderParent( + nsTArray<gfx::GfxVarUpdate>&& aUpdates) : mKind(GetCurrentSandboxingKind()), mAudioDecoderParentStart(TimeStamp::Now()) { #ifdef MOZ_WMF_MEDIA_ENGINE @@ -51,6 +52,9 @@ UtilityAudioDecoderParent::UtilityAudioDecoderParent() profiler_set_process_name(nsCString("MF Media Engine CDM")); gfx::gfxConfig::Init(); gfx::gfxVars::Initialize(); + for (auto& update : aUpdates) { + gfx::gfxVars::ApplyUpdate(update); + } gfx::DeviceManagerDx::Init(); return; } @@ -78,12 +82,12 @@ UtilityAudioDecoderParent::~UtilityAudioDecoderParent() { /* static */ void UtilityAudioDecoderParent::GenericPreloadForSandbox() { -#if defined(MOZ_SANDBOX) && defined(XP_WIN) && defined(MOZ_FFVPX) +#if defined(MOZ_SANDBOX) && defined(XP_WIN) // Preload AV dlls so we can enable Binary Signature Policy // to restrict further dll loads. UtilityProcessImpl::LoadLibraryOrCrash(L"mozavcodec.dll"); UtilityProcessImpl::LoadLibraryOrCrash(L"mozavutil.dll"); -#endif // defined(MOZ_SANDBOX) && defined(XP_WIN) && defined(MOZ_FFVPX) +#endif // defined(MOZ_SANDBOX) && defined(XP_WIN) } /* static */ @@ -141,7 +145,6 @@ UtilityAudioDecoderParent::RecvNewContentRemoteDecoderManager( #ifdef MOZ_WMF_MEDIA_ENGINE mozilla::ipc::IPCResult UtilityAudioDecoderParent::RecvInitVideoBridge( Endpoint<PVideoBridgeChild>&& aEndpoint, - nsTArray<gfx::GfxVarUpdate>&& aUpdates, const ContentDeviceData& aContentDeviceData) { MOZ_ASSERT(mKind == SandboxingKind::MF_MEDIA_ENGINE_CDM); if (!RemoteDecoderManagerParent::CreateVideoBridgeToOtherProcess( @@ -149,10 +152,6 @@ mozilla::ipc::IPCResult UtilityAudioDecoderParent::RecvInitVideoBridge( return IPC_FAIL_NO_REASON(this); } - for (const auto& update : aUpdates) { - gfx::gfxVars::ApplyUpdate(update); - } - gfx::gfxConfig::Inherit( { gfx::Feature::HW_COMPOSITING, @@ -175,6 +174,17 @@ mozilla::ipc::IPCResult UtilityAudioDecoderParent::RecvInitVideoBridge( IPCResult UtilityAudioDecoderParent::RecvUpdateVar( const GfxVarUpdate& aUpdate) { MOZ_ASSERT(mKind == SandboxingKind::MF_MEDIA_ENGINE_CDM); + auto scopeExit = MakeScopeExit( + [self = RefPtr<UtilityAudioDecoderParent>{this}, + location = GetRemoteDecodeInFromKind(mKind), + couldUseHWDecoder = gfx::gfxVars::CanUseHardwareVideoDecoding()] { + if (couldUseHWDecoder != gfx::gfxVars::CanUseHardwareVideoDecoding()) { + // The capabilities of the system may have changed, force a refresh by + // re-initializing the PDM. + Unused << self->SendUpdateMediaCodecsSupported( + location, PDMFactory::Supported(true /* force refresh */)); + } + }); gfx::gfxVars::ApplyUpdate(aUpdate); return IPC_OK(); } |