[farsight2/master] Implement the negotiated-codecs property in FsRtpStream

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


---
 gst/fsrtpconference/fs-rtp-stream.c |   48 +++++++++++++++++++++++++++++++++++
 gst/fsrtpconference/fs-rtp-stream.h |    3 ++
 2 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-stream.c b/gst/fsrtpconference/fs-rtp-stream.c
index f43f165..7c4a3cd 100644
--- a/gst/fsrtpconference/fs-rtp-stream.c
+++ b/gst/fsrtpconference/fs-rtp-stream.c
@@ -53,6 +53,7 @@ enum
   PROP_SOURCE_PADS,
 #endif
   PROP_REMOTE_CODECS,
+  PROP_NEGOTIATED_CODECS,
   PROP_CURRENT_RECV_CODECS,
   PROP_DIRECTION,
   PROP_PARTICIPANT,
@@ -71,6 +72,8 @@ struct _FsRtpStreamPrivate
   /* Protected by the session mutex */
   guint recv_codecs_changed_idle_id;
 
+  GList *negotiated_codecs;
+
   GError *construction_error;
 
   GList *known_ssrcs;
@@ -168,6 +171,9 @@ fs_rtp_stream_class_init (FsRtpStreamClass *klass)
                                     PROP_REMOTE_CODECS,
                                     "remote-codecs");
   g_object_class_override_property (gobject_class,
+                                    PROP_NEGOTIATED_CODECS,
+                                    "negotiated-codecs");
+  g_object_class_override_property (gobject_class,
                                     PROP_CURRENT_RECV_CODECS,
                                     "current-recv-codecs");
   g_object_class_override_property (gobject_class,
@@ -272,6 +278,9 @@ fs_rtp_stream_finalize (GObject *object)
   if (self->remote_codecs)
     fs_codec_list_destroy (self->remote_codecs);
 
+  if (self->priv->negotiated_codecs)
+    fs_codec_list_destroy (self->priv->negotiated_codecs);
+
   if (self->priv->known_ssrcs)
     g_list_free (self->priv->known_ssrcs);
 
@@ -301,7 +310,14 @@ fs_rtp_stream_get_property (GObject *object,
 
   switch (prop_id) {
     case PROP_REMOTE_CODECS:
+      FS_RTP_SESSION_LOCK (self->priv->session);
       g_value_set_boxed (value, self->remote_codecs);
+      FS_RTP_SESSION_UNLOCK (self->priv->session);
+      break;
+    case PROP_NEGOTIATED_CODECS:
+      FS_RTP_SESSION_LOCK (self->priv->session);
+      g_value_set_boxed (value, self->priv->negotiated_codecs);
+      FS_RTP_SESSION_UNLOCK (self->priv->session);
       break;
     case PROP_SESSION:
       g_value_set_object (value, self->priv->session);
@@ -907,3 +923,35 @@ fs_rtp_stream_emit_new_remote_codecs (FsRtpStream *stream,
 
   return !myerror;
 }
+
+/**
+ * fs_rtp_stream_set_negotiated_codecs
+ * @stream: a #FsRtpStream
+ * @codecs: The #GList of #FsCodec to set for the negotiated-codecs property
+ *
+ * This function sets the value of the FsStream:negotiated-codecs property.
+ * Unlike most other functions in this element, it TAKES the reference to the
+ * codecs, so you have to give it its own copy.
+ */
+void
+fs_rtp_stream_set_negotiated_codecs (FsRtpStream *stream,
+    GList *codecs)
+{
+  FS_RTP_SESSION_LOCK (stream->priv->session);
+  if (fs_codec_list_are_equal (stream->priv->negotiated_codecs, codecs))
+  {
+    fs_codec_list_destroy (codecs);
+    FS_RTP_SESSION_UNLOCK (stream->priv->session);
+    return;
+  }
+
+  if (stream->priv->negotiated_codecs)
+    fs_codec_list_destroy (stream->priv->negotiated_codecs);
+
+  stream->priv->negotiated_codecs = codecs;
+
+  FS_RTP_SESSION_UNLOCK (stream->priv->session);
+
+  g_object_notify (G_OBJECT (stream), "negotiated-codecs");
+}
+
diff --git a/gst/fsrtpconference/fs-rtp-stream.h b/gst/fsrtpconference/fs-rtp-stream.h
index eeafce0..df46089 100644
--- a/gst/fsrtpconference/fs-rtp-stream.h
+++ b/gst/fsrtpconference/fs-rtp-stream.h
@@ -101,6 +101,9 @@ void fs_rtp_stream_add_known_ssrc (FsRtpStream *stream,
 void fs_rtp_stream_remove_known_ssrc (FsRtpStream *stream,
     guint32 ssrc);
 
+void
+fs_rtp_stream_set_negotiated_codecs (FsRtpStream *stream,
+    GList *codecs);
 
 G_END_DECLS
 
-- 
1.5.6.5




More information about the farsight-commits mailing list