[farsight2/master] nice: Pass ToS property to libnice

Olivier Crête olivier.crete at collabora.co.uk
Tue Jul 28 10:35:34 PDT 2009


---
 transmitters/nice/fs-nice-stream-transmitter.c |   25 ++++++++++++++++++++++++
 transmitters/nice/fs-nice-transmitter.c        |   12 ++++++++++-
 2 files changed, 36 insertions(+), 1 deletions(-)

diff --git a/transmitters/nice/fs-nice-stream-transmitter.c b/transmitters/nice/fs-nice-stream-transmitter.c
index fb19afd..519ca43 100644
--- a/transmitters/nice/fs-nice-stream-transmitter.c
+++ b/transmitters/nice/fs-nice-stream-transmitter.c
@@ -96,6 +96,8 @@ struct _FsNiceStreamTransmitterPrivate
   gulong new_selected_pair_handler_id;
   gulong new_candidate_handler_id;
 
+  gulong tos_changed_handler_id;
+
   GValueArray *relay_info;
 
   volatile gint associate_on_source;
@@ -387,6 +389,11 @@ fs_nice_stream_transmitter_dispose (GObject *object)
         self->priv->new_candidate_handler_id);
   self->priv->new_candidate_handler_id = 0;
 
+  if (self->priv->tos_changed_handler_id)
+    g_signal_handler_disconnect (self->priv->transmitter,
+        self->priv->tos_changed_handler_id);
+  self->priv->tos_changed_handler_id = 0;
+
   if (self->priv->agent)
   {
     g_object_unref (self->priv->agent);
@@ -1098,6 +1105,19 @@ fs_nice_stream_transmitter_set_relay_info (FsNiceStreamTransmitter *self,
   return TRUE;
 }
 
+
+
+static void
+tos_changed (GObject *transmitter, GParamSpec *param,
+    FsNiceStreamTransmitter *self)
+{
+  guint tos;
+
+  g_object_get (transmitter, "tos", &tos, NULL);
+  nice_agent_set_stream_tos (self->priv->agent->agent, self->priv->stream_id,
+      tos);
+}
+
 static gboolean
 fs_nice_stream_transmitter_build (FsNiceStreamTransmitter *self,
     FsParticipant *participant,
@@ -1356,6 +1376,11 @@ fs_nice_stream_transmitter_build (FsNiceStreamTransmitter *self,
       self, 0);
   self->priv->new_candidate_handler_id = g_signal_connect_object (agent->agent,
       "new-candidate", G_CALLBACK (agent_new_candidate), self, 0);
+  self->priv->tos_changed_handler_id = g_signal_connect_object (
+      self->priv->transmitter, "notify::tos", G_CALLBACK (tos_changed), self,
+      0);
+
+  tos_changed (G_OBJECT (self->priv->transmitter), NULL, self);
 
   self->priv->gststream = fs_nice_transmitter_add_gst_stream (
       self->priv->transmitter,
diff --git a/transmitters/nice/fs-nice-transmitter.c b/transmitters/nice/fs-nice-transmitter.c
index 1c3d322..b777816 100644
--- a/transmitters/nice/fs-nice-transmitter.c
+++ b/transmitters/nice/fs-nice-transmitter.c
@@ -62,7 +62,8 @@ enum
   PROP_0,
   PROP_GST_SINK,
   PROP_GST_SRC,
-  PROP_COMPONENTS
+  PROP_COMPONENTS,
+  PROP_TOS
 };
 
 struct _FsNiceTransmitterPrivate
@@ -76,6 +77,8 @@ struct _FsNiceTransmitterPrivate
   /* They are tables of pointers, one per component */
   GstElement **src_funnels;
   GstElement **sink_tees;
+
+  gint tos;
 };
 
 #define FS_NICE_TRANSMITTER_GET_PRIVATE(o)  \
@@ -169,6 +172,7 @@ fs_nice_transmitter_class_init (FsNiceTransmitterClass *klass)
   g_object_class_override_property (gobject_class, PROP_GST_SINK, "gst-sink");
   g_object_class_override_property (gobject_class, PROP_COMPONENTS,
     "components");
+  g_object_class_override_property (gobject_class, PROP_TOS, "tos");
 
   transmitter_class->new_stream_transmitter =
     fs_nice_transmitter_new_stream_transmitter;
@@ -406,6 +410,9 @@ fs_nice_transmitter_get_property (GObject *object,
     case PROP_COMPONENTS:
       g_value_set_uint (value, self->components);
       break;
+    case PROP_TOS:
+      g_value_set_uint (value, self->priv->tos);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -425,6 +432,9 @@ fs_nice_transmitter_set_property (GObject *object,
     case PROP_COMPONENTS:
       self->components = g_value_get_uint (value);
       break;
+    case PROP_TOS:
+      self->priv->tos = g_value_get_uint (value);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
-- 
1.5.6.5



More information about the farsight-commits mailing list