0

I have some working code that captures the current desktop cyclically and using the code described at DirectX Screen Capture - Desktop Duplication API - limited frame rate of AcquireNextFrame / https://github.com/microsoft/Windows-classic-samples/tree/master/Samples/DXGIDesktopDuplication

This works well except on one machine (where I unfortunately do not have physical access for detailed debugging but only get reports from users). On this machine when I call AcquireNextFrame() with a timeout value of 500, it repeatedly fails with an error code 0x887A0027 / DXGI_ERROR_WAIT_TIMEOUT. To make this clear: the call does not fail only a few times, it fails all the time, so AcquireNextFrame() never returns a result, no matter how often one

When I increase the timeout-value to 850, it fails with an error 0x887A0026 / DXGI_ERROR_ACCESS_LOST.

So...any idea what can cause these errors and how one can prevent it from happen?

Thanks!

Elmi
  • 5,899
  • 15
  • 72
  • 143

1 Answers1

1

The behavior is normal.

Windows does not normally render desktop at 60 Hz, that would be a waste of resources and electricity. DXGI_ERROR_WAIT_TIMEOUT simply means the computer is showing the same image as before. AcquireNextFrame returns S_OK and gives you another frame when some window visible on the desktop has updated something.

I think that one machine doesn’t run any programs which continuously updating GUI on the desktop being captured.

You have to workaround. For instance, maintain a copy of the desktop texture in your capturing app, when AcquireNextFrame returns S_OK update it with CopyResource, when it returns DXGI_ERROR_WAIT_TIMEOUT use the old desktop texture.

Soonts
  • 20,079
  • 9
  • 57
  • 130
  • I don't think that behaviour is normal: the function _always_ returns this error code, not only from time to time. Meanwhile it turns out it is a problem with the graphics driver (Intel-crap). After an update it still does not work but it fails with a different error code – Elmi Jul 08 '21 at 06:03