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.

The attached recordings show the behavior of the following pipeline when a UAC prompt is invoked, with and without this change.

gst-launch-1.0 d3d11desktopdupsrc show-cursor=1 ! d3d11download ! videoconvert ! queue ! x264enc tune=zerolatency ! matroskamux ! filesink location=uac-prompt.mkv



Merge request reports