DXVA2 Decoder MFT in Windows Media Player with multiple monitor displays

147 views Asked by At

My DXVA2 decoder 'blanks' when the centre of the Windows Media Player is dragged to (or started on) a secondary monitor. The video re-appears when moved back to the primary. Note I do not have D3DPRESENTFLAG_DEVICECLIP set.

Although I would much prefer to find a way for this to work without needing handling, I do get notification of this issue by IDirect3DDeviceManager9::TestDevice( ) returning DXVA2_E_NEW_VIDEO_DEVICE.

IDirect3DDeviceManager9::CloseDeviceHandle / OpenDeviceHandle doesn't cut it (although MSDN indicates all that is required) so my reset handler goe something like:

ReleaseBuffers();   // free surfaces

SAFE_RELEASE(m_decoderService);

hr = m_pDXManager->CloseDeviceHandle(m_hDevice);
hr = m_pDXManager->OpenDeviceHandle(&m_hDevice);
hr = m_pDXManager->LockDevice(m_hDevice, &pDev, true);

hr = pDev->Reset(d3DPP);  // FAILS 0x8876086c !!!!

So I attempted to create a new dx device (using desktop as hwnd) then

 m_pDXManager->ResetDevice( new_device, token); 

but still no joy on the IDirect3DDevice9::Reset().

I've also tried creating a new IDirect3DDeviceManager9 using DXVA2CreateDirect3DDeviceManager9 but to no avail.

BTW I use IDirect3DDevice9::Reset() with no problems in my initialization, and use the same D3DPRESENT_PARAMETERS later so dont think these are the problem but here they are ( post call )

    d3DPP[n].BackBufferWidth = 1920;
    d3DPP[n].BackBufferHeight = 1080;
    d3DPP[n].BackBufferCount = 1;
    d3DPP[n].BackBufferFormat = D3DFMT_X8R8G8B8;
    d3DPP[n].SwapEffect = D3DSWAPEFFECT_DISCARD;
    d3DPP[n].hDeviceWindow = NULL;
    d3DPP[n].Windowed = true;
    d3DPP[n].Flags = D3DPRESENTFLAG_VIDEO;
    d3DPP[n].FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
    d3DPP[n].PresentationInterval = D3DPRESENT_INTERVAL_ONE;

Any missing are zero'd.

I have the same problem with win8 and win10.

Any help / pointers appreciated.

1

There are 1 answers

0
Matt Ault On

I have a working handler that recovers the video on secondary displays (after about a second). I would prefer it to be seamless of course if anybody can help me with that.

Anyway the solution was to create my own Reset by releasing absolutely everything, and then restoring. The solution is slow, but works for now..