mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 11:55:39 +00:00
vaapivideomemory: check for memory allocator
When calling gst_vaapi_video_memory_copy() the allocator of the memory to copy should be allocated by the vaapi allocator. This patch does this verification.
This commit is contained in:
parent
f6566a2c98
commit
e265788271
1 changed files with 6 additions and 2 deletions
|
@ -556,15 +556,19 @@ gst_vaapi_video_memory_copy (GstMemory * base_mem, gssize offset, gssize size)
|
|||
{
|
||||
GstVaapiVideoMemory *const mem = GST_VAAPI_VIDEO_MEMORY_CAST (base_mem);
|
||||
GstVaapiVideoMeta *meta;
|
||||
GstAllocator *allocator;
|
||||
GstMemory *out_mem;
|
||||
gsize maxsize;
|
||||
|
||||
g_return_val_if_fail (mem, NULL);
|
||||
g_return_val_if_fail (mem->meta, NULL);
|
||||
|
||||
allocator = base_mem->allocator;
|
||||
g_return_val_if_fail (GST_VAAPI_IS_VIDEO_ALLOCATOR (allocator), FALSE);
|
||||
|
||||
/* XXX: this implements a soft-copy, i.e. underlying VA surfaces
|
||||
are not copied */
|
||||
(void) gst_memory_get_sizes (GST_MEMORY_CAST (mem), NULL, &maxsize);
|
||||
(void) gst_memory_get_sizes (base_mem, NULL, &maxsize);
|
||||
if (offset != 0 || (size != -1 && (gsize) size != maxsize))
|
||||
goto error_unsupported;
|
||||
|
||||
|
@ -575,7 +579,7 @@ gst_vaapi_video_memory_copy (GstMemory * base_mem, gssize offset, gssize size)
|
|||
if (!meta)
|
||||
goto error_allocate_memory;
|
||||
|
||||
out_mem = gst_vaapi_video_memory_new (GST_MEMORY_CAST (mem)->allocator, meta);
|
||||
out_mem = gst_vaapi_video_memory_new (allocator, meta);
|
||||
gst_vaapi_video_meta_unref (meta);
|
||||
if (!out_mem)
|
||||
goto error_allocate_memory;
|
||||
|
|
Loading…
Reference in a new issue