[farsight2/master] Mark codecs for config retrieval from table

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


---
 gst/fsrtpconference/fs-rtp-codec-negotiation.c |   13 +++++++++++
 gst/fsrtpconference/fs-rtp-specific-nego.c     |   27 +++++++++++++++++++----
 gst/fsrtpconference/fs-rtp-specific-nego.h     |    3 ++
 3 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-codec-negotiation.c b/gst/fsrtpconference/fs-rtp-codec-negotiation.c
index 49180e8..7632940 100644
--- a/gst/fsrtpconference/fs-rtp-codec-negotiation.c
+++ b/gst/fsrtpconference/fs-rtp-codec-negotiation.c
@@ -535,6 +535,19 @@ create_local_codec_associations (
     codec_associations = g_list_append (codec_associations, ca);
   }
 
+  for (lca_e = codec_associations;
+       lca_e;
+       lca_e = g_list_next (lca_e))
+  {
+    CodecAssociation *ca = lca_e->data;
+
+    if (ca->reserved || ca->disable)
+      ca->need_config = FALSE;
+    else
+      ca->need_config= codec_needs_config (ca->codec);
+  }
+
+
   return codec_associations;
 
  error:
diff --git a/gst/fsrtpconference/fs-rtp-specific-nego.c b/gst/fsrtpconference/fs-rtp-specific-nego.c
index de607b9..2ff8828 100644
--- a/gst/fsrtpconference/fs-rtp-specific-nego.c
+++ b/gst/fsrtpconference/fs-rtp-specific-nego.c
@@ -41,6 +41,7 @@ struct SdpCompatCheck {
   FsMediaType media_type;
   const gchar *encoding_name;
   FsCodec * (* sdp_is_compat) (FsCodec *local_codec, FsCodec *remote_codec);
+  gboolean needs_config;
 };
 
 
@@ -52,17 +53,33 @@ static FsCodec *
 sdp_is_compat_theora_vorbis (FsCodec *local_codec, FsCodec *remote_codec);
 
 static struct SdpCompatCheck sdp_compat_checks[] = {
-  {FS_MEDIA_TYPE_AUDIO, "iLBC", sdp_is_compat_ilbc},
-  {FS_MEDIA_TYPE_VIDEO, "H263-1998", sdp_is_compat_h263_1998},
-  {FS_MEDIA_TYPE_AUDIO, "VORBIS", sdp_is_compat_theora_vorbis},
-  {FS_MEDIA_TYPE_VIDEO, "THEORA", sdp_is_compat_theora_vorbis},
+  {FS_MEDIA_TYPE_AUDIO, "iLBC", sdp_is_compat_ilbc, FALSE},
+  {FS_MEDIA_TYPE_VIDEO, "H263-1998", sdp_is_compat_h263_1998, FALSE},
+  {FS_MEDIA_TYPE_AUDIO, "VORBIS", sdp_is_compat_theora_vorbis, TRUE},
+  {FS_MEDIA_TYPE_VIDEO, "THEORA", sdp_is_compat_theora_vorbis, TRUE},
   {0, NULL, NULL}
 };
 
-
 static FsCodec *
 sdp_is_compat_default (FsCodec *local_codec, FsCodec *remote_codec);
 
+
+gboolean
+codec_needs_config (FsCodec *codec)
+{
+  gint i;
+
+  g_return_val_if_fail (codec, FALSE);
+
+  for (i = 0; sdp_compat_checks[i].sdp_is_compat; i++)
+    if (sdp_compat_checks[i].media_type == codec->media_type &&
+        !g_ascii_strcasecmp (sdp_compat_checks[i].encoding_name,
+            codec->encoding_name))
+      return sdp_compat_checks[i].needs_config;
+
+  return FALSE;
+}
+
 FsCodec *
 sdp_is_compat (FsCodec *local_codec, FsCodec *remote_codec)
 {
diff --git a/gst/fsrtpconference/fs-rtp-specific-nego.h b/gst/fsrtpconference/fs-rtp-specific-nego.h
index bd81a63..aea5d9a 100644
--- a/gst/fsrtpconference/fs-rtp-specific-nego.h
+++ b/gst/fsrtpconference/fs-rtp-specific-nego.h
@@ -34,6 +34,9 @@ G_BEGIN_DECLS
 FsCodec *
 sdp_is_compat (FsCodec *local_codec, FsCodec *remote_codec);
 
+gboolean
+codec_needs_config (FsCodec *codec);
+
 G_END_DECLS
 
 #endif
-- 
1.5.6.5




More information about the farsight-commits mailing list