[farsight2/master] rtpcodecnego: Add function to copy the list of codecs with the send-side ptime

Olivier Crête olivier.crete at collabora.co.uk
Mon Dec 28 18:16:11 PST 2009


---
 gst/fsrtpconference/fs-rtp-codec-negotiation.c |   61 +++++++++++++++++++-----
 gst/fsrtpconference/fs-rtp-codec-negotiation.h |    3 +
 2 files changed, 51 insertions(+), 13 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-codec-negotiation.c b/gst/fsrtpconference/fs-rtp-codec-negotiation.c
index 2561d79..3c29cba 100644
--- a/gst/fsrtpconference/fs-rtp-codec-negotiation.c
+++ b/gst/fsrtpconference/fs-rtp-codec-negotiation.c
@@ -1102,20 +1102,9 @@ codec_association_copy (CodecAssociation *ca)
   return newca;
 }
 
-/**
- * codec_associations_to_codecs:
- * @codec_associations: a #GList of #CodecAssociation
- * @include_config: whether to include the config data
- *
- * Returns a #GList of the #FsCodec that are inside the list of associations
- * excluding those that are disabled or otherwise receive-only. It copies
- * the #FsCodec structures.
- *
- * Returns: a #GList of #FsCodec
- */
 GList *
-codec_associations_to_codecs (GList *codec_associations,
-    gboolean include_config)
+codec_associations_to_codecs_internal (GList *codec_associations,
+    gboolean include_config, gboolean with_ptime)
 {
   GList *codecs = NULL;
   GList *item = NULL;
@@ -1133,6 +1122,11 @@ codec_associations_to_codecs (GList *codec_associations,
         codec = fs_codec_copy (ca->codec);
       else
         codec = codec_copy_without_config (ca->codec);
+      if (with_ptime)
+      {
+        codec->ABI.ABI.ptime = ca->ptime;
+        codec->ABI.ABI.maxptime = ca->maxptime;
+      }
       codecs = g_list_append (codecs, codec);
     }
   }
@@ -1140,6 +1134,47 @@ codec_associations_to_codecs (GList *codec_associations,
   return codecs;
 }
 
+
+/**
+ * codec_associations_to_codecs:
+ * @codec_associations: a #GList of #CodecAssociation
+ * @include_config: whether to include the config data
+ *
+ * Returns a #GList of the #FsCodec that are inside the list of associations
+ * excluding those that are disabled or otherwise receive-only. It copies
+ * the #FsCodec structures.
+ *
+ * Returns: a #GList of #FsCodec
+ */
+GList *
+codec_associations_to_codecs (GList *codec_associations,
+    gboolean include_config)
+{
+  return codec_associations_to_codecs_internal (codec_associations,
+      include_config, FALSE);
+}
+
+
+
+/**
+ * codec_associations_to_codecs_with_ptime:
+ * @codec_associations: a #GList of #CodecAssociation
+ *
+ * Returns a #GList of the #FsCodec that are inside the list of associations
+ * excluding those that are disabled or otherwise receive-only. It copies
+ * the #FsCodec structures, but takes the ptime and maxptime from the
+ * CodecAssociation. So it includes the ptime and maxptime that must be used
+ * for sending.
+ *
+ * Returns: a #GList of #FsCodec
+ */
+GList *
+codec_associations_to_codecs_with_ptime (GList *codec_associations)
+{
+  return codec_associations_to_codecs_internal (codec_associations,
+      FALSE, TRUE);
+}
+
 gboolean
 codec_association_is_valid_for_sending (CodecAssociation *ca,
     gboolean needs_codecbin)
diff --git a/gst/fsrtpconference/fs-rtp-codec-negotiation.h b/gst/fsrtpconference/fs-rtp-codec-negotiation.h
index e12c203..c7bc0e2 100644
--- a/gst/fsrtpconference/fs-rtp-codec-negotiation.h
+++ b/gst/fsrtpconference/fs-rtp-codec-negotiation.h
@@ -103,6 +103,9 @@ GList *
 codec_associations_to_codecs (GList *codec_associations,
     gboolean include_config);
 
+GList *
+codec_associations_to_codecs_with_ptime (GList *codec_associations);
+
 gboolean
 codec_associations_list_are_equal (GList *list1, GList *list2);
 
-- 
1.5.6.5




More information about the farsight-commits mailing list