[farsight2/master] Look at the substreams to know if a stream already is associated with a ssrc

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


---
 gst/fsrtpconference/fs-rtp-session.c |   17 +++++------------
 gst/fsrtpconference/fs-rtp-stream.c  |   19 +++++++++++++++++++
 gst/fsrtpconference/fs-rtp-stream.h  |    4 ++++
 3 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-session.c b/gst/fsrtpconference/fs-rtp-session.c
index 0b77838..0737124 100644
--- a/gst/fsrtpconference/fs-rtp-session.c
+++ b/gst/fsrtpconference/fs-rtp-session.c
@@ -1250,26 +1250,19 @@ fs_rtp_session_get_new_stream_transmitter (FsRtpSession *self,
  */
 static FsRtpStream *
 fs_rtp_session_get_stream_by_ssrc_locked (FsRtpSession *self,
-                                            guint stream_ssrc)
+    guint32 ssrc)
 {
   GList *item = NULL;
 
   for (item = g_list_first (self->priv->streams);
        item;
-       item = g_list_next (item)) {
-    FsRtpStream *stream = item->data;
-    guint ssrc = 0;
-
-    g_object_get (stream, "id", &ssrc, NULL);
-
-    if (ssrc == stream_ssrc) {
-      g_object_ref(stream);
+       item = g_list_next (item))
+    if (fs_rtp_stream_knows_ssrc (item->data, ssrc))
       break;
-    }
-  }
+
 
   if (item)
-    return FS_RTP_STREAM (item->data);
+    return FS_RTP_STREAM (gst_object_ref (item->data));
   else
     return NULL;
 }
diff --git a/gst/fsrtpconference/fs-rtp-stream.c b/gst/fsrtpconference/fs-rtp-stream.c
index 718c111..8f0971d 100644
--- a/gst/fsrtpconference/fs-rtp-stream.c
+++ b/gst/fsrtpconference/fs-rtp-stream.c
@@ -570,3 +570,22 @@ fs_rtp_stream_add_substream (FsRtpStream *stream,
 
   return TRUE;
 }
+
+gboolean
+fs_rtp_stream_knows_ssrc (FsRtpStream *stream, guint32 ssrc)
+{
+  GList *elem;
+
+  for (elem = g_list_first (stream->priv->substreams);
+       elem;
+       elem = g_list_next (elem))
+  {
+    guint32 substream_ssrc;
+
+    g_object_get (elem->data, "ssrc", &substream_ssrc, NULL);
+    if (substream_ssrc == ssrc)
+      return TRUE;
+  }
+
+  return FALSE;
+}
diff --git a/gst/fsrtpconference/fs-rtp-stream.h b/gst/fsrtpconference/fs-rtp-stream.h
index 959594c..164071d 100644
--- a/gst/fsrtpconference/fs-rtp-stream.h
+++ b/gst/fsrtpconference/fs-rtp-stream.h
@@ -81,6 +81,10 @@ gboolean fs_rtp_stream_add_substream (FsRtpStream *stream,
     FsRtpSubStream *substream,
     GError **error);
 
+gboolean fs_rtp_stream_knows_ssrc (FsRtpStream *stream,
+    guint32 ssrc);
+
+
 G_END_DECLS
 
 #endif /* __FS_RTP_STREAM_H__ */
-- 
1.5.6.5




More information about the farsight-commits mailing list