[farsight2/master] Only verify the old codec associations if they exist

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


---
 gst/fsrtpconference/fs-rtp-session.c |   68 ++++++++++++++++++----------------
 1 files changed, 36 insertions(+), 32 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-session.c b/gst/fsrtpconference/fs-rtp-session.c
index 1581688..daca09c 100644
--- a/gst/fsrtpconference/fs-rtp-session.c
+++ b/gst/fsrtpconference/fs-rtp-session.c
@@ -1398,41 +1398,45 @@ fs_rtp_session_negotiate_codecs (FsRtpSession *session, GList *remote_codecs,
     &new_negotiated_codecs);
 
   if (new_negotiated_codec_associations) {
-    gboolean is_new = FALSE;
-    gboolean clear_pts = FALSE;
-    int pt;
-
-    is_new = _compare_codec_lists (session->priv->negotiated_codecs,
-      new_negotiated_codecs);
-
-    /* Lets remove the codec bin for any PT that has changed type */
-    for (pt = 0; pt < 128; pt++) {
-      CodecAssociation *old_codec_association = g_hash_table_lookup (
-          session->priv->negotiated_codec_associations, GINT_TO_POINTER (pt));
-      CodecAssociation *new_codec_association = g_hash_table_lookup (
-          new_negotiated_codec_associations, GINT_TO_POINTER (pt));
-
-      if (old_codec_association == NULL && new_codec_association == NULL)
-        continue;
-
-      if (old_codec_association == NULL || new_codec_association == NULL) {
-        fs_rtp_session_invalidate_pt (session, pt, NULL);
-        clear_pts = TRUE;
-        continue;
-      }
+    gboolean is_new = TRUE;
+
+    if (session->priv->negotiated_codecs)
+    {
+      gboolean clear_pts = FALSE;
+      int pt;
+
+      is_new = _compare_codec_lists (session->priv->negotiated_codecs,
+          new_negotiated_codecs);
+
+      /* Lets remove the codec bin for any PT that has changed type */
+      for (pt = 0; pt < 128; pt++) {
+        CodecAssociation *old_codec_association = g_hash_table_lookup (
+            session->priv->negotiated_codec_associations, GINT_TO_POINTER (pt));
+        CodecAssociation *new_codec_association = g_hash_table_lookup (
+            new_negotiated_codec_associations, GINT_TO_POINTER (pt));
+
+        if (old_codec_association == NULL && new_codec_association == NULL)
+          continue;
+
+        if (old_codec_association == NULL || new_codec_association == NULL) {
+          fs_rtp_session_invalidate_pt (session, pt, NULL);
+          clear_pts = TRUE;
+          continue;
+        }
 
-      if (!fs_codec_are_equal (old_codec_association->codec,
-              new_codec_association->codec)) {
-        fs_rtp_session_invalidate_pt (session, pt,
-            new_codec_association->codec);
-        clear_pts = TRUE;
-        continue;
+        if (!fs_codec_are_equal (old_codec_association->codec,
+                new_codec_association->codec)) {
+          fs_rtp_session_invalidate_pt (session, pt,
+              new_codec_association->codec);
+          clear_pts = TRUE;
+          continue;
+        }
       }
-    }
 
-    if (clear_pts)
-      g_signal_emit_by_name (session->priv->conference->gstrtpbin,
-        "clear-pt-map");
+      if (clear_pts)
+        g_signal_emit_by_name (session->priv->conference->gstrtpbin,
+            "clear-pt-map");
+    }
 
     if (session->priv->negotiated_codec_associations)
       g_hash_table_destroy (session->priv->negotiated_codec_associations);
-- 
1.5.6.5




More information about the farsight-commits mailing list