From 3f9301d5893e547395e21dbddc43f794d599ad47 Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Fri, 16 Jun 2017 23:15:00 +0200 Subject: [PATCH] Bug 1373229: P1. Disable IMFYCbCrImage when ID3D10Multithread isn't supported. r=jya MozReview-Commit-ID: 9zzUJ0utqQm --HG-- extra : rebase_source : f13c93f8845a1630490e173ac37e948b8c03b6ff --- .../platforms/wmf/WMFVideoMFTManager.cpp | 19 ++++++++++++++++++- dom/media/platforms/wmf/WMFVideoMFTManager.h | 1 + 2 files changed, 19 insertions(+), 1 deletion(-) 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