uWindowCapture icon indicating copy to clipboard operation
uWindowCapture copied to clipboard

Don't hold a reference to a GraphicsCaptureItem when not capturing

Open TheLastRar opened this issue 2 years ago • 2 comments

Only create the GraphicsCaptureItem just before we need to use the capture

This will allow the Windows Graphics Capture service to suspend itself when we are not capturing

This also gives the bonus effect of no longer having issues when the service dies while we aren't capturing (which would crash uWC without https://github.com/hecomi/uWindowCapture/pull/43

This did require a couple changes I would like you to review the impact of; Removal of IsAvailable, as this relied on a persistent item_, this may affect any code that ensures capture is possible Using GetWindowTitle() when a given item is not capturing

TheLastRar avatar Mar 26 '22 14:03 TheLastRar

Thanks for the pull request. Please give me a few moments to review.

hecomi avatar Mar 28 '22 15:03 hecomi

Sorry for the delay in replying.

I have tried and it worked in Windows Graphics Capture mode. However, uWC currently has three capture methods (Windows Graphics Capture / PrintWindow / BitBlt). If Auto mode is set, it tries Windows Graphics Capture first, and if it is not available (e.g. in the case where it captures child windows), then try the other available methods. If IsAvailable() is removed, this Auto mode will not work, so I would like to find another way.

hecomi avatar Apr 17 '22 06:04 hecomi