From ad5b76a58d1f30a1b7c4063a3b64ce66a8e35c01 Mon Sep 17 00:00:00 2001 From: Andoni Morales Alastruey Date: Mon, 25 Jun 2012 16:18:41 +0200 Subject: [PATCH] d3dvideosink: release the offscreen surface before the d3d device The offscreen surface keeps a reference on the d3d device, so if the device is released first we don't see the reference count debug message going to 0 as it should be. --- sys/d3dvideosink/d3dvideosink.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/d3dvideosink/d3dvideosink.c b/sys/d3dvideosink/d3dvideosink.c index 5af373a..e00ea6e 100644 --- a/sys/d3dvideosink/d3dvideosink.c +++ b/sys/d3dvideosink/d3dvideosink.c @@ -2243,13 +2243,6 @@ error: static gboolean gst_d3dvideosink_release_d3d_device (GstD3DVideoSink * sink) { - if (sink->d3ddev) { - int ref_count; - ref_count = IDirect3DDevice9_Release (sink->d3ddev); - sink->d3ddev = NULL; - GST_DEBUG_OBJECT (sink, "Direct3D device released. Reference count: %d", - ref_count); - } if (sink->d3d_offscreen_surface) { int ref_count; ref_count = IDirect3DSurface9_Release (sink->d3d_offscreen_surface); @@ -2257,6 +2250,13 @@ gst_d3dvideosink_release_d3d_device (GstD3DVideoSink * sink) GST_DEBUG_OBJECT (sink, "Direct3D offscreen surface released. Reference count: %d", ref_count); } + if (sink->d3ddev) { + int ref_count; + ref_count = IDirect3DDevice9_Release (sink->d3ddev); + sink->d3ddev = NULL; + GST_DEBUG_OBJECT (sink, "Direct3D device released. Reference count: %d", + ref_count); + } return TRUE; } -- 2.7.4