Commit 1dc5ac66 authored by Olivier Crête's avatar Olivier Crête Committed by Youness Alaoui

Properly cleanup the idle source in the gst src

Also, do not re-create it if it already exists
parent 0f0450f5
......@@ -219,6 +219,7 @@ gst_nice_src_unlock_idler (gpointer data)
g_main_loop_quit (nicesrc->mainloop);
if (nicesrc->idle_source) {
g_source_destroy (nicesrc->idle_source);
g_source_unref (nicesrc->idle_source);
nicesrc->idle_source = NULL;
}
......@@ -237,10 +238,12 @@ gst_nice_src_unlock (GstBaseSrc *src)
g_main_loop_quit (nicesrc->mainloop);
nicesrc->idle_source = g_idle_source_new ();
g_source_set_priority (nicesrc->idle_source, G_PRIORITY_HIGH);
g_source_set_callback (nicesrc->idle_source, gst_nice_src_unlock_idler, src, NULL);
g_source_attach (nicesrc->idle_source, g_main_loop_get_context (nicesrc->mainloop));
if (!nicesrc->idle_source) {
nicesrc->idle_source = g_idle_source_new ();
g_source_set_priority (nicesrc->idle_source, G_PRIORITY_HIGH);
g_source_set_callback (nicesrc->idle_source, gst_nice_src_unlock_idler, src, NULL);
g_source_attach (nicesrc->idle_source, g_main_loop_get_context (nicesrc->mainloop));
}
GST_OBJECT_UNLOCK (src);
return TRUE;
......@@ -253,8 +256,10 @@ gst_nice_src_unlock_stop (GstBaseSrc *src)
GST_OBJECT_LOCK (src);
nicesrc->unlocked = FALSE;
if (nicesrc->idle_source)
if (nicesrc->idle_source) {
g_source_destroy (nicesrc->idle_source);
g_source_unref(nicesrc->idle_source);
}
nicesrc->idle_source = NULL;
GST_OBJECT_UNLOCK (src);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment