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.
This commit is contained in:
Andoni Morales Alastruey 2012-06-25 16:18:41 +02:00 committed by Sebastian Dröge
parent 53988c9a43
commit ad5b76a58d

View file

@ -2243,13 +2243,6 @@ error:
static gboolean static gboolean
gst_d3dvideosink_release_d3d_device (GstD3DVideoSink * sink) 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) { if (sink->d3d_offscreen_surface) {
int ref_count; int ref_count;
ref_count = IDirect3DSurface9_Release (sink->d3d_offscreen_surface); ref_count = IDirect3DSurface9_Release (sink->d3d_offscreen_surface);
@ -2257,6 +2250,13 @@ gst_d3dvideosink_release_d3d_device (GstD3DVideoSink * sink)
GST_DEBUG_OBJECT (sink, GST_DEBUG_OBJECT (sink,
"Direct3D offscreen surface released. Reference count: %d", ref_count); "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; return TRUE;
} }