[farsight2/master] Re-use existing (even disabled) codec associations when regenerating new ones

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


---
 gst/fsrtpconference/fs-rtp-codec-negotiation.c |   34 +++++++++++++++++++++++-
 1 files changed, 33 insertions(+), 1 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-codec-negotiation.c b/gst/fsrtpconference/fs-rtp-codec-negotiation.c
index 6a03e4e..53090fb 100644
--- a/gst/fsrtpconference/fs-rtp-codec-negotiation.c
+++ b/gst/fsrtpconference/fs-rtp-codec-negotiation.c
@@ -451,7 +451,8 @@ create_local_codec_associations (
   for (bp_e = g_list_first (blueprints); bp_e; bp_e = g_list_next (bp_e)) {
     CodecBlueprint *bp = bp_e->data;
     CodecAssociation *ca = NULL;
-    GList *tmpca_e;
+    GList *tmpca_e = NULL;
+    gboolean next = FALSE;
 
     /* Lets skip codecs that dont have all of the required informations */
     if (bp->codec->clock_rate == 0)
@@ -478,6 +479,37 @@ create_local_codec_associations (
       continue;
     }
 
+    /* Re-use already existing codec associations with this blueprint
+     * if any, we only keep the PT from the old assoc
+     * (the rest will be regenerated by the renegotiation)
+     */
+    for (tmpca_e = current_codec_associations;
+         tmpca_e;
+         tmpca_e = g_list_next (tmpca_e))
+    {
+      CodecAssociation *tmpca = tmpca_e->data;
+      if (tmpca->blueprint == bp)
+      {
+        /* Ignore reserved (we've just regenerated them )*/
+        if (tmpca->reserved)
+          continue;
+
+        /* Ignore it if there is already something for this PT */
+        if (lookup_codec_association_by_pt_list (codec_associations,
+                tmpca->codec->id, TRUE))
+          continue;
+
+        ca = g_slice_new0 (CodecAssociation);
+        ca->blueprint = bp;
+        ca->codec = fs_codec_copy (bp->codec);
+        ca->codec->id = tmpca->codec->id;
+        codec_associations = g_list_append (codec_associations, ca);
+        next = TRUE;
+      }
+    }
+    if (next)
+      continue;
+
     ca = g_slice_new0 (CodecAssociation);
     ca->blueprint = bp;
     ca->codec = fs_codec_copy (bp->codec);
-- 
1.5.6.5




More information about the farsight-commits mailing list