From cc9afca3edf74a821e337b46d6bf383eff0fcac0 Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Fri, 4 Oct 2013 19:34:32 +0200 Subject: [PATCH] plugins: create a proxy for GstVaapiUploader allocated buffers. Always make sure to allocate a VA surface proxy for GstVaapiUploader allocated buffers, i.e. make gst_vaapi_uploader_get_buffer() allocate a proxy surface. This fixes cases where we want to retain the underlying surface longer, instead of releasing it back to the surface pool right away. --- gst/vaapi/gstvaapiuploader.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gst/vaapi/gstvaapiuploader.c b/gst/vaapi/gstvaapiuploader.c index dc8f7a5878..b26caa06b3 100755 --- a/gst/vaapi/gstvaapiuploader.c +++ b/gst/vaapi/gstvaapiuploader.c @@ -451,6 +451,7 @@ gst_vaapi_uploader_get_buffer(GstVaapiUploader *uploader) GstVaapiUploaderPrivate *priv; GstVaapiImage *image; GstVaapiVideoMeta *meta; + GstVaapiSurfaceProxy *proxy; GstBuffer *buffer; g_return_val_if_fail(GST_VAAPI_IS_UPLOADER(uploader), NULL); @@ -463,12 +464,17 @@ gst_vaapi_uploader_get_buffer(GstVaapiUploader *uploader) goto error; } - meta = gst_buffer_get_vaapi_video_meta(buffer); - if (!gst_vaapi_video_meta_set_surface_from_pool(meta, priv->surfaces)) { + proxy = gst_vaapi_surface_proxy_new_from_pool( + GST_VAAPI_SURFACE_POOL(priv->surfaces)); + if (!proxy) { GST_WARNING("failed to allocate VA surface"); goto error; } + meta = gst_buffer_get_vaapi_video_meta(buffer); + gst_vaapi_video_meta_set_surface_proxy(meta, proxy); + gst_vaapi_surface_proxy_unref(proxy); + image = gst_vaapi_video_meta_get_image(meta); if (!gst_vaapi_image_map(image)) { GST_WARNING("failed to map VA image");