[farsight2/master] Make some properties into public members

Olivier Crête olivier.crete at collabora.co.uk
Fri Dec 12 17:59:03 PST 2008


---
 gst/fsrtpconference/fs-rtp-session.c   |   16 +++-------------
 gst/fsrtpconference/fs-rtp-stream.c    |   29 +++++++++++++----------------
 gst/fsrtpconference/fs-rtp-stream.h    |    4 +++-
 gst/fsrtpconference/fs-rtp-substream.c |   11 ++++-------
 4 files changed, 23 insertions(+), 37 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-session.c b/gst/fsrtpconference/fs-rtp-session.c
index a0f203f..c43e543 100644
--- a/gst/fsrtpconference/fs-rtp-session.c
+++ b/gst/fsrtpconference/fs-rtp-session.c
@@ -2675,13 +2675,9 @@ fs_rtp_session_get_recv_codec_locked (FsRtpSession *session,
 
   if (stream)
   {
-    GList *stream_codecs = NULL;
-
-    g_object_get (stream, "negotiated-codecs", &stream_codecs, NULL);
-
-    for(item = stream_codecs; item; item = g_list_next (item))
+    for (item = stream->negotiated_codecs; item; item = g_list_next (item))
     {
-      recv_codec = item->data;
+      recv_codec = fs_codec_copy (item->data);
       if (recv_codec->id == pt)
         break;
     }
@@ -2690,15 +2686,12 @@ fs_rtp_session_get_recv_codec_locked (FsRtpSession *session,
     {
       GST_DEBUG ("Receiving on stream codec " FS_CODEC_FORMAT,
           FS_CODEC_ARGS (recv_codec));
-      stream_codecs = g_list_remove_all (stream_codecs, recv_codec);
     }
     else
     {
       GST_DEBUG ("Have stream, but it does not have negotiatied codec");
       recv_codec = NULL;
     }
-
-    fs_codec_list_destroy (stream_codecs);
   }
 
   if (!recv_codec)
@@ -3535,12 +3528,9 @@ fs_rtp_session_associate_ssrc_cname (FsRtpSession *session,
        item = g_list_next (item))
   {
     FsRtpStream *localstream = item->data;
-    FsRtpParticipant *participant = NULL;
     gchar *localcname = NULL;
 
-    g_object_get (localstream, "participant", &participant, NULL);
-    g_object_get (participant, "cname", &localcname, NULL);
-    g_object_unref (participant);
+    g_object_get (localstream->participant, "cname", &localcname, NULL);
 
     g_assert (localcname);
 
diff --git a/gst/fsrtpconference/fs-rtp-stream.c b/gst/fsrtpconference/fs-rtp-stream.c
index 94dd0e7..eb359b1 100644
--- a/gst/fsrtpconference/fs-rtp-stream.c
+++ b/gst/fsrtpconference/fs-rtp-stream.c
@@ -65,7 +65,6 @@ enum
 struct _FsRtpStreamPrivate
 {
   FsRtpSession *session;
-  FsRtpParticipant *participant;
   FsStreamTransmitter *stream_transmitter;
 
   FsStreamDirection direction;
@@ -73,8 +72,6 @@ struct _FsRtpStreamPrivate
   /* Protected by the session mutex */
   guint recv_codecs_changed_idle_id;
 
-  GList *negotiated_codecs;
-
   GError *construction_error;
 
   stream_new_remote_codecs_cb new_remote_codecs_cb;
@@ -202,7 +199,7 @@ fs_rtp_stream_init (FsRtpStream *self)
 
   self->priv->disposed = FALSE;
   self->priv->session = NULL;
-  self->priv->participant = NULL;
+  self->participant = NULL;
   self->priv->stream_transmitter = NULL;
 
   self->priv->direction = FS_DIRECTION_NONE;
@@ -238,9 +235,9 @@ fs_rtp_stream_dispose (GObject *object)
   }
   FS_RTP_SESSION_UNLOCK (self->priv->session);
 
-  if (self->priv->participant) {
-    g_object_unref (self->priv->participant);
-    self->priv->participant = NULL;
+  if (self->participant) {
+    g_object_unref (self->participant);
+    self->participant = NULL;
   }
 
   /* Make sure dispose does not run twice. */
@@ -263,8 +260,8 @@ 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->negotiated_codecs)
+    fs_codec_list_destroy (self->negotiated_codecs);
 
   parent_class->finalize (object);
 }
@@ -298,14 +295,14 @@ fs_rtp_stream_get_property (GObject *object,
       break;
     case PROP_NEGOTIATED_CODECS:
       FS_RTP_SESSION_LOCK (self->priv->session);
-      g_value_set_boxed (value, self->priv->negotiated_codecs);
+      g_value_set_boxed (value, self->negotiated_codecs);
       FS_RTP_SESSION_UNLOCK (self->priv->session);
       break;
     case PROP_SESSION:
       g_value_set_object (value, self->priv->session);
       break;
     case PROP_PARTICIPANT:
-      g_value_set_object (value, self->priv->participant);
+      g_value_set_object (value, self->participant);
       break;
     case PROP_STREAM_TRANSMITTER:
       g_value_set_object (value, self->priv->stream_transmitter);
@@ -359,7 +356,7 @@ fs_rtp_stream_set_property (GObject *object,
       self->priv->session = FS_RTP_SESSION (g_value_dup_object (value));
       break;
     case PROP_PARTICIPANT:
-      self->priv->participant = FS_RTP_PARTICIPANT (g_value_dup_object (value));
+      self->participant = FS_RTP_PARTICIPANT (g_value_dup_object (value));
       break;
     case PROP_STREAM_TRANSMITTER:
       self->priv->stream_transmitter =
@@ -885,16 +882,16 @@ void
 fs_rtp_stream_set_negotiated_codecs_locked (FsRtpStream *stream,
     GList *codecs)
 {
-  if (fs_codec_list_are_equal (stream->priv->negotiated_codecs, codecs))
+  if (fs_codec_list_are_equal (stream->negotiated_codecs, codecs))
   {
     fs_codec_list_destroy (codecs);
     return;
   }
 
-  if (stream->priv->negotiated_codecs)
-    fs_codec_list_destroy (stream->priv->negotiated_codecs);
+  if (stream->negotiated_codecs)
+    fs_codec_list_destroy (stream->negotiated_codecs);
 
-  stream->priv->negotiated_codecs = codecs;
+  stream->negotiated_codecs = codecs;
 
   /*
     TODO: I have no idea how to make this thread safe
diff --git a/gst/fsrtpconference/fs-rtp-stream.h b/gst/fsrtpconference/fs-rtp-stream.h
index a550b62..cbdf605 100644
--- a/gst/fsrtpconference/fs-rtp-stream.h
+++ b/gst/fsrtpconference/fs-rtp-stream.h
@@ -74,11 +74,13 @@ struct _FsRtpStream
   /* Can only be accessed while holding the FsRtpSession lock */
   /* Dont modify, call set_remote_codecs() */
   GList *remote_codecs;
+  GList *negotiated_codecs;
 
-  /* Can only be accessed while holding the FsRtpSession lock */
   /* Dont modify, call add_substream() */
   GList *substreams;
 
+  FsRtpParticipant *participant;
+
   FsRtpStreamPrivate *priv;
 };
 
diff --git a/gst/fsrtpconference/fs-rtp-substream.c b/gst/fsrtpconference/fs-rtp-substream.c
index 4159a06..efaa719 100644
--- a/gst/fsrtpconference/fs-rtp-substream.c
+++ b/gst/fsrtpconference/fs-rtp-substream.c
@@ -997,14 +997,11 @@ fs_rtp_sub_stream_add_output_ghostpad_locked (FsRtpSubStream *substream,
 {
   GstPad *valve_srcpad;
   gchar *padname = NULL;
-  guint session_id;
   GstPad *ghostpad = NULL;
 
   g_assert (substream->priv->output_ghostpad == NULL);
 
-  g_object_get (substream->priv->session, "id", &session_id, NULL);
-
-  padname = g_strdup_printf ("src_%u_%u_%d", session_id,
+  padname = g_strdup_printf ("src_%u_%u_%d", substream->priv->session->id,
       substream->priv->ssrc,
       substream->priv->pt);
 
@@ -1023,7 +1020,7 @@ fs_rtp_sub_stream_add_output_ghostpad_locked (FsRtpSubStream *substream,
   if (!ghostpad)
   {
     g_set_error (error, FS_ERROR, FS_ERROR_CONSTRUCTION,
-        "Could not build ghostpad src_%u_%u_%d", session_id,
+        "Could not build ghostpad src_%u_%u_%d", substream->priv->session->id,
         substream->priv->ssrc, substream->priv->pt);
     return FALSE;
   }
@@ -1031,7 +1028,7 @@ fs_rtp_sub_stream_add_output_ghostpad_locked (FsRtpSubStream *substream,
   if (!gst_pad_set_active (ghostpad, TRUE))
   {
     g_set_error (error, FS_ERROR, FS_ERROR_CONSTRUCTION,
-        "Could not activate the src_%u_%u_%d", session_id,
+        "Could not activate the src_%u_%u_%d", substream->priv->session->id,
         substream->priv->ssrc, substream->priv->pt);
     gst_object_unref (ghostpad);
     return FALSE;
@@ -1042,7 +1039,7 @@ fs_rtp_sub_stream_add_output_ghostpad_locked (FsRtpSubStream *substream,
   {
     g_set_error (error, FS_ERROR, FS_ERROR_CONSTRUCTION,
         "Could add build ghostpad src_%u_%u_%d to the conference",
-        session_id, substream->priv->ssrc, substream->priv->pt);
+        substream->priv->session->id, substream->priv->ssrc, substream->priv->pt);
     gst_object_unref (ghostpad);
     return FALSE;
   }
-- 
1.5.6.5




More information about the farsight-commits mailing list