From: Zhao Halley Date: Fri, 19 Apr 2013 08:10:22 +0000 (+0800) Subject: Fix memory leak when doing YUV data upload X-Git-Tag: accepted/2.0alpha-wayland/20130429.171317~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=61e26450ceed0324b3a5711301bacaefcb2c6318;p=profile%2Fivi%2Fgstreamer-vaapi.git Fix memory leak when doing YUV data upload Indirect set surface to video buffer will leak memory, - when video buffer is destroy, the surface is not returned back to surface pool. - gst_vaapi_video_buffer_set_surface_from_pool() is correct, - while the following is incorrect: surface = gst_vaapi_video_pool_get_object(priv->surfaces); gst_vaapi_video_buffer_set_surface(vbuffer, surface); --- diff --git a/gst/vaapi/gstvaapiuploader.c b/gst/vaapi/gstvaapiuploader.c old mode 100644 new mode 100755 index e6bf74d..dc3e934 --- a/gst/vaapi/gstvaapiuploader.c +++ b/gst/vaapi/gstvaapiuploader.c @@ -441,7 +441,6 @@ GstBuffer * gst_vaapi_uploader_get_buffer(GstVaapiUploader *uploader) { GstVaapiUploaderPrivate *priv; - GstVaapiSurface *surface; GstVaapiImage *image; GstVaapiVideoBuffer *vbuffer; GstBuffer *buffer = NULL; @@ -457,13 +456,7 @@ gst_vaapi_uploader_get_buffer(GstVaapiUploader *uploader) } vbuffer = GST_VAAPI_VIDEO_BUFFER(buffer); - surface = gst_vaapi_video_pool_get_object(priv->surfaces); - if (!surface) { - GST_WARNING("failed to allocate VA surface"); - goto error; - } - - gst_vaapi_video_buffer_set_surface(vbuffer, surface); + gst_vaapi_video_buffer_set_surface_from_pool(vbuffer, priv->surfaces); image = gst_vaapi_video_buffer_get_image(vbuffer); if (!gst_vaapi_image_map(image)) {