[farsight2/master] rtpcodecnego: Negotiate the ptime/maxptime

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


---
 gst/fsrtpconference/fs-rtp-codec-negotiation.c |   15 +++++++++++++++
 gst/fsrtpconference/fs-rtp-codec-negotiation.h |    3 +++
 gst/fsrtpconference/fs-rtp-specific-nego.c     |    3 +++
 3 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-codec-negotiation.c b/gst/fsrtpconference/fs-rtp-codec-negotiation.c
index 3c29cba..27a177c 100644
--- a/gst/fsrtpconference/fs-rtp-codec-negotiation.c
+++ b/gst/fsrtpconference/fs-rtp-codec-negotiation.c
@@ -613,6 +613,8 @@ create_local_codec_associations (
           memcpy (ca, oldca, sizeof (CodecAssociation));
           codec_remove_parameter (codec, SEND_PROFILE_ARG);
           codec_remove_parameter (codec, RECV_PROFILE_ARG);
+          codec->ABI.ABI.maxptime = codec_pref->ABI.ABI.maxptime;
+          codec->ABI.ABI.ptime = codec_pref->ABI.ABI.ptime;
           ca->codec = codec;
 
           ca->send_profile = dup_param_value (codec_pref, SEND_PROFILE_ARG);
@@ -884,6 +886,19 @@ negotiate_stream_codecs (
       new_ca->blueprint = old_ca->blueprint;
       new_ca->send_profile = g_strdup (old_ca->send_profile);
       new_ca->recv_profile = g_strdup (old_ca->recv_profile);
+      if (remote_codec->ABI.ABI.ptime && old_ca->ptime)
+        new_ca->ptime = MIN (remote_codec->ABI.ABI.ptime, old_ca->ptime);
+      else if (remote_codec->ABI.ABI.ptime)
+        new_ca->ptime = remote_codec->ABI.ABI.ptime;
+      else if (old_ca->ptime)
+        new_ca->ptime = old_ca->ptime;
+      if (remote_codec->ABI.ABI.maxptime && old_ca->maxptime)
+        new_ca->maxptime = MIN (remote_codec->ABI.ABI.maxptime,
+            old_ca->maxptime);
+      else if (remote_codec->ABI.ABI.maxptime)
+        new_ca->maxptime = remote_codec->ABI.ABI.maxptime;
+      else if (old_ca->maxptime)
+        new_ca->maxptime = old_ca->maxptime;
       tmp = fs_codec_to_string (nego_codec);
       GST_DEBUG ("Negotiated codec %s", tmp);
       g_free (tmp);
diff --git a/gst/fsrtpconference/fs-rtp-codec-negotiation.h b/gst/fsrtpconference/fs-rtp-codec-negotiation.h
index c7bc0e2..2ad7317 100644
--- a/gst/fsrtpconference/fs-rtp-codec-negotiation.h
+++ b/gst/fsrtpconference/fs-rtp-codec-negotiation.h
@@ -53,6 +53,9 @@ typedef struct _CodecAssociation {
   gchar *send_profile;
   gchar *recv_profile;
 
+  guint ptime;
+  guint maxptime;
+
   /*< private >*/
 
   gboolean reserved;
diff --git a/gst/fsrtpconference/fs-rtp-specific-nego.c b/gst/fsrtpconference/fs-rtp-specific-nego.c
index 812f73d..c241d62 100644
--- a/gst/fsrtpconference/fs-rtp-specific-nego.c
+++ b/gst/fsrtpconference/fs-rtp-specific-nego.c
@@ -235,6 +235,9 @@ sdp_is_compat_default (FsCodec *local_codec, FsCodec *remote_codec,
 
   negotiated_codec = codec_copy_without_config (remote_codec);
 
+  negotiated_codec->ABI.ABI.ptime = local_codec->ABI.ABI.ptime;
+  negotiated_codec->ABI.ABI.maxptime = local_codec->ABI.ABI.maxptime;
+
   /* Lets fix here missing clock rates and channels counts */
   if (negotiated_codec->channels == 0 && local_codec->channels)
     negotiated_codec->channels = local_codec->channels;
-- 
1.5.6.5




More information about the farsight-commits mailing list