[farsight2/master] Also the the gst debug messaging for the codec negotiation

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


---
 gst/fsrtpconference/fs-rtp-codec-negotiation.c |   23 +++++++-----
 gst/fsrtpconference/fs-rtp-conference.c        |    3 ++
 gst/fsrtpconference/fs-rtp-conference.h        |    1 +
 gst/fsrtpconference/fs-rtp-specific-nego.c     |   47 ++++++++++++++----------
 4 files changed, 45 insertions(+), 29 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-codec-negotiation.c b/gst/fsrtpconference/fs-rtp-codec-negotiation.c
index b515e12..ee0c7fd 100644
--- a/gst/fsrtpconference/fs-rtp-codec-negotiation.c
+++ b/gst/fsrtpconference/fs-rtp-codec-negotiation.c
@@ -26,6 +26,10 @@
 
 #include "fs-rtp-specific-nego.h"
 
+#include "fs-rtp-conference.h"
+
+#define GST_CAT_DEFAULT fsrtpconference_nego
+
 /**
  * validate_codecs_configuration:
  * @media_type: The #FsMediaType these codecs should be for
@@ -113,7 +117,8 @@ validate_codecs_configuration (FsMediaType media_type, GList *blueprints,
     {
       GList *nextcodec_e = g_list_next (codec_e);
       gchar *tmp = fs_codec_to_string (codec);
-      g_debug ("Prefered codec %s could not be matched with a blueprint", tmp);
+      GST_DEBUG ("Prefered codec %s could not be matched with a blueprint",
+          tmp);
       g_free (tmp);
       fs_codec_destroy (codec);
       codecs = g_list_delete_link (codecs, codec_e);
@@ -335,7 +340,7 @@ GHashTable *create_local_codec_associations (FsMediaType media_type,
       lca->codec->id = _find_first_empty_dynamic_entry (
           current_codec_associations, codec_associations);
       if (lca->codec->id < 0) {
-        g_warning ("We've run out of dynamic payload types");
+        GST_WARNING ("We've run out of dynamic payload types");
         goto out;
       }
     }
@@ -366,7 +371,7 @@ GHashTable *create_local_codec_associations (FsMediaType media_type,
     /* Check if it is disabled in the list of prefered codecs */
     if (_is_disabled (codec_prefs, bp)) {
       gchar *tmp = fs_codec_to_string (bp->codec);
-      g_debug ("Codec %s disabled by config", tmp);
+      GST_DEBUG ("Codec %s disabled by config", tmp);
       g_free (tmp);
       continue;
     }
@@ -379,7 +384,7 @@ GHashTable *create_local_codec_associations (FsMediaType media_type,
       ca->codec->id = _find_first_empty_dynamic_entry (
           current_codec_associations, codec_associations);
       if (ca->codec->id < 0) {
-        g_warning ("We've run out of dynamic payload types");
+        GST_WARNING ("We've run out of dynamic payload types");
         goto out;
       }
     }
