Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two frame delay when capturing #79

Closed
nergnezor opened this issue Jan 7, 2021 · 4 comments
Closed

Two frame delay when capturing #79

nergnezor opened this issue Jan 7, 2021 · 4 comments

Comments

@nergnezor
Copy link

I've played around with the ScreenCaptureForHWND C++ sample project, but I need it to be faster from capture to display. I have tried different framerates (30, 60 & 120 Hz) and there is almost always a two frame delay from the captured window to the app window. Does anyone know where this delay coming from and how to lower it?

@robmikh
Copy link
Member

robmikh commented Jan 7, 2021

Generally the DWM is triple or double buffered, this isn't unique to presenting captured content. There is no way to disable the DWM as of Windows 8. And if you did, the capture API would not be able to return frames to you, as they are rendered by the DWM 🙂.

@nergnezor
Copy link
Author

Thank you for the quick response! And the DWM only updates the buffers once every monitor refresh i assume? Do you know if I can speed up the buffer copying then? 66 ms (2 x 1000/30 Hz) is a long time to wait if you're in a hurry 🙂

@robmikh
Copy link
Member

robmikh commented Jan 7, 2021

That's correct, we're locked to the vsync (normally, there are some edge cases given your monitor topology and if you're running a full-screen game). I'm guessing by making a copy of the buffer you're talking about calling CopyResource or CopySubresourceRegion? How are you measuring this?

@nergnezor
Copy link
Author

No, I meant forcing the DWM buffers without waiting for vsync.
I'm measuring by recording the screen area of the source and target and then stepping through the recording frame by frame where there are changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants