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

WGC CaptureFrame returns wrong SystemRelativeTime in window capture mode #127

Open
artths opened this issue Jan 23, 2024 · 2 comments
Open

Comments

@artths
Copy link

artths commented Jan 23, 2024

Using the Desktop Duplication API, I can compare dirty rects with the coordinates of the window I'm interested in, and having the present time of the frame update, I know exactly when the frame in this window was updated.

When using WGC to capture the window I'm interested in, for some reason I get frame updates every time the DWM updates, why if I capture a single window? Well OK, let it be so, if only the frame time contained in the captured frame corresponded specifically to the update time of this window, and not DWM in general.

The documentation says:

SystemRelativeTime
The QPC (Query Performance Counter) time at which the compositor rendered the frame.

If we capture only a specific window, then the refresh time of the frame should also refer to that window, not the other windows on desktop, right? I don't know if it's by design or if it's a bug, but there's no way to tell when exactly a new frame arrived so you might end up with a duplicate.

@robmikh
Copy link
Member

robmikh commented Jan 23, 2024

Unfortunately, this was a limitation of WGC, especially on older versions of Windows. Recent Windows 11 builds should not have this behavior and should do a better job only updating when there are changes to the window. What version of Windows do you see this on?

@artths
Copy link
Author

artths commented Jan 24, 2024

I had observed this in all versions of Windows, starting with the first version that supported it for classic applications Windows 10 1903 and ending with the current installed Windows 11 22H2. I haven't noticed any change in API behavior between all the intermediate releases. Now, when capturing a game locked at 30 FPS, API sends about 140 frames a second (floating) when on 144 Hz monitor. If it should improve, what could I be doing wrong?

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