mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
DDA grabber: Set a 500ms timeout when waiting for a new frame (#1753)
* Add a DXDI DDA grabber * Change all names to camel case * Handle cropping and pixel decimation * Try more persistently to restart capture after an error occurred. These can happen when changing resolution, or resuming from sleep. * Set a 500ms timeout when acquiring a frame. The API won't give us a new frame if nothing on the screen has changed, so an INFINITE timeout means we'll wait forever in this case, and eventually the LED connection will timeout. --------- Co-authored-by: LordGrey <48840279+Lord-Grey@users.noreply.github.com>
This commit is contained in:
parent
7f90637a2d
commit
0bdf865f5c
@ -174,7 +174,7 @@ int DDAGrabber::grabFrame(Image<ColorRgb> &image)
|
||||
// Acquire the next frame.
|
||||
CComPtr<IDXGIResource> desktopResource;
|
||||
DXGI_OUTDUPL_FRAME_INFO frameInfo;
|
||||
hr = d->desktopDuplication->AcquireNextFrame(INFINITE, &frameInfo, &desktopResource);
|
||||
hr = d->desktopDuplication->AcquireNextFrame(500, &frameInfo, &desktopResource);
|
||||
if (hr == DXGI_ERROR_ACCESS_LOST || hr == DXGI_ERROR_INVALID_CALL)
|
||||
{
|
||||
if (!restartCapture())
|
||||
@ -185,7 +185,7 @@ int DDAGrabber::grabFrame(Image<ColorRgb> &image)
|
||||
}
|
||||
if (hr == DXGI_ERROR_WAIT_TIMEOUT)
|
||||
{
|
||||
// This shouldn't happen since we specified an INFINITE timeout.
|
||||
// Nothing changed on the screen in the 500ms we waited.
|
||||
return 0;
|
||||
}
|
||||
RETURN_IF_ERROR(hr, "Failed to acquire next frame", 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user