summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2015-11-30 19:53:28 +0200
committerSebastian Dröge <sebastian@centricular.com>2015-11-30 19:53:28 +0200
commitd8b1efe13ab2d366290573f4cecbd0852a2721c5 (patch)
tree3cd5a83070eb6b46167c7f2f87a3db6c52e2aa67 /sys
parent0767a237ad6ceecf8cadc072f88bc87ebbe7c2bd (diff)
downloadgstreamer-plugins-bad-d8b1efe13ab2d366290573f4cecbd0852a2721c5.tar.gz
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
Diffstat (limited to 'sys')
-rw-r--r--sys/d3dvideosink/d3dhelpers.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/sys/d3dvideosink/d3dhelpers.c b/sys/d3dvideosink/d3dhelpers.c
index 4030cd600..5091c0638 100644
--- a/sys/d3dvideosink/d3dhelpers.c
+++ b/sys/d3dvideosink/d3dhelpers.c
@@ -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: