mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 10:41:04 +00:00
[763/906] memory: copy properly depending on where the most recent data is
This commit is contained in:
parent
f6f0c4ddad
commit
71a70e78f6
1 changed files with 25 additions and 14 deletions
|
@ -22,6 +22,8 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <gst/video/video.h>
|
||||
|
||||
#include "gstglmemory.h"
|
||||
|
@ -281,6 +283,13 @@ _gl_mem_copy (GstGLMemory * src, gssize offset, gssize size)
|
|||
GstGLMemory *dest;
|
||||
GstGLMemoryCopyParams copy_params;
|
||||
|
||||
if (GST_GL_MEMORY_FLAG_IS_SET (src, GST_GL_MEMORY_FLAG_NEED_UPLOAD)) {
|
||||
dest = _gl_mem_new (src->mem.allocator, NULL, src->display, src->v_format,
|
||||
src->width, src->height, NULL, NULL);
|
||||
dest->data = g_malloc (src->mem.maxsize);
|
||||
memcpy (dest->data, src->data, src->mem.maxsize);
|
||||
GST_GL_MEMORY_FLAG_SET (dest, GST_GL_MEMORY_FLAG_NEED_UPLOAD);
|
||||
} else {
|
||||
copy_params = (GstGLMemoryCopyParams) {
|
||||
src, 0,};
|
||||
|
||||
|
@ -300,6 +309,8 @@ _gl_mem_copy (GstGLMemory * src, gssize offset, gssize size)
|
|||
gst_memory_unref ((GstMemory *) dest);
|
||||
return NULL;
|
||||
}
|
||||
GST_GL_MEMORY_FLAG_SET (dest, GST_GL_MEMORY_FLAG_NEED_DOWNLOAD);
|
||||
}
|
||||
|
||||
GST_CAT_DEBUG (GST_CAT_GL_MEMORY, "copied texture:%u into texture %u",
|
||||
src->tex_id, dest->tex_id);
|
||||
|
|
Loading…
Reference in a new issue