diff --git a/dom/media/platforms/wmf/WMFVideoMFTManager.cpp b/dom/media/platforms/wmf/WMFVideoMFTManager.cpp index 5fb4dc1930a0..74d882c8c719 100644 --- a/dom/media/platforms/wmf/WMFVideoMFTManager.cpp +++ b/dom/media/platforms/wmf/WMFVideoMFTManager.cpp @@ -21,6 +21,7 @@ #include "gfx2DGlue.h" #include "gfxPrefs.h" #include "gfxWindowsPlatform.h" +#include "mozilla/gfx/DeviceManagerDx.h" #include "mozilla/AbstractThread.h" #include "mozilla/ClearOnShutdown.h" #include "mozilla/Logging.h" @@ -610,6 +611,22 @@ WMFVideoMFTManager::InitInternal() mVideoInfo.mDisplay.width, mVideoInfo.mDisplay.height); + if (!mUseHwAccel) { + RefPtr device = + gfx::DeviceManagerDx::Get()->GetCompositorDevice(); + if (!device) { + device = gfx::DeviceManagerDx::Get()->GetContentDevice(); + } + if (device) { + RefPtr multi; + HRESULT hr = + device->QueryInterface((ID3D10Multithread**)getter_AddRefs(multi)); + if (SUCCEEDED(hr) && multi) { + multi->SetMultithreadProtected(TRUE); + mIMFUsable = true; + } + } + } return true; } @@ -840,7 +857,7 @@ WMFVideoMFTManager::CreateBasicVideoFrame(IMFSample* aSample, nsIntRect pictureRegion = mVideoInfo.ScaledImageRect(videoWidth, videoHeight); LayersBackend backend = GetCompositorBackendType(mKnowsCompositor); - if (backend != LayersBackend::LAYERS_D3D11) { + if (backend != LayersBackend::LAYERS_D3D11 || !mIMFUsable) { RefPtr v = VideoData::CreateAndCopyData(mVideoInfo, mImageContainer, diff --git a/dom/media/platforms/wmf/WMFVideoMFTManager.h b/dom/media/platforms/wmf/WMFVideoMFTManager.h index 8c6316a5dec7..c3ad6e5aa111 100644 --- a/dom/media/platforms/wmf/WMFVideoMFTManager.h +++ b/dom/media/platforms/wmf/WMFVideoMFTManager.h @@ -121,6 +121,7 @@ private: bool mGotValidOutputAfterNullOutput = false; bool mGotExcessiveNullOutput = false; bool mIsValid = true; + bool mIMFUsable = false; }; } // namespace mozilla