[farsight2/master] Add parameter to sdp_is_compat to validate the configuration or not
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 23 15:23:15 PST 2008
---
gst/fsrtpconference/fs-rtp-codec-negotiation.c | 8 ++--
gst/fsrtpconference/fs-rtp-session.c | 2 +-
gst/fsrtpconference/fs-rtp-specific-nego.c | 40 +++++++++++++++--------
gst/fsrtpconference/fs-rtp-specific-nego.h | 3 +-
4 files changed, 33 insertions(+), 20 deletions(-)
diff --git a/gst/fsrtpconference/fs-rtp-codec-negotiation.c b/gst/fsrtpconference/fs-rtp-codec-negotiation.c
index bb32d2d..e7c2b59 100644
--- a/gst/fsrtpconference/fs-rtp-codec-negotiation.c
+++ b/gst/fsrtpconference/fs-rtp-codec-negotiation.c
@@ -270,7 +270,7 @@ match_original_codec_and_codec_pref (CodecAssociation *ca, gpointer user_data)
FsCodec *codec_pref = user_data;
FsCodec *tmpcodec = NULL;
- tmpcodec = sdp_is_compat (codec_pref, ca->codec);
+ tmpcodec = sdp_is_compat (codec_pref, ca->codec, FALSE);
if (tmpcodec)
fs_codec_destroy (tmpcodec);
@@ -365,7 +365,7 @@ create_local_codec_associations (
/* In this case, we have a matching codec association, lets keep it */
if (oldca)
{
- FsCodec *codec = sdp_is_compat (codec_pref, oldca->codec);
+ FsCodec *codec = sdp_is_compat (codec_pref, oldca->codec, FALSE);
if (codec)
{
GList *item = NULL;
@@ -611,7 +611,7 @@ negotiate_stream_codecs (
if (old_ca) {
GST_DEBUG ("Have local codec in the same PT, lets try it first");
- nego_codec = sdp_is_compat (old_ca->codec, remote_codec);
+ nego_codec = sdp_is_compat (old_ca->codec, remote_codec, TRUE);
}
if (!nego_codec) {
@@ -622,7 +622,7 @@ negotiate_stream_codecs (
{
old_ca = item->data;
- nego_codec = sdp_is_compat (old_ca->codec, remote_codec);
+ nego_codec = sdp_is_compat (old_ca->codec, remote_codec, TRUE);
if (nego_codec)
{
diff --git a/gst/fsrtpconference/fs-rtp-session.c b/gst/fsrtpconference/fs-rtp-session.c
index 189a5b5..8433b86 100644
--- a/gst/fsrtpconference/fs-rtp-session.c
+++ b/gst/fsrtpconference/fs-rtp-session.c
@@ -1771,7 +1771,7 @@ fs_rtp_session_distribute_recv_codecs (FsRtpSession *session,
FsCodec *tmpcodec = NULL;
remote_codec = item3->data;
- tmpcodec = sdp_is_compat (codec, remote_codec);
+ tmpcodec = sdp_is_compat (codec, remote_codec, TRUE);
if (tmpcodec)
{
fs_codec_destroy (tmpcodec);
diff --git a/gst/fsrtpconference/fs-rtp-specific-nego.c b/gst/fsrtpconference/fs-rtp-specific-nego.c
index af5a771..2cee6bc 100644
--- a/gst/fsrtpconference/fs-rtp-specific-nego.c
+++ b/gst/fsrtpconference/fs-rtp-specific-nego.c
@@ -45,20 +45,25 @@
struct SdpCompatCheck {
FsMediaType media_type;
const gchar *encoding_name;
- FsCodec * (* sdp_is_compat) (FsCodec *local_codec, FsCodec *remote_codec);
+ FsCodec * (* sdp_is_compat) (FsCodec *local_codec, FsCodec *remote_codec,
+ gboolean validate_config);
gchar *config_param[MAX_CONFIG_PARAMS];
};
static FsCodec *
-sdp_is_compat_default (FsCodec *local_codec, FsCodec *remote_codec);
+sdp_is_compat_default (FsCodec *local_codec, FsCodec *remote_codec,
+ gboolean validate_config);
static FsCodec *
-sdp_is_compat_ilbc (FsCodec *local_codec, FsCodec *remote_codec);
+sdp_is_compat_ilbc (FsCodec *local_codec, FsCodec *remote_codec,
+ gboolean validate_config);
static FsCodec *
-sdp_is_compat_h263_1998 (FsCodec *local_codec, FsCodec *remote_codec);
+sdp_is_compat_h263_1998 (FsCodec *local_codec, FsCodec *remote_codec,
+ gboolean validate_config);
static FsCodec *
-sdp_is_compat_vorbis (FsCodec *local_codec, FsCodec *remote_codec);
+sdp_is_compat_vorbis (FsCodec *local_codec, FsCodec *remote_codec,
+ gboolean validate_config);
static struct SdpCompatCheck sdp_compat_checks[] = {
{FS_MEDIA_TYPE_AUDIO, "iLBC", sdp_is_compat_ilbc,
@@ -162,7 +167,8 @@ codec_copy_without_config (FsCodec *codec)
FsCodec *
-sdp_is_compat (FsCodec *local_codec, FsCodec *remote_codec)
+sdp_is_compat (FsCodec *local_codec, FsCodec *remote_codec,
+ gboolean validate_config)
{
gint i;
@@ -189,15 +195,17 @@ sdp_is_compat (FsCodec *local_codec, FsCodec *remote_codec)
!g_ascii_strcasecmp (sdp_compat_checks[i].encoding_name,
remote_codec->encoding_name))
{
- return sdp_compat_checks[i].sdp_is_compat (local_codec, remote_codec);
+ return sdp_compat_checks[i].sdp_is_compat (local_codec, remote_codec,
+ validate_config);
}
}
- return sdp_is_compat_default (local_codec, remote_codec);
+ return sdp_is_compat_default (local_codec, remote_codec, validate_config);
}
static FsCodec *
-sdp_is_compat_default (FsCodec *local_codec, FsCodec *remote_codec)
+sdp_is_compat_default (FsCodec *local_codec, FsCodec *remote_codec,
+ gboolean validate_config)
{
FsCodec *negotiated_codec = NULL;
GList *local_param_list = NULL, *negotiated_param_list = NULL;
@@ -267,7 +275,8 @@ sdp_is_compat_default (FsCodec *local_codec, FsCodec *remote_codec)
}
static FsCodec *
-sdp_is_compat_ilbc (FsCodec *local_codec, FsCodec *remote_codec)
+sdp_is_compat_ilbc (FsCodec *local_codec, FsCodec *remote_codec,
+ gboolean validate_config)
{
FsCodec *negotiated_codec = NULL;
GList *mylistitem = NULL, *negotiated_param_list = NULL;
@@ -396,7 +405,8 @@ sdp_is_compat_ilbc (FsCodec *local_codec, FsCodec *remote_codec)
static FsCodec *
-sdp_is_compat_h263_1998 (FsCodec *local_codec, FsCodec *remote_codec)
+sdp_is_compat_h263_1998 (FsCodec *local_codec, FsCodec *remote_codec,
+ gboolean validate_config)
{
GList *mylistitem = NULL, *remote_param_list = NULL;
FsCodecParameter *profile = NULL;
@@ -473,10 +483,12 @@ sdp_is_compat_h263_1998 (FsCodec *local_codec, FsCodec *remote_codec)
static FsCodec *
-sdp_is_compat_vorbis (FsCodec *local_codec, FsCodec *remote_codec)
+sdp_is_compat_vorbis (FsCodec *local_codec, FsCodec *remote_codec,
+gboolean validate_config)
{
- if (!fs_codec_get_optional_parameter (remote_codec, "configuration", NULL))
+ if (validate_config &&
+ !fs_codec_get_optional_parameter (remote_codec, "configuration", NULL))
return NULL;
- return sdp_is_compat_default (local_codec, remote_codec);
+ return sdp_is_compat_default (local_codec, remote_codec, validate_config);
}
diff --git a/gst/fsrtpconference/fs-rtp-specific-nego.h b/gst/fsrtpconference/fs-rtp-specific-nego.h
index 9bb0249..be7630d 100644
--- a/gst/fsrtpconference/fs-rtp-specific-nego.h
+++ b/gst/fsrtpconference/fs-rtp-specific-nego.h
@@ -32,7 +32,8 @@
G_BEGIN_DECLS
FsCodec *
-sdp_is_compat (FsCodec *local_codec, FsCodec *remote_codec);
+sdp_is_compat (FsCodec *local_codec, FsCodec *remote_codec,
+ gboolean validate_config);
gboolean
codec_needs_config (FsCodec *codec);
--
1.5.6.5
More information about the farsight-commits
mailing list