From 088c0cefd0f8b5482cc227955cc3057d47ec24b6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 05:02:01 +0200 Subject: Merging upstream version 126.0.1. Signed-off-by: Daniel Baumann --- dom/media/platforms/wmf/DXVA2Manager.cpp | 37 +------------------------------- 1 file changed, 1 insertion(+), 36 deletions(-) (limited to 'dom/media') diff --git a/dom/media/platforms/wmf/DXVA2Manager.cpp b/dom/media/platforms/wmf/DXVA2Manager.cpp index 9efe9dab55..064efd8209 100644 --- a/dom/media/platforms/wmf/DXVA2Manager.cpp +++ b/dom/media/platforms/wmf/DXVA2Manager.cpp @@ -127,35 +127,6 @@ using namespace gfx; StaticRefPtr sDevice; StaticMutex sDeviceMutex; -// We found an issue where the ID3D11VideoDecoder won't release its underlying -// resources properly if the decoder iscreated from a compositor device by -// ourselves. This problem has been observed with both VP9 and, reportedly, AV1 -// decoders, it does not seem to affect the H264 decoder, but the underlying -// decoder created by MFT seems not having this issue. -// Therefore, when checking whether we can use hardware decoding, we should use -// a non-compositor device to create a decoder in order to prevent resource -// leaking that can significantly degrade the performance. For the actual -// decoding, we will still use the compositor device if it's avaiable in order -// to avoid video copying. -static ID3D11Device* GetDeviceForDecoderCheck() { - StaticMutexAutoLock lock(sDeviceMutex); - if (AppShutdown::IsInOrBeyond(ShutdownPhase::XPCOMShutdown)) { - return nullptr; - } - if (!sDevice) { - sDevice = gfx::DeviceManagerDx::Get()->CreateDecoderDevice( - {DeviceManagerDx::DeviceFlag::disableDeviceReuse}); - auto clearOnShutdown = [] { ClearOnShutdown(&sDevice); }; - if (!NS_IsMainThread()) { - Unused << NS_DispatchToMainThread( - NS_NewRunnableFunction(__func__, clearOnShutdown)); - } else { - clearOnShutdown(); - } - } - return sDevice.get(); -} - void GetDXVA2ExtendedFormatFromMFMediaType(IMFMediaType* pType, DXVA2_ExtendedFormat* pFormat) { // Get the interlace mode. @@ -1190,14 +1161,8 @@ D3D11DXVA2Manager::ConfigureForSize(IMFMediaType* aInputType, bool D3D11DXVA2Manager::CanCreateDecoder( const D3D11_VIDEO_DECODER_DESC& aDesc) const { - RefPtr device = GetDeviceForDecoderCheck(); - if (!device) { - LOG("Can't create decoder due to lacking of ID3D11Device!"); - return false; - } - RefPtr videoDevice; - HRESULT hr = device->QueryInterface( + HRESULT hr = mDevice->QueryInterface( static_cast(getter_AddRefs(videoDevice))); if (FAILED(hr)) { LOG("Failed to query ID3D11VideoDevice!"); -- cgit v1.2.3