[farsight2/master] Keep the discovered codec config when re-negotiating

Olivier Crête olivier.crete at collabora.co.uk
Mon Mar 16 09:21:49 PDT 2009


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

diff --git a/gst/fsrtpconference/fs-rtp-codec-negotiation.c b/gst/fsrtpconference/fs-rtp-codec-negotiation.c
index 8925ece..a0ac662 100644
--- a/gst/fsrtpconference/fs-rtp-codec-negotiation.c
+++ b/gst/fsrtpconference/fs-rtp-codec-negotiation.c
@@ -928,6 +928,9 @@ negotiate_stream_codecs (
  * It also adds a marker to the list for every previously disabled codec so
  * they're not re-used.
  *
+ * It also keeps the old discovered codec parameters if the other parameters
+ * are the same.
+ *
  * Returns: a modified list of #CodecAssociation
  */
 
@@ -937,6 +940,7 @@ finish_codec_negotiation (
     GList *new_codec_associations)
 {
   int i;
+  GList *item;
 
   /* Now, lets fill all of the PTs that were previously used in the session
    * even if they are not currently used, so they can't be re-used
@@ -963,6 +967,35 @@ finish_codec_negotiation (
     }
   }
 
+  for (item = new_codec_associations; item; item = g_list_next (item))
+  {
+    CodecAssociation *new_ca = item->data;
+    CodecAssociation *old_ca = NULL;
+
+    if (new_ca->disable || new_ca->reserved || new_ca->recv_only)
+    {
+      new_ca->need_config = FALSE;
+      continue;
+    }
+
+    old_ca = lookup_codec_association_by_pt (old_codec_associations,
+        new_ca->codec->id);
+
+    if (old_ca)
+    {
+      FsCodec *old_without_config = codec_copy_without_config (old_ca->codec);
+
+      if (fs_codec_are_equal (new_ca->codec, old_without_config))
+      {
+        fs_codec_destroy (new_ca->codec);
+        new_ca->codec = fs_codec_copy (old_ca->codec);
+        new_ca->need_config = codec_needs_config (new_ca->codec);
+      }
+
+      fs_codec_destroy (old_without_config);
+    }
+  }
+
   return new_codec_associations;
 }
 
-- 
1.5.6.5




More information about the farsight-commits mailing list