mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
d3d11window: Remove timeout and wait a task if possible
If the run_async() method is expected to be called from streaming thread and not from application thread, use INFINITE as timeout value so that d3d11window can wait UI dispatcher thread in any case. There is no way to get a robust timeout value from library side. So the fixed timeout value might not be optimal and therefore we should avoid it as much as possible. Rule whether a timeout value can be INFINITE or not is, * If the waiting can be cancelled by GstBaseSink:unlock(), use INFINITE. GstD3D11Window:on_resize() is one case for example. * Otherwise, use timeout value Some details are, GstBaseSink:start() and GstBaseSink:stop() will be called when NULL to READY or READY to NULL state change, so there will be no chance for GstBaseSink:unlock() and GstBaseSink:unlock_stop() to be called around them. So there is no other way then timeout way. GstD3D11Window:consturcted() and GstD3D11Window:unprepare() are the case. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1461>
This commit is contained in:
parent
6ede4a99a7
commit
d03e959f54
2 changed files with 4 additions and 4 deletions
|
@ -223,7 +223,7 @@ get_window_size (const ComPtr<Core::ICoreDispatcher> &dispatcher,
|
|||
HANDLE cancellable,
|
||||
const ComPtr<Core::ICoreWindow> &window, Size *size)
|
||||
{
|
||||
return run_async (dispatcher, cancellable, DEFAULT_ASYNC_TIMEOUT,
|
||||
return run_async (dispatcher, cancellable, INFINITE,
|
||||
[window, size] {
|
||||
HRESULT hr;
|
||||
Rect bounds;
|
||||
|
@ -481,7 +481,7 @@ gst_d3d11_window_core_window_on_resize (GstD3D11Window * window,
|
|||
GstD3D11WindowCoreWindow *self = GST_D3D11_WINDOW_CORE_WINDOW (window);
|
||||
CoreWindowWinRTStorage *storage = self->storage;
|
||||
|
||||
run_async (storage->dispatcher, storage->cancellable, DEFAULT_ASYNC_TIMEOUT,
|
||||
run_async (storage->dispatcher, storage->cancellable, INFINITE,
|
||||
[window] {
|
||||
gst_d3d11_window_core_window_on_resize_sync (window);
|
||||
return S_OK;
|
||||
|
|
|
@ -384,7 +384,7 @@ gst_d3d11_window_swap_chain_panel_create_swap_chain (GstD3D11Window * window,
|
|||
return FALSE;
|
||||
|
||||
hr = run_async (storage->dispatcher,
|
||||
storage->cancellable, DEFAULT_ASYNC_TIMEOUT,
|
||||
storage->cancellable, INFINITE,
|
||||
[panel_native, new_swapchain] {
|
||||
return panel_native->SetSwapChain(new_swapchain.Get());
|
||||
});
|
||||
|
@ -476,7 +476,7 @@ gst_d3d11_window_swap_chain_panel_on_resize (GstD3D11Window * window,
|
|||
GST_D3D11_WINDOW_SWAP_CHAIN_PANEL (window);
|
||||
SwapChainPanelWinRTStorage *storage = self->storage;
|
||||
|
||||
run_async (storage->dispatcher, storage->cancellable, DEFAULT_ASYNC_TIMEOUT,
|
||||
run_async (storage->dispatcher, storage->cancellable, INFINITE,
|
||||
[window] {
|
||||
gst_d3d11_window_swap_chain_panel_on_resize_sync (window);
|
||||
return S_OK;
|
||||
|
|
Loading…
Reference in a new issue