mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 15:51:11 +00:00
d3dvideosink: Don't try to recreate swapchain while the window is minimized
It will fail and cause the sink to crash. Instead wait until the window is visible again before checking if the swapchain really has to be recreated. https://bugzilla.gnome.org/show_bug.cgi?id=741608
This commit is contained in:
parent
0767a237ad
commit
d8b1efe13a
1 changed files with 19 additions and 1 deletions
|
@ -1393,6 +1393,9 @@ d3d_resize_swap_chain (GstD3DVideoSink * sink)
|
|||
gboolean ret = FALSE;
|
||||
HRESULT hr;
|
||||
gboolean need_new = FALSE;
|
||||
int clip_ret;
|
||||
HDC handle_hdc;
|
||||
RECT clip_rectangle;
|
||||
|
||||
g_return_val_if_fail (sink != NULL, FALSE);
|
||||
klass = GST_D3DVIDEOSINK_GET_CLASS (sink);
|
||||
|
@ -1411,6 +1414,16 @@ d3d_resize_swap_chain (GstD3DVideoSink * sink)
|
|||
CHECK_D3D_DEVICE (klass, sink, end);
|
||||
CHECK_D3D_SWAPCHAIN (sink, end);
|
||||
|
||||
handle_hdc = GetDC (sink->d3d.window_handle);
|
||||
clip_ret = GetClipBox (handle_hdc, &clip_rectangle);
|
||||
ReleaseDC (sink->d3d.window_handle, handle_hdc);
|
||||
if (clip_ret == NULLREGION) {
|
||||
GST_DEBUG_OBJECT (sink, "Window is hidden, not resizing swapchain");
|
||||
UNLOCK_CLASS (sink, klass);
|
||||
UNLOCK_SINK (sink);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
d3d_get_hwnd_window_size (sink->d3d.window_handle, &w, &h);
|
||||
ZeroMemory (&d3d_pp, sizeof (d3d_pp));
|
||||
|
||||
|
@ -2004,7 +2017,12 @@ d3d_wnd_proc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
case WM_SIZE:{
|
||||
if (proc)
|
||||
ret = CallWindowProc (proc, hWnd, message, wParam, lParam);
|
||||
d3d_resize_swap_chain (sink);
|
||||
|
||||
/* Don't resize if the window is being minimized. Recreating the
|
||||
* swap chain will fail if the window is minimized
|
||||
*/
|
||||
if (wParam != SIZE_MINIMIZED)
|
||||
d3d_resize_swap_chain (sink);
|
||||
goto end;
|
||||
}
|
||||
case WM_KEYDOWN:
|
||||
|
|
Loading…
Reference in a new issue