From edb15598ed566f37d90129492a86341badee0672 Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Mon, 7 Feb 2011 22:47:34 +0100 Subject: [PATCH] directdrawsink: avoid rendering to invalid area Based on patch by Havard Graff Fixes #594280. --- sys/directdraw/gstdirectdrawsink.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sys/directdraw/gstdirectdrawsink.c b/sys/directdraw/gstdirectdrawsink.c index 15f79d12a7..3b8967f6ce 100644 --- a/sys/directdraw/gstdirectdrawsink.c +++ b/sys/directdraw/gstdirectdrawsink.c @@ -904,6 +904,19 @@ gst_directdraw_sink_show_frame (GstBaseSink * bsink, GstBuffer * buf) GetClientRect (ddrawsink->video_window, &destsurf_rect); OffsetRect (&destsurf_rect, dest_surf_point.x, dest_surf_point.y); + /* Check to see if we have an area to draw to. + * When the window is minimized, it will trigger the + * "IDirectDrawSurface7_Blt (object's offscreen surface)" warning, + * with a msg that the rectangle is invalid */ + if (destsurf_rect.right <= destsurf_rect.left || + destsurf_rect.bottom <= destsurf_rect.top) { + GST_OBJECT_UNLOCK (ddrawsink); + GST_DEBUG_OBJECT (ddrawsink, "invalid rendering window rectangle " + "(%ld, %ld), (%ld, %ld)", destsurf_rect.left, destsurf_rect.top, + destsurf_rect.right, destsurf_rect.bottom); + goto beach; + } + if (ddrawsink->keep_aspect_ratio) { /* center image to dest image keeping aspect ratio */ src_rect.top = 0; @@ -1004,6 +1017,7 @@ gst_directdraw_sink_show_frame (GstBaseSink * bsink, GstBuffer * buf) "returned %s", DDErrorString (hRes)); } +beach: return GST_FLOW_OK; }