mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-19 05:45:58 +00:00
applemedia: free videotexturecache texture in gl thread
The cached texture was treated as user_data passed to GstGLBaseMemory and freed with a GDestroyNotify function. However, this data must be treated specially: it must be destroyed in the GL thread. https://bugzilla.gnome.org/show_bug.cgi?id=778434
This commit is contained in:
parent
ef739e726f
commit
487e57f1b7
3 changed files with 10 additions and 10 deletions
|
@ -42,6 +42,7 @@ _ios_gl_memory_destroy (GstGLBaseMemory * gl_mem)
|
||||||
{
|
{
|
||||||
GstIOSGLMemory *mem = (GstIOSGLMemory *) gl_mem;
|
GstIOSGLMemory *mem = (GstIOSGLMemory *) gl_mem;
|
||||||
|
|
||||||
|
CFRelease (mem->texture);
|
||||||
gst_memory_unref (GST_MEMORY_CAST (mem->cv_mem));
|
gst_memory_unref (GST_MEMORY_CAST (mem->cv_mem));
|
||||||
GST_GL_BASE_MEMORY_ALLOCATOR_CLASS
|
GST_GL_BASE_MEMORY_ALLOCATOR_CLASS
|
||||||
(gst_ios_gl_memory_allocator_parent_class)->destroy (gl_mem);
|
(gst_ios_gl_memory_allocator_parent_class)->destroy (gl_mem);
|
||||||
|
@ -134,8 +135,7 @@ _ios_gl_memory_new (GstGLContext * context,
|
||||||
GstVideoGLTextureType tex_type,
|
GstVideoGLTextureType tex_type,
|
||||||
guint tex_id,
|
guint tex_id,
|
||||||
GstVideoInfo * info,
|
GstVideoInfo * info,
|
||||||
guint plane,
|
guint plane, GstVideoAlignment * valign, CVOpenGLESTextureRef texture)
|
||||||
GstVideoAlignment * valign, gpointer user_data, GDestroyNotify notify)
|
|
||||||
{
|
{
|
||||||
GstIOSGLMemory *mem;
|
GstIOSGLMemory *mem;
|
||||||
|
|
||||||
|
@ -143,8 +143,9 @@ _ios_gl_memory_new (GstGLContext * context,
|
||||||
mem->gl_mem.tex_id = tex_id;
|
mem->gl_mem.tex_id = tex_id;
|
||||||
mem->gl_mem.texture_wrapped = TRUE;
|
mem->gl_mem.texture_wrapped = TRUE;
|
||||||
gst_gl_memory_init (&mem->gl_mem, _ios_gl_memory_allocator, NULL, context,
|
gst_gl_memory_init (&mem->gl_mem, _ios_gl_memory_allocator, NULL, context,
|
||||||
target, tex_type, NULL, info, plane, valign, user_data, notify);
|
target, tex_type, NULL, info, plane, valign, NULL, NULL);
|
||||||
mem->cv_mem = cv_mem;
|
mem->cv_mem = cv_mem;
|
||||||
|
mem->texture = texture;
|
||||||
|
|
||||||
GST_MINI_OBJECT_FLAG_SET (mem, GST_MEMORY_FLAG_READONLY);
|
GST_MINI_OBJECT_FLAG_SET (mem, GST_MEMORY_FLAG_READONLY);
|
||||||
|
|
||||||
|
@ -158,9 +159,8 @@ gst_ios_gl_memory_new_wrapped (GstGLContext * context,
|
||||||
GstVideoGLTextureType tex_type,
|
GstVideoGLTextureType tex_type,
|
||||||
guint tex_id,
|
guint tex_id,
|
||||||
GstVideoInfo * info,
|
GstVideoInfo * info,
|
||||||
guint plane,
|
guint plane, GstVideoAlignment * valign, CVOpenGLESTextureRef texture)
|
||||||
GstVideoAlignment * valign, gpointer user_data, GDestroyNotify notify)
|
|
||||||
{
|
{
|
||||||
return _ios_gl_memory_new (context, cv_mem, target, tex_type, tex_id, info,
|
return _ios_gl_memory_new (context, cv_mem, target, tex_type, tex_id, info,
|
||||||
plane, valign, user_data, notify);
|
plane, valign, texture);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ typedef struct _GstIOSGLMemory
|
||||||
{
|
{
|
||||||
GstGLMemory gl_mem;
|
GstGLMemory gl_mem;
|
||||||
GstAppleCoreVideoMemory *cv_mem;
|
GstAppleCoreVideoMemory *cv_mem;
|
||||||
|
CVOpenGLESTextureRef texture;
|
||||||
} GstIOSGLMemory;
|
} GstIOSGLMemory;
|
||||||
|
|
||||||
#define GST_IOS_GL_MEMORY_ALLOCATOR_NAME "IOSGLMemory"
|
#define GST_IOS_GL_MEMORY_ALLOCATOR_NAME "IOSGLMemory"
|
||||||
|
@ -58,8 +59,7 @@ gst_ios_gl_memory_new_wrapped (GstGLContext * context,
|
||||||
GstVideoInfo * info,
|
GstVideoInfo * info,
|
||||||
guint plane,
|
guint plane,
|
||||||
GstVideoAlignment *valign,
|
GstVideoAlignment *valign,
|
||||||
gpointer user_data,
|
CVOpenGLESTextureRef texture);
|
||||||
GDestroyNotify notify);
|
|
||||||
|
|
||||||
gboolean gst_is_ios_gl_memory (GstMemory * mem);
|
gboolean gst_is_ios_gl_memory (GstMemory * mem);
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,7 @@ _do_create_memory (GstGLContext * context, ContextThreadData * data)
|
||||||
gl_target, GST_VIDEO_GL_TEXTURE_TYPE_RGBA,
|
gl_target, GST_VIDEO_GL_TEXTURE_TYPE_RGBA,
|
||||||
CVOpenGLESTextureGetName (texture),
|
CVOpenGLESTextureGetName (texture),
|
||||||
&cache->input_info,
|
&cache->input_info,
|
||||||
0, NULL, texture, (GDestroyNotify) CFRelease);
|
0, NULL, texture);
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FORMAT_NV12: {
|
case GST_VIDEO_FORMAT_NV12: {
|
||||||
GstVideoGLTextureType textype;
|
GstVideoGLTextureType textype;
|
||||||
|
@ -181,7 +181,7 @@ _do_create_memory (GstGLContext * context, ContextThreadData * data)
|
||||||
memory = gst_apple_core_video_memory_new_wrapped (gpixbuf, plane, size);
|
memory = gst_apple_core_video_memory_new_wrapped (gpixbuf, plane, size);
|
||||||
gl_memory = gst_ios_gl_memory_new_wrapped (context, memory,
|
gl_memory = gst_ios_gl_memory_new_wrapped (context, memory,
|
||||||
gl_target, textype, CVOpenGLESTextureGetName (texture), &cache->input_info,
|
gl_target, textype, CVOpenGLESTextureGetName (texture), &cache->input_info,
|
||||||
plane, NULL, texture, (GDestroyNotify) CFRelease);
|
plane, NULL, texture);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue