[farsight2/master] Make the cname optional in participants

Olivier Crête olivier.crete at collabora.co.uk
Thu Apr 23 17:54:53 PDT 2009


---
 gst/fsrtpconference/fs-rtp-conference.c |   45 +++++++++++++-----------------
 gst/fsrtpconference/fs-rtp-session.c    |    4 +--
 2 files changed, 21 insertions(+), 28 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-conference.c b/gst/fsrtpconference/fs-rtp-conference.c
index a55683b..e95a567 100644
--- a/gst/fsrtpconference/fs-rtp-conference.c
+++ b/gst/fsrtpconference/fs-rtp-conference.c
@@ -627,38 +627,33 @@ fs_rtp_conference_new_participant (FsBaseConference *conf,
     return NULL;
   }
 
-  if (!cname)
+  if (cname)
   {
-    g_set_error (error, FS_ERROR, FS_ERROR_INVALID_ARGUMENTS,
-        "Invalid NULL cname");
-    return NULL;
-  }
-
-  GST_OBJECT_LOCK (self);
-  for (item = g_list_first (self->priv->participants);
-       item;
-       item = g_list_next (item))
-  {
-    gchar *lcname;
-
-    g_object_get (item->data, "cname", &lcname, NULL);
-    if (!strcmp (lcname, cname))
+    GST_OBJECT_LOCK (self);
+    for (item = g_list_first (self->priv->participants);
+         item;
+         item = g_list_next (item))
     {
-      g_free (lcname);
+      gchar *lcname;
+
+      g_object_get (item->data, "cname", &lcname, NULL);
+      if (lcname && !strcmp (lcname, cname))
+      {
+        g_free (lcname);
         break;
+      }
+      g_free (lcname);
     }
-    g_free (lcname);
-  }
-  GST_OBJECT_UNLOCK (self);
+    GST_OBJECT_UNLOCK (self);
 
-  if (item)
-  {
-    g_set_error (error, FS_ERROR, FS_ERROR_INVALID_ARGUMENTS,
-        "There is already a participant with this cname");
-    return NULL;
+    if (item)
+    {
+      g_set_error (error, FS_ERROR, FS_ERROR_INVALID_ARGUMENTS,
+          "There is already a participant with this cname");
+      return NULL;
+    }
   }
 
-
   new_participant = FS_PARTICIPANT_CAST (fs_rtp_participant_new (cname));
 
 
diff --git a/gst/fsrtpconference/fs-rtp-session.c b/gst/fsrtpconference/fs-rtp-session.c
index beae4e5..1882d14 100644
--- a/gst/fsrtpconference/fs-rtp-session.c
+++ b/gst/fsrtpconference/fs-rtp-session.c
@@ -3691,9 +3691,7 @@ fs_rtp_session_associate_ssrc_cname (FsRtpSession *session,
 
     g_object_get (localstream->participant, "cname", &localcname, NULL);
 
-    g_assert (localcname);
-
-    if (!strcmp (localcname, cname))
+    if (localcname && !strcmp (localcname, cname))
     {
       stream = localstream;
       g_free (localcname);
-- 
1.5.6.5




More information about the farsight-commits mailing list