glwindow/winrt: Add warning message if window is being closed from a UI thread
authorSeungha Yang <seungha@centricular.com>
Fri, 10 Jul 2020 10:49:56 +0000 (19:49 +0900)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Fri, 10 Jul 2020 11:46:56 +0000 (11:46 +0000)
commit579db691edad8ef1689fe8eb693d71f0120cd15e
treee944a1d78c51848c3a9fd5cffa2115d415ddaed3
parentbdf73569f834ace8ef7a2e68dbf3ad86528c54f1
glwindow/winrt: Add warning message if window is being closed from a UI thread

All UI elements will follow Single-Threaded Apartments (STA) model.
As a result, we should access them from dedicated UI thread.
Due to the nature of the threading model, ANGLE will wait the UI
thread while closing internal window/swapchain objects.

A problem here is that when destroying GstGLWindow from the UI thread,
it will wait GstGLContext's internal thread. Meanwhile, the GstGLContext's
internal thread will be blocked because ANGLE wants to access the UI thread.
That will cause a deadlock or exceptions.

In short, application should not try to call
gst_element_set_state(pipeline, GST_STATE_NULL) from a UI thread.
That's a limitation of current implementation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/745>
gst-libs/gst/gl/winrt/gstglwindow_winrt_egl.cpp