[farsight2/master] Make the multi-party negotiation really prioritize the local pt only when multiple streams has remote codecs, make the remote_codecs a public member
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 23 15:21:13 PST 2008
---
gst/fsrtpconference/fs-rtp-session.c | 22 +++++++++++++++++-----
gst/fsrtpconference/fs-rtp-session.h | 4 +++-
gst/fsrtpconference/fs-rtp-stream.c | 14 +++++---------
gst/fsrtpconference/fs-rtp-stream.h | 5 +++++
4 files changed, 30 insertions(+), 15 deletions(-)
diff --git a/gst/fsrtpconference/fs-rtp-session.c b/gst/fsrtpconference/fs-rtp-session.c
index da23753..47916ed 100644
--- a/gst/fsrtpconference/fs-rtp-session.c
+++ b/gst/fsrtpconference/fs-rtp-session.c
@@ -1560,17 +1560,29 @@ _compare_codec_lists (GList *list1, GList *list2)
*/
gboolean
-fs_rtp_session_negotiate_codecs (FsRtpSession *session, GList *remote_codecs,
- GError **error)
+fs_rtp_session_negotiate_codecs (FsRtpSession *session,
+ GList *remote_codecs,
+ gpointer stream,
+ GError **error)
{
- gboolean has_many_streams;
+ gboolean has_many_streams = FALSE;
GHashTable *new_negotiated_codec_associations = NULL;;
GList *new_negotiated_codecs = NULL;
+ GList *item;
FS_RTP_SESSION_LOCK (session);
- has_many_streams =
- (g_list_next (g_list_first (session->priv->streams)) != NULL);
+ for (item = g_list_first (session->priv->streams);
+ item;
+ item = g_list_next (item))
+ {
+ FsRtpStream *mystream = item->data;
+ if (stream != mystream && mystream->remote_codecs)
+ {
+ has_many_streams = TRUE;
+ break;
+ }
+ }
new_negotiated_codec_associations = negotiate_codecs (remote_codecs,
session->priv->negotiated_codec_associations,
diff --git a/gst/fsrtpconference/fs-rtp-session.h b/gst/fsrtpconference/fs-rtp-session.h
index 7445b2b..06cce1f 100644
--- a/gst/fsrtpconference/fs-rtp-session.h
+++ b/gst/fsrtpconference/fs-rtp-session.h
@@ -93,7 +93,9 @@ void fs_rtp_session_new_recv_pad (FsRtpSession *session, GstPad *new_pad,
guint32 ssrc, guint pt);
gboolean fs_rtp_session_negotiate_codecs (FsRtpSession *session,
- GList *remote_codecs, GError **error);
+ GList *remote_codecs,
+ gpointer stream,
+ GError **error);
GstElement *fs_rtp_session_new_recv_codec_bin_locked (FsRtpSession *session,
guint32 ssrc,
diff --git a/gst/fsrtpconference/fs-rtp-stream.c b/gst/fsrtpconference/fs-rtp-stream.c
index fb74478..2a2f610 100644
--- a/gst/fsrtpconference/fs-rtp-stream.c
+++ b/gst/fsrtpconference/fs-rtp-stream.c
@@ -67,10 +67,6 @@ struct _FsRtpStreamPrivate
FsStreamDirection direction;
- guint id;
-
- GList *remote_codecs;
-
/* Protected by the session mutex */
GList *substreams;
guint recv_codecs_changed_idle_id;
@@ -252,8 +248,8 @@ fs_rtp_stream_finalize (GObject *object)
{
FsRtpStream *self = FS_RTP_STREAM (object);
- if (self->priv->remote_codecs)
- fs_codec_list_destroy (self->priv->remote_codecs);
+ if (self->remote_codecs)
+ fs_codec_list_destroy (self->remote_codecs);
parent_class->finalize (object);
}
@@ -281,7 +277,7 @@ fs_rtp_stream_get_property (GObject *object,
switch (prop_id) {
case PROP_REMOTE_CODECS:
- g_value_set_boxed (value, self->priv->remote_codecs);
+ g_value_set_boxed (value, self->remote_codecs);
break;
case PROP_SESSION:
g_value_set_object (value, self->priv->session);
@@ -521,8 +517,8 @@ fs_rtp_stream_set_remote_codecs (FsStream *stream,
}
if (fs_rtp_session_negotiate_codecs (self->priv->session, remote_codecs,
- error)) {
- self->priv->remote_codecs = fs_codec_list_copy (remote_codecs);
+ stream, error)) {
+ self->remote_codecs = fs_codec_list_copy (remote_codecs);
return TRUE;
} else {
return FALSE;
diff --git a/gst/fsrtpconference/fs-rtp-stream.h b/gst/fsrtpconference/fs-rtp-stream.h
index 46b6cd5..a3916aa 100644
--- a/gst/fsrtpconference/fs-rtp-stream.h
+++ b/gst/fsrtpconference/fs-rtp-stream.h
@@ -66,6 +66,11 @@ struct _FsRtpStreamClass
struct _FsRtpStream
{
FsStream parent;
+
+ /* Can only be accessed by main user thread */
+ /* Dont modify, call set_remote_codecs() */
+ GList *remote_codecs;
+
FsRtpStreamPrivate *priv;
};
--
1.5.6.5
More information about the farsight-commits
mailing list