diff options
Diffstat (limited to 'dom/media')
-rw-r--r-- | dom/media/platforms/wmf/DXVA2Manager.cpp | 37 |
1 files changed, 1 insertions, 36 deletions
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<ID3D11Device> 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<ID3D11Device> device = GetDeviceForDecoderCheck(); - if (!device) { - LOG("Can't create decoder due to lacking of ID3D11Device!"); - return false; - } - RefPtr<ID3D11VideoDevice> videoDevice; - HRESULT hr = device->QueryInterface( + HRESULT hr = mDevice->QueryInterface( static_cast<ID3D11VideoDevice**>(getter_AddRefs(videoDevice))); if (FAILED(hr)) { LOG("Failed to query ID3D11VideoDevice!"); |