[farsight2/master] Use the requested send codec if its valid
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 23 15:19:59 PST 2008
---
gst/fsrtpconference/fs-rtp-session.c | 32 ++++++++++++++++++++++++++++----
1 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/gst/fsrtpconference/fs-rtp-session.c b/gst/fsrtpconference/fs-rtp-session.c
index 65ab5e0..0bfe21a 100644
--- a/gst/fsrtpconference/fs-rtp-session.c
+++ b/gst/fsrtpconference/fs-rtp-session.c
@@ -1281,8 +1281,7 @@ fs_rtp_session_add_send_codec_bin (FsRtpSession *session, GError **error)
{
GstElement *codecbin = NULL;
gchar *name;
- FsCodec *codec = NULL;
- guint pt;
+ gint pt = -1;
FS_RTP_SESSION_LOCK (session);
if (!session->priv->negotiated_codecs)
@@ -1293,8 +1292,33 @@ fs_rtp_session_add_send_codec_bin (FsRtpSession *session, GError **error)
return FALSE;
}
- codec = g_list_first (session->priv->negotiated_codecs)->data;
- pt = codec->id;
+ if (session->priv->requested_send_codec) {
+ GList *elem = NULL;
+
+ for (elem = g_list_first (session->priv->negotiated_codecs);
+ elem;
+ elem = g_list_next (elem))
+ if (fs_codec_are_equal (elem->data, session->priv->requested_send_codec))
+ break;
+
+ if (elem)
+ {
+ FsCodec *codec = elem->data;
+ pt = codec->id;
+ }
+ else
+ {
+ /* The requested send codec no longer exists */
+ fs_codec_destroy (session->priv->requested_send_codec);
+ session->priv->requested_send_codec = NULL;
+ }
+ }
+
+ if (pt < 0)
+ {
+ FsCodec *codec = g_list_first (session->priv->negotiated_codecs)->data;
+ pt = codec->id;
+ }
FS_RTP_SESSION_UNLOCK (session);
name = g_strdup_printf ("send%d", pt);
--
1.5.6.5
More information about the farsight-commits
mailing list