No video after "lost device"

Mar 24, 2011 at 12:58 AM
Edited Mar 24, 2011 at 1:01 AM

On XP, after returning from a locked screen the kit detects a lost device but from then after the present frame callback is never called and no video is presented.

On Windows 7 the code seems to recover correctly from the lost device.

Is this a known issue?

Any workarounds?




Feb 8, 2012 at 2:47 PM
Edited Feb 8, 2012 at 2: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:

Free Surfaces();

/* 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:

Free Surfaces();

// Wait until the device comes back up before recreating it.
// -2005530519 = D3DERR_DEVICENOTRESET
while (hr != -2005530519)
Thread .Sleep(500);
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.