From: Jakub Adam Date: Thu, 29 Apr 2021 20:10:15 +0000 (+0200) Subject: d3d11desktopdup: Support desktop switches X-Git-Tag: 1.19.3~507^2~467 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fb8ed9e5d22e0867a361f385646db7220e265ee1;p=platform%2Fupstream%2Fgstreamer.git 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: --- diff --git a/sys/d3d11/gstd3d11desktopdup.cpp b/sys/d3d11/gstd3d11desktopdup.cpp index 065378d..43bcb08 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)) {