mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 09:40:37 +00:00
[177/906] fix gleffects memory issue (init resources on start and reset them on stop)
This commit is contained in:
parent
35b7b488f3
commit
0a4aa6ecc3
1 changed files with 17 additions and 10 deletions
|
@ -279,15 +279,6 @@ set_horizontal_swap (GstGLDisplay *display, gpointer data)
|
||||||
static void
|
static void
|
||||||
gst_gl_effects_init (GstGLEffects * effects, GstGLEffectsClass * klass)
|
gst_gl_effects_init (GstGLEffects * effects, GstGLEffectsClass * klass)
|
||||||
{
|
{
|
||||||
gint i;
|
|
||||||
effects->shaderstable = g_hash_table_new_full (g_str_hash,
|
|
||||||
g_str_equal,
|
|
||||||
NULL,
|
|
||||||
g_object_unref);
|
|
||||||
for (i=0; i<GST_GL_EFFECTS_N_CURVES; i++) {
|
|
||||||
effects->curve[i] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
effects->effect = gst_gl_effects_identity;
|
effects->effect = gst_gl_effects_identity;
|
||||||
effects->horizontal_swap = FALSE;
|
effects->horizontal_swap = FALSE;
|
||||||
}
|
}
|
||||||
|
@ -297,6 +288,8 @@ gst_gl_effects_reset_resources (GstGLFilter* filter)
|
||||||
{
|
{
|
||||||
GstGLEffects* effects = GST_GL_EFFECTS(filter);
|
GstGLEffects* effects = GST_GL_EFFECTS(filter);
|
||||||
|
|
||||||
|
// g_message ("reset resources");
|
||||||
|
|
||||||
g_hash_table_unref (effects->shaderstable);
|
g_hash_table_unref (effects->shaderstable);
|
||||||
effects->shaderstable = NULL;
|
effects->shaderstable = NULL;
|
||||||
}
|
}
|
||||||
|
@ -342,7 +335,21 @@ gst_gl_effects_get_property (GObject * object, guint prop_id,
|
||||||
static void
|
static void
|
||||||
gst_gl_effects_init_resources (GstGLFilter* filter)
|
gst_gl_effects_init_resources (GstGLFilter* filter)
|
||||||
{
|
{
|
||||||
// GstGLEffects* blur_filter = GST_GL_EFFECTS (filter);
|
GstGLEffects *effects = GST_GL_EFFECTS (filter);
|
||||||
|
gint i;
|
||||||
|
// g_message ("init resources");
|
||||||
|
// g_message ("init hashtable");
|
||||||
|
effects->shaderstable = g_hash_table_new_full (g_str_hash,
|
||||||
|
g_str_equal,
|
||||||
|
NULL,
|
||||||
|
g_object_unref);
|
||||||
|
// g_message ("zero textures and curves");
|
||||||
|
for (i=0; i<NEEDED_TEXTURES; i++) {
|
||||||
|
effects->midtexture[i] = 0;
|
||||||
|
}
|
||||||
|
for (i=0; i<GST_GL_EFFECTS_N_CURVES; i++) {
|
||||||
|
effects->curve[i] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
Loading…
Reference in a new issue