[farsight2/master] Move function to compare lists of codec associations into the codec-negotiation file

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


---
 gst/fsrtpconference/fs-rtp-codec-negotiation.c |   47 ++++++++++++++++++++++++
 gst/fsrtpconference/fs-rtp-codec-negotiation.h |    3 ++
 gst/fsrtpconference/fs-rtp-session.c           |   46 -----------------------
 3 files changed, 50 insertions(+), 46 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-codec-negotiation.c b/gst/fsrtpconference/fs-rtp-codec-negotiation.c
index ca5da43..83976ae 100644
--- a/gst/fsrtpconference/fs-rtp-codec-negotiation.c
+++ b/gst/fsrtpconference/fs-rtp-codec-negotiation.c
@@ -715,3 +715,50 @@ codec_association_find_custom (GList *codec_associations,
 
   return NULL;
 }
+
+
+/**
+ * codec_association_list_are_equal
+ * @list1: a #GList of #FsCodec
+ * @list2: a #GList of #FsCodec
+ *
+ * Compares the non-disabled #FsCodec of two lists of #CodecAssociation
+ *
+ * Returns: TRUE if they are identical, FALSE otherwise
+ */
+
+gboolean
+codec_associations_list_are_equal (GList *list1, GList *list2)
+{
+  for (;list1 && list2;
+       list1 = g_list_next (list1), list2 = g_list_next (list2))
+  {
+    CodecAssociation *ca1 = NULL;
+    CodecAssociation *ca2 = NULL;
+
+    /* Skip disabled codecs */
+    while (list1) {
+      ca1 = list1->data;
+      if (!ca1->disable)
+        break;
+      list1 = g_list_next (list1);
+    }
+    while (list2) {
+      ca2 = list2->data;
+      if (!ca2->disable)
+        break;
+      list2 = g_list_next (list2);
+    }
+
+    if (list1 == NULL || list2 == NULL)
+      break;
+
+    if (!fs_codec_are_equal (ca1->codec, ca2->codec))
+      return FALSE;
+  }
+
+  if (list1 == NULL && list2 == NULL)
+    return TRUE;
+  else
+    return FALSE;
+}
diff --git a/gst/fsrtpconference/fs-rtp-codec-negotiation.h b/gst/fsrtpconference/fs-rtp-codec-negotiation.h
index 202dc4b..05adff4 100644
--- a/gst/fsrtpconference/fs-rtp-codec-negotiation.h
+++ b/gst/fsrtpconference/fs-rtp-codec-negotiation.h
@@ -84,6 +84,9 @@ codec_association_is_valid_for_sending (CodecAssociation *ca);
 GList *
 codec_associations_to_codecs (GList *codec_associations);
 
+gboolean
+codec_associations_list_are_equal (GList *list1, GList *list2);
+
 void
 codec_association_list_destroy (GList *list);
 
diff --git a/gst/fsrtpconference/fs-rtp-session.c b/gst/fsrtpconference/fs-rtp-session.c
index d6a0eee..f16dc31 100644
--- a/gst/fsrtpconference/fs-rtp-session.c
+++ b/gst/fsrtpconference/fs-rtp-session.c
@@ -1512,52 +1512,6 @@ fs_rtp_session_invalidate_pt (FsRtpSession *session, gint pt,
 }
 
 /**
- * codec_association_list_are_equal
- * @list1: a #GList of #FsCodec
- * @list2: a #GList of #FsCodec
- *
- * Compares the non-disabled #FsCodec of two lists of #CodecAssociation
- *
- * Returns: TRUE if they are identical, FALSE otherwise
- */
-
-gboolean
-codec_associations_list_are_equal (GList *list1, GList *list2)
-{
-  for (;list1 && list2;
-       list1 = g_list_next (list1), list2 = g_list_next (list2))
-  {
-    CodecAssociation *ca1 = NULL;
-    CodecAssociation *ca2 = NULL;
-
-    /* Skip disabled codecs */
-    while (list1) {
-      ca1 = list1->data;
-      if (!ca1->disable)
-        break;
-      list1 = g_list_next (list1);
-    }
-    while (list2) {
-      ca2 = list2->data;
-      if (!ca2->disable)
-        break;
-      list2 = g_list_next (list2);
-    }
-
-    if (list1 == NULL || list2 == NULL)
-      break;
-
-    if (!fs_codec_are_equal (ca1->codec, ca2->codec))
-      return FALSE;
-  }
-
-  if (list1 == NULL && list2 == NULL)
-    return TRUE;
-  else
-    return FALSE;
-}
-
-/**
  * fs_rtp_session_negotiate_codecs:
  * @session: a #FsRtpSession
  * @remote_codecs: a #GList of #FsCodec
-- 
1.5.6.5




More information about the farsight-commits mailing list