[farsight2/master] Make start_stun into a private function and call stop_stun() on dispose

Olivier Crête olivier.crete at collabora.co.uk
Tue Dec 23 15:23:49 PST 2008


---
 transmitters/rawudp/fs-rawudp-component.c |   14 +++++++++++++-
 transmitters/rawudp/fs-rawudp-component.h |    3 ---
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/transmitters/rawudp/fs-rawudp-component.c b/transmitters/rawudp/fs-rawudp-component.c
index b3e5cb7..b5c2ac3 100644
--- a/transmitters/rawudp/fs-rawudp-component.c
+++ b/transmitters/rawudp/fs-rawudp-component.c
@@ -183,6 +183,10 @@ stun_timeout_func (gpointer user_data);
 static gboolean
 buffer_recv_cb (GstPad *pad, GstBuffer *buffer, gpointer user_data);
 
+static gboolean
+fs_rawudp_component_start_stun (FsRawUdpComponent *self, GError **error);
+static void
+fs_rawudp_component_stop_stun_locked (FsRawUdpComponent *self);
 
 GType
 fs_rawudp_component_get_type (void)
@@ -492,6 +496,7 @@ fs_rawudp_component_stop (FsRawUdpComponent *self)
   FS_RAWUDP_COMPONENT_LOCK (self);
   if (self->priv->stun_timeout_thread != NULL)
   {
+    fs_rawudp_component_stop_stun_locked (self);
     FS_RAWUDP_COMPONENT_UNLOCK (self);
     g_thread_join (self->priv->stun_timeout_thread);
     FS_RAWUDP_COMPONENT_LOCK (self);
@@ -773,13 +778,20 @@ fs_rawudp_component_gather_local_candidates (FsRawUdpComponent *self,
     return FALSE;
   }
 
+  if (!self->priv->udpport)
+  {   g_set_error (error, FS_ERROR, FS_ERROR_INVALID_ARGUMENTS,
+        "You can not call gather_local_candidate() after the stream has"
+        " been stopped");
+    return FALSE;
+  }
+
   if (self->priv->stun_ip && self->priv->stun_port)
     return fs_rawudp_component_start_stun (self, error);
   else
     return fs_rawudp_component_emit_local_candidates (self, error);
 }
 
-gboolean
+static gboolean
 fs_rawudp_component_start_stun (FsRawUdpComponent *self, GError **error)
 {
   struct addrinfo hints;
diff --git a/transmitters/rawudp/fs-rawudp-component.h b/transmitters/rawudp/fs-rawudp-component.h
index ad3c91e..b1cf8ba 100644
--- a/transmitters/rawudp/fs-rawudp-component.h
+++ b/transmitters/rawudp/fs-rawudp-component.h
@@ -110,9 +110,6 @@ gboolean
 fs_rawudp_component_gather_local_candidates (FsRawUdpComponent *self,
     GError **error);
 
-gboolean
-fs_rawudp_component_start_stun (FsRawUdpComponent *self, GError **error);
-
 void
 fs_rawudp_component_stop (FsRawUdpComponent *self);
 
-- 
1.5.6.5




More information about the farsight-commits mailing list