dxgicapture: reinitialize duplication interface on ERROR_ACCESS_LOST
authorJakub Adam <jakub.adam@collabora.com>
Tue, 27 Apr 2021 18:08:30 +0000 (18:08 +0000)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Fri, 30 Apr 2021 04:06:42 +0000 (04:06 +0000)
commitaac012ce72e56ce5f6fdd95e73cb1861f198748f
tree9acc324a4843979f3bd82ffc20eb1bd0ff04e358
parent6750123d5cbb3464efa2ec141f12ea4c4bbed877
dxgicapture: reinitialize duplication interface on ERROR_ACCESS_LOST

IDXGIOutputDuplication can become invalid for example when there's
desktop switch, resolution change or Windows User Account Control prompt
appears on screen.

When that happens, try to re-create the duplication interface for the
changed output. Note that in the case of UAC prompt this operation will
fail if the GStreamer process doesn't run at LOCAL_SYSTEM privileges. In
such situation the source element won't create any frames as long as the
output is occupied by UAC screen.

In order to enable UAC access to sufficiently privileged GStreamer
processes, call SetThreadDesktop() with the desktop handle that
currently receives user input before creating our output duplication.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2204>
sys/winscreencap/dxgicapture.c