mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 04:31:06 +00:00
plugins: implement GLTextureUploadMeta user data copy.
Makes the copies of a buffer reference their own GLTextureUploadMeta user data and prevent the original buffer accessing already freed memory if its copies has been released and freed. https://bugzilla.gnome.org/show_bug.cgi?id=720336 [Propagate the original meta texture to the copy too] Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
This commit is contained in:
parent
e3dcd33114
commit
bf8f244de3
1 changed files with 15 additions and 1 deletions
|
@ -57,6 +57,19 @@ meta_texture_new(void)
|
|||
return meta;
|
||||
}
|
||||
|
||||
static GstVaapiVideoMetaTexture *
|
||||
meta_texture_copy(GstVaapiVideoMetaTexture *meta)
|
||||
{
|
||||
GstVaapiVideoMetaTexture *copy;
|
||||
|
||||
copy = meta_texture_new();
|
||||
if (!copy)
|
||||
return NULL;
|
||||
|
||||
gst_vaapi_texture_replace(©->texture, meta->texture);
|
||||
return copy;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_vaapi_texture_upload(GstVideoGLTextureUploadMeta *meta, guint texture_id[4])
|
||||
{
|
||||
|
@ -108,7 +121,8 @@ gst_buffer_add_texture_upload_meta(GstBuffer *buffer)
|
|||
meta = gst_buffer_add_video_gl_texture_upload_meta(buffer,
|
||||
GST_VIDEO_GL_TEXTURE_ORIENTATION_X_NORMAL_Y_NORMAL,
|
||||
1, tex_type, gst_vaapi_texture_upload,
|
||||
meta_texture, NULL, (GBoxedFreeFunc)meta_texture_free);
|
||||
meta_texture, (GBoxedCopyFunc)meta_texture_copy,
|
||||
(GBoxedFreeFunc)meta_texture_free);
|
||||
if (!meta)
|
||||
goto error;
|
||||
return TRUE;
|
||||
|
|
Loading…
Reference in a new issue