From c84278ae04d60c407d13e5175a4fa4cdf2464324 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 2 Apr 2014 23:08:36 +0200 Subject: [PATCH] d3dvideosink: Only pass a dest rectangle if set, otherwise pass NULL Call with an uninitialized rectangle will cause errors. https://bugzilla.gnome.org/show_bug.cgi?id=714998 --- sys/d3dvideosink/d3dhelpers.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/d3dvideosink/d3dhelpers.c b/sys/d3dvideosink/d3dhelpers.c index d778e3572d..1310e53cb7 100644 --- a/sys/d3dvideosink/d3dhelpers.c +++ b/sys/d3dvideosink/d3dhelpers.c @@ -1710,6 +1710,7 @@ d3d_stretch_and_copy (GstD3DVideoSink * sink, LPDIRECT3DSURFACE9 back_buffer) GstD3DVideoSinkClass *klass = GST_D3DVIDEOSINK_GET_CLASS (sink); GstVideoRectangle *render_rect = NULL; RECT r, s; + RECT *r_p = NULL; HRESULT hr; gboolean ret = FALSE; @@ -1750,11 +1751,13 @@ d3d_stretch_and_copy (GstD3DVideoSink * sink, LPDIRECT3DSURFACE9 back_buffer) r.top = result.y; r.right = result.x + result.w; r.bottom = result.y + result.h; + r_p = &r; } else if (render_rect) { r.left = 0; r.top = 0; r.right = render_rect->w; r.bottom = render_rect->h; + r_p = &r; } s.left = sink->crop_rect.x; @@ -1770,7 +1773,7 @@ d3d_stretch_and_copy (GstD3DVideoSink * sink, LPDIRECT3DSURFACE9 back_buffer) hr = IDirect3DDevice9_StretchRect (klass->d3d.device.d3d_device, sink->d3d.surface, /* Source Surface */ &s, /* Source Surface Rect (NULL: Whole) */ back_buffer, /* Dest Surface */ - &r, /* Dest Surface Rect (NULL: Whole) */ + r_p, /* Dest Surface Rect (NULL: Whole) */ klass->d3d.device.filter_type); if (hr == D3D_OK) {