@@ -416,7 +421,7 @@ GHashTable *create_local_codec_associations (FsMediaType media_type,
   if (!local_codecs) {
     g_hash_table_destroy (codec_associations);
     codec_associations = NULL;
-    g_debug ("There are no local codecs for this stream of media type %s",
+    GST_DEBUG ("There are no local codecs for this stream of media type %s",
         fs_media_type_to_string (media_type));
   }
 
@@ -485,7 +490,7 @@ negotiate_codecs (const GList *remote_codecs,
     CodecAssociation *local_ca = NULL;
 
     gchar *tmp = fs_codec_to_string (remote_codec);
-    g_debug ("Remote codec %s", tmp);
+    GST_DEBUG ("Remote codec %s", tmp);
     g_free (tmp);
 
     /* First lets try the codec that is in the same PT */
@@ -494,7 +499,7 @@ negotiate_codecs (const GList *remote_codecs,
       remote_codec->id);
 
     if (local_ca) {
-      g_debug ("Have local codec in the same PT, lets try it first");
+      GST_DEBUG ("Have local codec in the same PT, lets try it first");
       nego_codec = sdp_is_compat (local_ca->blueprint->rtp_caps,
           local_ca->codec, remote_codec);
     }
@@ -523,7 +528,7 @@ negotiate_codecs (const GList *remote_codecs,
       new_ca->codec = fs_codec_copy (nego_codec);
       new_ca->blueprint = local_ca->blueprint;
       tmp = fs_codec_to_string (nego_codec);
-      g_debug ("Negotiated codec %s", tmp);
+      GST_DEBUG ("Negotiated codec %s", tmp);
       g_free (tmp);
 
       g_hash_table_insert (new_codec_associations,
@@ -532,7 +537,7 @@ negotiate_codecs (const GList *remote_codecs,
           fs_codec_copy (new_ca->codec));
     } else {
       gchar *tmp = fs_codec_to_string (remote_codec);
-      g_debug ("Could not find a valid intersection... for codec %s",
+      GST_DEBUG ("Could not find a valid intersection... for codec %s",
                  tmp);
       g_free (tmp);
       g_hash_table_insert (new_codec_associations,
diff --git a/gst/fsrtpconference/fs-rtp-conference.c b/gst/fsrtpconference/fs-rtp-conference.c
index 529a44c..38f9991 100644
--- a/gst/fsrtpconference/fs-rtp-conference.c
+++ b/gst/fsrtpconference/fs-rtp-conference.c
@@ -42,6 +42,7 @@
 
 GST_DEBUG_CATEGORY_STATIC (fsrtpconference_debug);
 GST_DEBUG_CATEGORY (fsrtpconference_disco);
+GST_DEBUG_CATEGORY (fsrtpconference_nego);
 #define GST_CAT_DEFAULT fsrtpconference_debug
 
 /* Signals */
@@ -132,6 +133,8 @@ fs_rtp_conference_do_init (GType type)
       "Farsight RTP Conference Element");
   GST_DEBUG_CATEGORY_INIT (fsrtpconference_disco, "fsrtpconference_disco",
       0, "Farsight RTP Codec Discovery");
+  GST_DEBUG_CATEGORY_INIT (fsrtpconference_nego, "fsrtpconference_nego",
+      0, "Farsight RTP Codec Negotiation");
 }
 
 static void
diff --git a/gst/fsrtpconference/fs-rtp-conference.h b/gst/fsrtpconference/fs-rtp-conference.h
index d3e557b..a02c49d 100644
--- a/gst/fsrtpconference/fs-rtp-conference.h
+++ b/gst/fsrtpconference/fs-rtp-conference.h
@@ -68,6 +68,7 @@ GType fs_rtp_conference_get_type(void);
 
 
 GST_DEBUG_CATEGORY_EXTERN (fsrtpconference_disco);
+GST_DEBUG_CATEGORY_EXTERN (fsrtpconference_nego);
 
 G_END_DECLS
 
diff --git a/gst/fsrtpconference/fs-rtp-specific-nego.c b/gst/fsrtpconference/fs-rtp-specific-nego.c
index 7d4dc5f..54ed0d9 100644
--- a/gst/fsrtpconference/fs-rtp-specific-nego.c
+++ b/gst/fsrtpconference/fs-rtp-specific-nego.c
@@ -28,6 +28,10 @@
 
 #include "fs-rtp-specific-nego.h"
 
+#include "fs-rtp-conference.h"
+
+#define GST_CAT_DEFAULT fsrtpconference_nego
+
 struct SdpCompatCheck {
   FsMediaType media_type;
   const gchar *encoding_name;
@@ -65,14 +69,14 @@ sdp_is_compat (GstCaps *rtp_caps, FsCodec *local_codec,
   g_assert (rtp_caps);
 
   if (local_codec->media_type != remote_codec->media_type) {
-    g_debug ("Wrong media type, local: %s, remote: %s",
+    GST_DEBUG ("Wrong media type, local: %s, remote: %s",
         fs_media_type_to_string (local_codec->media_type),
         fs_media_type_to_string (remote_codec->media_type));
     return NULL;
   }
   if (g_ascii_strcasecmp (local_codec->encoding_name,
         remote_codec->encoding_name)) {
-    g_debug ("Encoding names dont match, local: %s, remote: %s",
+    GST_DEBUG ("Encoding names dont match, local: %s, remote: %s",
         local_codec->encoding_name, remote_codec->encoding_name);
     return NULL;
   }
@@ -96,18 +100,19 @@ sdp_is_compat_default (GstCaps *rtp_caps, FsCodec *local_codec,
   FsCodec *negotiated_codec = NULL;
   GList *local_param_list = NULL, *negotiated_param_list = NULL;
 
-  g_debug ("Using default codec negotiation function");
+  GST_DEBUG ("Using default codec negotiation function");
 
   if (remote_codec->clock_rate &&
       local_codec->clock_rate != remote_codec->clock_rate) {
-    g_debug ("Clock rates differ local=%u remote=%u", local_codec->clock_rate,
+    GST_DEBUG ("Clock rates differ local=%u remote=%u", local_codec->clock_rate,
         remote_codec->clock_rate);
     return NULL;
   }
 
   if (local_codec->channels && remote_codec->channels &&
       local_codec->channels != remote_codec->channels) {
-    g_debug ("Channel counts differ local=%u remote=%u", local_codec->channels,
+    GST_DEBUG ("Channel counts differ local=%u remote=%u",
+        local_codec->channels,
         remote_codec->channels);
     return NULL;
   }
@@ -133,7 +138,7 @@ sdp_is_compat_default (GstCaps *rtp_caps, FsCodec *local_codec,
         if (!strcmp (local_param->value, negotiated_param->value)) {
           break;
         } else {
-          g_debug ("Different values for %s, local=%s remote=%s",
+          GST_DEBUG ("Different values for %s, local=%s remote=%s",
               local_param->name, local_param->value, negotiated_param->value);
           fs_codec_destroy (negotiated_codec);
           return NULL;
@@ -163,18 +168,19 @@ sdp_is_compat_ilbc (GstCaps *rtp_caps, FsCodec *local_codec,
   GList *mylistitem = NULL, *negotiated_param_list = NULL;
   gboolean has_mode = FALSE;
 
-  g_debug ("Using ilbc negotiation function");
+  GST_DEBUG ("Using ilbc negotiation function");
 
   if (remote_codec->clock_rate &&
       local_codec->clock_rate != remote_codec->clock_rate) {
-    g_debug ("Clock rates differ local=%u remote=%u", local_codec->clock_rate,
+    GST_DEBUG ("Clock rates differ local=%u remote=%u", local_codec->clock_rate,
         remote_codec->clock_rate);
     return NULL;
   }
 
   if (local_codec->channels && remote_codec->channels &&
       local_codec->channels != remote_codec->channels) {
-    g_debug ("Channel counts differ local=%u remote=%u", local_codec->channels,
+    GST_DEBUG ("Channel counts differ local=%u remote=%u",
+        local_codec->channels,
         remote_codec->channels);
     return NULL;
   }
@@ -205,7 +211,7 @@ sdp_is_compat_ilbc (GstCaps *rtp_caps, FsCodec *local_codec,
           has_mode = TRUE;
 
           if (remote_mode != 20 && remote_mode != 30) {
-            g_debug ("Invalid mode on ilbc");
+            GST_DEBUG ("Invalid mode on ilbc");
             goto failure;
           }
           if (local_mode != remote_mode) {
@@ -217,7 +223,7 @@ sdp_is_compat_ilbc (GstCaps *rtp_caps, FsCodec *local_codec,
           if (!strcmp (local_param->value, negotiated_param->value)) {
             break;
           } else {
-            g_debug ("Different values for %s, local=%s remote=%s",
+            GST_DEBUG ("Different values for %s, local=%s remote=%s",
                 local_param->name, local_param->value, negotiated_param->value);
             goto failure;
           }
@@ -254,8 +260,8 @@ sdp_is_compat_ilbc (GstCaps *rtp_caps, FsCodec *local_codec,
     }
   }
 
-  /* If we still can't find the mode anywhere, let's add it since it's mandatory
-   * and use default value of 30 ms */
+  /* If we still can't find the mode anywhere, let's add it since it's
+   *  mandatory and use default value of 30 ms */
   if (!has_mode) {
     FsCodecParameter *newparam = g_new0 (FsCodecParameter, 1);
     newparam->name = g_strdup ("mode");
@@ -283,17 +289,17 @@ sdp_is_compat_h263_1998 (GstCaps *rtp_caps, FsCodec *local_codec,
   GList *mylistitem = NULL, *remote_param_list = NULL;
   FsCodecParameter *profile = NULL;
 
-  g_debug ("Using H263-1998 negotiation function");
+  GST_DEBUG ("Using H263-1998 negotiation function");
 
   if (remote_codec->clock_rate != 90000) {
-    g_debug ("Remote clock rate is %d which is not 90000",
+    GST_DEBUG ("Remote clock rate is %d which is not 90000",
         remote_codec->clock_rate);
     return NULL;
   }
 
 
   if (remote_codec->channels > 1) {
-    g_debug ("Channel count  %d > 1", remote_codec->channels);
+    GST_DEBUG ("Channel count  %d > 1", remote_codec->channels);
     return NULL;
   }
 
@@ -307,7 +313,8 @@ sdp_is_compat_h263_1998 (GstCaps *rtp_caps, FsCodec *local_codec,
     if (!g_ascii_strcasecmp (remote_param->name, "profile")) {
 
       if (profile) {
-        g_debug ("The remote codecs contain the profile item more than once, ignoring");
+        GST_DEBUG ("The remote codecs contain the profile item more than once,"
+            " ignoring");
         return NULL;
       } else {
         profile = remote_param;
@@ -321,11 +328,11 @@ sdp_is_compat_h263_1998 (GstCaps *rtp_caps, FsCodec *local_codec,
         if (!g_ascii_strcasecmp (local_param->name, "profile")) {
 
           if (g_ascii_strcasecmp (local_param->value, remote_param->value)) {
-            g_debug ("Local (%s) and remote (%s) profiles are different",
+            GST_DEBUG ("Local (%s) and remote (%s) profiles are different",
                 local_param->value, remote_param->value);
             return NULL;
           } else {
-            g_debug ("We have the same profile, lets return our local codec");
+            GST_DEBUG ("We have the same profile, lets return our local codec");
 
             negotiated_codec = fs_codec_copy (local_codec);
 
@@ -335,7 +342,7 @@ sdp_is_compat_h263_1998 (GstCaps *rtp_caps, FsCodec *local_codec,
           }
         }
       }
-        g_debug ("Profile (%s) is unknown locally, rejecting",
+        GST_DEBUG ("Profile (%s) is unknown locally, rejecting",
             remote_param->value);
             return NULL;
     }
-- 
1.5.6.5




More information about the farsight-commits mailing list