Bug 1498788 - Adjust width and height so they are never bigger than source or destination. r=mattwoodrow
authorJean-Yves Avenard <jyavenard@mozilla.com>
Sun, 14 Oct 2018 19:01:01 +0000
changeset 496923 8bf31628742de6153ce9c2ff1ebc16d69b8d605d
parent 496922 e55f454f1ab6e08c0464d65bd48a3a51bf16aab3
child 496933 6e0139775220f26e08be6494978e64617f4220d2
child 496934 8579a92f5cc17b82d5895d0f6f9e9484366b2d0a
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1498788
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1498788 - Adjust width and height so they are never bigger than source or destination. r=mattwoodrow Why we would need this is unclear however. the destination texture should always be smaller than what comes out of the decoder. Differential Revision: https://phabricator.services.mozilla.com/D8672
dom/media/platforms/wmf/DXVA2Manager.cpp
--- a/dom/media/platforms/wmf/DXVA2Manager.cpp
+++ b/dom/media/platforms/wmf/DXVA2Manager.cpp
@@ -969,19 +969,19 @@ D3D11DXVA2Manager::CopyToImage(IMFSample
     if (!mutex && mDevice != DeviceManagerDx::Get()->GetCompositorDevice()) {
       NS_ENSURE_TRUE(mSyncObject, E_FAIL);
     }
 
     if (outDesc.Format == inDesc.Format) {
       // Our video frame is stored in a non-sharable ID3D11Texture2D. We need
       // to create a copy of that frame as a sharable resource, save its share
       // handle, and put that handle into the rendering pipeline.
-      MOZ_DIAGNOSTIC_ASSERT(outDesc.Width <= inDesc.Width &&
-                            outDesc.Height <= inDesc.Height);
-      D3D11_BOX srcBox = { 0, 0, 0, outDesc.Width, outDesc.Height, 1 };
+      UINT width = std::min(inDesc.Width, outDesc.Width);
+      UINT height = std::min(inDesc.Height, outDesc.Height);
+      D3D11_BOX srcBox = { 0, 0, 0, width, height, 1 };
 
       UINT index;
       dxgiBuf->GetSubresourceIndex(&index);
       mContext->CopySubresourceRegion(texture, 0, 0, 0, 0, tex, index, &srcBox);
     } else {
       // Use MFT to do color conversion.
       hr = E_FAIL;
       mozilla::mscom::EnsureMTA(