[410/906] gstglmixer: inactivate shared gl context before to release ours

First, inactivate shared gl contexts known by each sink pad.
Then, destroy the gl context known by the glmixer.
Finally, re-activate shared gl contexts.
This is to satisfy the fact that no shared gl context must be current
when an opengl context is destroyed.
Moreover the application may hang or crash without those steps.
This commit is contained in:
Julien Isorce 2009-12-16 01:33:39 +01:00 committed by Matthew Waters
parent ba4ca3bced
commit e356b7d1ed

View file

@ -1274,10 +1274,8 @@ gst_gl_mixer_change_state (GstElement * element, GstStateChange transition)
while (walk) { while (walk) {
GstGLMixerPad *sink_pad = GST_GL_MIXER_PAD (walk->data); GstGLMixerPad *sink_pad = GST_GL_MIXER_PAD (walk->data);
walk = g_slist_next (walk); walk = g_slist_next (walk);
if (sink_pad->display) { if (sink_pad->display)
g_object_unref (sink_pad->display); gst_gl_display_activate_gl_context (sink_pad->display, FALSE);
sink_pad->display = NULL;
}
} }
if (mixer_class->reset) if (mixer_class->reset)
mixer_class->reset (mix); mixer_class->reset (mix);
@ -1290,6 +1288,15 @@ gst_gl_mixer_change_state (GstElement * element, GstStateChange transition)
g_object_unref (mix->display); g_object_unref (mix->display);
mix->display = NULL; mix->display = NULL;
} }
while (walk) {
GstGLMixerPad *sink_pad = GST_GL_MIXER_PAD (walk->data);
walk = g_slist_next (walk);
if (sink_pad->display) {
gst_gl_display_activate_gl_context (sink_pad->display, TRUE);
g_object_unref (sink_pad->display);
sink_pad->display = NULL;
}
}
break; break;
} }
default: default: