[farsight2/master] Set the stream_id when building a stream

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


---
 transmitters/nice/fs-nice-stream-transmitter.c |   20 ++++++++++++--------
 transmitters/nice/fs-nice-stream-transmitter.h |    1 +
 transmitters/nice/fs-nice-transmitter.c        |    7 ++++++-
 3 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/transmitters/nice/fs-nice-stream-transmitter.c b/transmitters/nice/fs-nice-stream-transmitter.c
index f2eac85..b2e93a6 100644
--- a/transmitters/nice/fs-nice-stream-transmitter.c
+++ b/transmitters/nice/fs-nice-stream-transmitter.c
@@ -63,10 +63,8 @@ enum
 
 struct _FsNiceStreamTransmitterPrivate
 {
-  /* We don't actually hold a ref to this,
-   * But since our parent FsStream can not exist without its parent
-   * FsSession, we should be safe
-   */
+  guint stream_id;
+
   FsNiceTransmitter *transmitter;
 
   gboolean sending;
@@ -138,16 +136,18 @@ fs_nice_stream_transmitter_class_init (FsNiceStreamTransmitterClass *klass)
 
   gobject_class->set_property = fs_nice_stream_transmitter_set_property;
   gobject_class->get_property = fs_nice_stream_transmitter_get_property;
+  gobject_class->dispose = fs_nice_stream_transmitter_dispose;
+  gobject_class->finalize = fs_nice_stream_transmitter_finalize;
 
   streamtransmitterclass->add_remote_candidate =
     fs_nice_stream_transmitter_add_remote_candidate;
 
+  g_type_class_add_private (klass, sizeof (FsNiceStreamTransmitterPrivate));
+
   g_object_class_override_property (gobject_class, PROP_SENDING, "sending");
 
-  gobject_class->dispose = fs_nice_stream_transmitter_dispose;
-  gobject_class->finalize = fs_nice_stream_transmitter_finalize;
+  
 
-  g_type_class_add_private (klass, sizeof (FsNiceStreamTransmitterPrivate));
 }
 
 static void
@@ -246,7 +246,10 @@ fs_nice_stream_transmitter_add_remote_candidate (
 
 FsNiceStreamTransmitter *
 fs_nice_stream_transmitter_newv (FsNiceTransmitter *transmitter,
-  guint n_parameters, GParameter *parameters, GError **error)
+    guint stream_id,
+    guint n_parameters,
+    GParameter *parameters,
+    GError **error)
 {
   FsNiceStreamTransmitter *streamtransmitter = NULL;
 
@@ -261,6 +264,7 @@ fs_nice_stream_transmitter_newv (FsNiceTransmitter *transmitter,
   }
 
   streamtransmitter->priv->transmitter = transmitter;
+  streamtransmitter->priv->stream_id = stream_id;
 
   if (!fs_nice_stream_transmitter_build (streamtransmitter, error))
   {
diff --git a/transmitters/nice/fs-nice-stream-transmitter.h b/transmitters/nice/fs-nice-stream-transmitter.h
index b36573d..696f781 100644
--- a/transmitters/nice/fs-nice-stream-transmitter.h
+++ b/transmitters/nice/fs-nice-stream-transmitter.h
@@ -90,6 +90,7 @@ GType fs_nice_stream_transmitter_get_type (void);
 
 FsNiceStreamTransmitter *
 fs_nice_stream_transmitter_newv (FsNiceTransmitter *transmitter,
+    guint stream_id,
     guint n_parameters,
     GParameter *parameters,
     GError **error);
diff --git a/transmitters/nice/fs-nice-transmitter.c b/transmitters/nice/fs-nice-transmitter.c
index 6be040d..82169ba 100644
--- a/transmitters/nice/fs-nice-transmitter.c
+++ b/transmitters/nice/fs-nice-transmitter.c
@@ -771,8 +771,13 @@ fs_nice_transmitter_new_stream_transmitter (FsTransmitter *transmitter,
   if (!fs_nice_transmitter_start (self, error))
     return NULL;
 
+
+  FS_NICE_TRANSMITTER_LOCK (self);
+  stream_id = self->priv->next_stream_id++;
+  FS_NICE_TRANSMITTER_UNLOCK (self);
+
   st = FS_STREAM_TRANSMITTER (fs_nice_stream_transmitter_newv (
-          self, n_parameters, parameters, error));
+          self, stream_id, n_parameters, parameters, error));
 
   if (st)
   {
-- 
1.5.6.5




More information about the farsight-commits mailing list