videobuffer: fix memory leak for surface and image.

Fix reference leak of surface and image in GstVaapiVideoBuffer wrapper,
thus resulting on actual memory leak of GstVaapiImage when using them
for downloads/uploads from VA surfaces and more specifically surfaces
when the pipeline is shutdown. i.e. vaTerminate() was never called
because the resources were not unreferenced, and thus not deallocated
in the end.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
This commit is contained in:
Wind Yuan 2012-10-30 13:15:45 +08:00 committed by Gwenole Beauchesne
parent a9f8e17ec5
commit 5fac9d4b55
2 changed files with 3 additions and 4 deletions

1
NEWS
View file

@ -5,6 +5,7 @@ Copyright (C) 2011 Collabora
Version 0.5.0 - DD.Dec.2012
* Require glib >= 2.31.2
* Fix memory leak in GstVaapiVideoBuffer for images and surfaces (Feng Yuan)
Version 0.4.1 - 20.Nov.2012
* Add support for H.264 interlaced streams

View file

@ -86,8 +86,7 @@ gst_vaapi_video_buffer_destroy_image(GstVaapiVideoBuffer *buffer)
if (priv->image) {
if (priv->image_pool)
gst_vaapi_video_pool_put_object(priv->image_pool, priv->image);
else
g_object_unref(priv->image);
g_object_unref(priv->image);
priv->image = NULL;
}
@ -104,8 +103,7 @@ gst_vaapi_video_buffer_destroy_surface(GstVaapiVideoBuffer *buffer)
if (priv->surface) {
if (priv->surface_pool)
gst_vaapi_video_pool_put_object(priv->surface_pool, priv->surface);
else
g_object_unref(priv->surface);
g_object_unref(priv->surface);
priv->surface = NULL;
}