{
gst_gl_display_lock (display);
- GST_INFO ("send message thread destroy context");
- gst_gl_window_send_message (display->gl_window, GST_GL_WINDOW_CB (gst_gl_display_thread_destroy_context), display);
gst_gl_window_set_resize_callback (display->gl_window, NULL, NULL);
gst_gl_window_set_draw_callback (display->gl_window, NULL, NULL);
gst_gl_window_set_close_callback (display->gl_window, NULL, NULL);
- //leave gl window loop
-
GST_INFO ("send quit gl window loop");
- gst_gl_window_quit_loop (display->gl_window);
+ gst_gl_window_quit_loop (display->gl_window, GST_GL_WINDOW_CB (gst_gl_display_thread_destroy_context), display);
GST_INFO ("quit sent to gl window loop");
{
gpointer ret = g_thread_join (display->gl_thread);
GST_INFO ("gl thread joined");
- g_assert (ret == NULL);
+ if (ret != NULL)
+ GST_ERROR ("gl thread returned a not null pointer");
display->gl_thread = NULL;
}
if (display->texture_pool) {
//texture pool is empty after destroying the gl context
- g_assert (g_hash_table_size (display->texture_pool) == 0);
+ if (g_hash_table_size (display->texture_pool) != 0)
+ GST_ERROR ("texture pool is not empty");
g_hash_table_unref (display->texture_pool);
display->texture_pool = NULL;
}
display->upload_intex = 0;
}
+ GST_INFO ("Cleaning texture pool");
+
//clean up the texture pool
g_hash_table_foreach_remove (display->texture_pool, gst_gl_display_texture_pool_func_clean,
NULL);
void gst_gl_display_on_close (GstGLDisplay* display)
{
GST_INFO ("on close");
+
display->isAlive = FALSE;
}
while (g_queue_get_length (sub_texture_pool) > 0)
{
GstGLDisplayTex* tex = g_queue_pop_head (sub_texture_pool);
+ GST_INFO ("trying to delete texture id: %d deleted", tex->texture);
glDeleteTextures (1, &tex->texture);
GST_INFO ("texture id: %d deleted", tex->texture);
g_free (tex);
void gst_gl_window_visible (GstGLWindow *window, gboolean visible);
void gst_gl_window_draw (GstGLWindow *window);
void gst_gl_window_run_loop (GstGLWindow *window);
-void gst_gl_window_quit_loop (GstGLWindow *window);
+void gst_gl_window_quit_loop (GstGLWindow *window, GstGLWindowCB callback, gpointer data);
void gst_gl_window_send_message (GstGLWindow *window, GstGLWindowCB callback, gpointer data);
if (!custom_cb || !custom_data)
g_debug ("custom cb not initialized\n");
+ if (glXGetCurrentContext () != priv->gl_context)
+ g_warning ("current gl context has changed\n");
+
custom_cb (custom_data);
}
else if (wm_quit_loop != None && event.xclient.message_type == wm_quit_loop)
{
- XEvent event;
+ XEvent pending_event;
+ GstGLWindowCB destroy_cb = (GstGLWindowCB) event.xclient.data.l[0];
+ gpointer destroy_data = (gpointer) event.xclient.data.l[1];
g_debug ("Quit loop message %lld\n", (guint64) priv->internal_win_id);
priv->running = FALSE;
XFlush (priv->device);
- while (XCheckTypedEvent (priv->device, ClientMessage, &event))
+ while (XCheckTypedEvent (priv->device, ClientMessage, &pending_event))
{
- GstGLWindowCB custom_cb = (GstGLWindowCB) event.xclient.data.l[0];
- gpointer custom_data = (gpointer) event.xclient.data.l[1];
+ GstGLWindowCB custom_cb = (GstGLWindowCB) pending_event.xclient.data.l[0];
+ gpointer custom_data = (gpointer) pending_event.xclient.data.l[1];
- g_debug ("discared custom x event\n");
+ g_debug ("execute last pending custom x events\n");
if (!custom_cb || !custom_data)
g_debug ("custom cb not initialized\n");
g_cond_signal (priv->cond_send_message);
}
+
+ if (!destroy_cb || !destroy_data)
+ g_debug ("destroy cb not initialized\n");
+
+ if (glXGetCurrentContext () != priv->gl_context)
+ g_warning ("current gl context has changed\n");
+
+ destroy_cb (destroy_data);
+
}
else
{
/* Thread safe */
void
-gst_gl_window_quit_loop (GstGLWindow *window)
+gst_gl_window_quit_loop (GstGLWindow *window, GstGLWindowCB callback, gpointer data)
{
if (window)
{
event.xclient.window = priv->internal_win_id;
event.xclient.message_type = XInternAtom (disp, "WM_QUIT_LOOP", True);;
event.xclient.format = 32;
+ event.xclient.data.l[0] = (long) callback;
+ event.xclient.data.l[1] = (long) data;
XSendEvent (disp, priv->internal_win_id, FALSE, NoEventMask, &event);
XSync (disp, FALSE);