summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Adam <jakub.adam@collabora.com>2021-04-29 22:10:15 +0200
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2021-04-30 04:47:36 +0000
commitfb8ed9e5d22e0867a361f385646db7220e265ee1 (patch)
tree7765b2f11cfaa6179381e68debbd6ba7ede4f96d
parentaac012ce72e56ce5f6fdd95e73cb1861f198748f (diff)
d3d11desktopdup: Support desktop switches
Before creating output duplication interface, call SetThreadDesktop() with HDESK of the current input desktop in case a desktop switch has occurred. This allows d3d11desktopdupsrc to capture Windows User Account Control (UAC) prompts, which appear on a separate secure desktop. Otherwise IDXGIOutput1::DuplicateOutput() will return E_ACCESSDENIED and the element won't produce any frames as long as the UAC screen is active. Note that in order to access secure desktop the application still has to run at LOCAL_SYSTEM privileges. For GStreamer applications running with regular user privileges this change has no effect. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2209>
-rw-r--r--sys/d3d11/gstd3d11desktopdup.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/d3d11/gstd3d11desktopdup.cpp b/sys/d3d11/gstd3d11desktopdup.cpp
index 065378d22..43bcb0871 100644
--- a/sys/d3d11/gstd3d11desktopdup.cpp
+++ b/sys/d3d11/gstd3d11desktopdup.cpp
@@ -661,6 +661,17 @@ private:
return GST_FLOW_ERROR;
}
+ HDESK hdesk = OpenInputDesktop (0, FALSE, GENERIC_ALL);
+ if (hdesk) {
+ if (!SetThreadDesktop (hdesk)) {
+ GST_WARNING ("SetThreadDesktop() failed, error %lu", GetLastError());
+ }
+
+ CloseDesktop (hdesk);
+ } else {
+ GST_WARNING ("OpenInputDesktop() failed, error %lu", GetLastError());
+ }
+
/* FIXME: Use DuplicateOutput1 to avoid potentail color conversion */
hr = output1->DuplicateOutput(d3d11_device.Get(), &dupl_);
if (!gst_d3d11_result (hr, device)) {