Feb 8, 2012 at 1:47 PM
Edited Feb 8, 2012 at 1:55 PM
I was having the same issue but was able to fix it. The problem is in Vmr9Allocator.TestRestoreLostDevice. There is a section of the code that looke like:
/* TODO: This is bad. FIX IT!
* Figure out how to tell when the new
* device is ready to use */
The TODO is actaully very bad and what is causing the problem. You have 1.5 seconds to get back from the lock screen before everything goes belly up. After searching around for a little while I found that after a D3DERR_DEVICELOST error when
the device comes back up you will get a D3DERR_DEVICENOTRESET error. There is supposed to be a way to reset it but I was lazy and just modified WPFMediaKit's code to be:
// Wait until the device comes back up before recreating it.
// -2005530519 = D3DERR_DEVICENOTRESET
(hr != -2005530519)
hr = m_device.TestCooperativeLevel();
I had to use the numeric value of D3DERR_DEVICENOTRESET as I couldn't find it defined anywhere I had access to. If someone knows how to get it into the kit via name please let me know.