Bug 1217185: To allow for sandboxing, use null HWNDs when creating the D3D device for video decoding. r=mattwoodrow
authorBob Owen <bobowencode@gmail.com>
Fri, 11 Dec 2015 01:23:00 +0000
changeset 310303 f24cb2c2ddf0c91eafe64ee868f78b40d9c6901f
parent 310302 d518261eb3b17f3e6b11fdb6d55ec1b7d4b11901
child 310304 a5fa1e187b98b5d9448f681c0ee4920fbda55288
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1217185
milestone45.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 1217185: To allow for sandboxing, use null HWNDs when creating the D3D device for video decoding. r=mattwoodrow
dom/media/platforms/wmf/DXVA2Manager.cpp
--- a/dom/media/platforms/wmf/DXVA2Manager.cpp
+++ b/dom/media/platforms/wmf/DXVA2Manager.cpp
@@ -275,31 +275,33 @@ D3D9DXVA2Manager::Init(nsACString& aFail
                                            D3DDEVTYPE_HAL,
                                            (D3DFORMAT)MAKEFOURCC('N','V','1','2'),
                                            D3DFMT_X8R8G8B8);
   if (!SUCCEEDED(hr)) {
     aFailureReason = nsPrintfCString("CheckDeviceFormatConversion failed with error %X", hr);
     return hr;
   }
 
-  // Create D3D9DeviceEx.
+  // Create D3D9DeviceEx. We pass null HWNDs here even though the documentation
+  // suggests that one of them should not be. At this point in time Chromium
+  // does the same thing for video acceleration.
   D3DPRESENT_PARAMETERS params = {0};
   params.BackBufferWidth = 1;
   params.BackBufferHeight = 1;
   params.BackBufferFormat = D3DFMT_UNKNOWN;
   params.BackBufferCount = 1;
   params.SwapEffect = D3DSWAPEFFECT_DISCARD;
-  params.hDeviceWindow = ::GetShellWindow();
+  params.hDeviceWindow = nullptr;
   params.Windowed = TRUE;
   params.Flags = D3DPRESENTFLAG_VIDEO;
 
   RefPtr<IDirect3DDevice9Ex> device;
   hr = d3d9Ex->CreateDeviceEx(D3DADAPTER_DEFAULT,
                               D3DDEVTYPE_HAL,
-                              ::GetShellWindow(),
+                              nullptr,
                               D3DCREATE_FPU_PRESERVE |
                               D3DCREATE_MULTITHREADED |
                               D3DCREATE_MIXED_VERTEXPROCESSING,
                               &params,
                               nullptr,
                               getter_AddRefs(device));
   if (!SUCCEEDED(hr)) {
     aFailureReason = nsPrintfCString("CreateDeviceEx failed with error %X", hr);