[farsight2/master] Add remote_codecs implementation to the FsRtpStream

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


---
 gst/fsrtpconference/fs-rtp-session.h |    4 ++++
 gst/fsrtpconference/fs-rtp-stream.c  |   26 +++++++++++++++++++++++++-
 2 files changed, 29 insertions(+), 1 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-session.h b/gst/fsrtpconference/fs-rtp-session.h
index 01f5e68..0c712ac 100644
--- a/gst/fsrtpconference/fs-rtp-session.h
+++ b/gst/fsrtpconference/fs-rtp-session.h
@@ -90,6 +90,10 @@ void fs_rtp_session_link_network_sink (FsRtpSession *session, GstPad *pad);
 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);
+
+
 
 G_END_DECLS
 
diff --git a/gst/fsrtpconference/fs-rtp-stream.c b/gst/fsrtpconference/fs-rtp-stream.c
index 2c8ebab..75d9884 100644
--- a/gst/fsrtpconference/fs-rtp-stream.c
+++ b/gst/fsrtpconference/fs-rtp-stream.c
@@ -70,6 +70,8 @@ struct _FsRtpStreamPrivate
 
   guint ssrc;
 
+  GList *remote_codecs;
+
   GError *construction_error;
 
   gboolean disposed;
@@ -252,6 +254,11 @@ fs_rtp_stream_dispose (GObject *object)
 static void
 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);
+
   parent_class->finalize (object);
 }
 
@@ -267,6 +274,9 @@ fs_rtp_stream_get_property (GObject *object,
     case PROP_ID:
       g_value_set_uint (value, self->priv->ssrc);
       break;
+    case PROP_REMOTE_CODECS:
+      g_value_set_boxed (value, self->priv->remote_codecs);
+      break;
     case PROP_SESSION:
       g_value_set_object (value, self->priv->session);
       break;
@@ -439,7 +449,21 @@ static gboolean
 fs_rtp_stream_set_remote_codecs (FsStream *stream,
                                  GList *remote_codecs, GError **error)
 {
-  return FALSE;
+  FsRtpStream *self = FS_RTP_STREAM (stream);
+
+  if (remote_codecs == NULL) {
+    g_set_error (error, FS_ERROR, FS_ERROR_INVALID_ARGUMENTS,
+      "You can not set NULL remote codecs");
+    return FALSE;
+  }
+
+  if (fs_rtp_session_negotiate_codecs (self->priv->session, remote_codecs,
+      error)) {
+    self->priv->remote_codecs = fs_codec_list_copy (remote_codecs);
+    return TRUE;
+  } else {
+    return FALSE;
+  }
 }
 
 
-- 
1.5.6.5




More information about the farsight-commits mailing list