mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-22 14:06:23 +00:00
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.
This commit is contained in:
parent
393e86e3d0
commit
cc9afca3ed
1 changed files with 8 additions and 2 deletions
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue