uploader: fix memory leak in GStreamer 0.10 builds.

In GStreamer 0.10 builds, gst_vaapi_uploader_get_buffer() was used
but it exhibited a memory leak because the surface generated for the
GstVaapiVideoMeta totally lost its parent video pool. So, it was not
possible to release that surface back to the parent pool when the meta
gets released, and the memory consumption kept growing.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
This commit is contained in:
Zhao Halley 2013-05-15 10:33:16 +08:00 committed by Gwenole Beauchesne
parent 35eaa9e763
commit dadf0ef978

7
gst/vaapi/gstvaapiuploader.c Normal file → Executable file
View file

@ -412,7 +412,6 @@ GstBuffer *
gst_vaapi_uploader_get_buffer(GstVaapiUploader *uploader)
{
GstVaapiUploaderPrivate *priv;
GstVaapiSurface *surface;
GstVaapiImage *image;
GstVaapiVideoMeta *meta;
GstBuffer *buffer;
@ -428,15 +427,11 @@ gst_vaapi_uploader_get_buffer(GstVaapiUploader *uploader)
}
meta = gst_buffer_get_vaapi_video_meta(buffer);
surface = gst_vaapi_video_pool_get_object(priv->surfaces);
if (!surface) {
if (!gst_vaapi_video_meta_set_surface_from_pool(meta, priv->surfaces)) {
GST_WARNING("failed to allocate VA surface");
goto error;
}
gst_vaapi_video_meta_set_surface(meta, surface);
image = gst_vaapi_video_meta_get_image(meta);
if (!gst_vaapi_image_map(image)) {
GST_WARNING("failed to map VA image");