diff options
-rw-r--r-- | gst/gstnicesrc.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/gst/gstnicesrc.c b/gst/gstnicesrc.c index ddae37e..b86f096 100644 --- a/gst/gstnicesrc.c +++ b/gst/gstnicesrc.c @@ -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); |