[farsight2/master] Add list of known ssrcs (in case rtcp arrives before rtp)

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


---
 gst/fsrtpconference/fs-rtp-session.c |    2 ++
 gst/fsrtpconference/fs-rtp-stream.c  |   27 ++++++++++++++++++++++-----
 gst/fsrtpconference/fs-rtp-stream.h  |    3 +++
 3 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-session.c b/gst/fsrtpconference/fs-rtp-session.c
index 12f9f43..0790320 100644
--- a/gst/fsrtpconference/fs-rtp-session.c
+++ b/gst/fsrtpconference/fs-rtp-session.c
@@ -2463,6 +2463,8 @@ fs_rtp_session_associate_ssrc_cname (FsRtpSession *session,
     return;
   }
 
+  fs_rtp_stream_add_known_ssrc (stream, ssrc);
+
   for (item = g_list_first (session->priv->free_substreams);
        item;
        item = g_list_next (item))
diff --git a/gst/fsrtpconference/fs-rtp-stream.c b/gst/fsrtpconference/fs-rtp-stream.c
index 2a2f610..d36e646 100644
--- a/gst/fsrtpconference/fs-rtp-stream.c
+++ b/gst/fsrtpconference/fs-rtp-stream.c
@@ -73,6 +73,8 @@ struct _FsRtpStreamPrivate
 
   GError *construction_error;
 
+  GList *known_ssrcs;
+
   gboolean disposed;
 };
 
@@ -193,6 +195,7 @@ fs_rtp_stream_init (FsRtpStream *self)
   self->priv->session = NULL;
   self->priv->participant = NULL;
   self->priv->stream_transmitter = NULL;
+  self->priv->known_ssrcs = NULL;
 
   self->priv->direction = FS_DIRECTION_NONE;
 }
@@ -251,6 +254,9 @@ fs_rtp_stream_finalize (GObject *object)
   if (self->remote_codecs)
     fs_codec_list_destroy (self->remote_codecs);
 
+  if (self->priv->known_ssrcs)
+    g_list_free (self->priv->known_ssrcs);
+
   parent_class->finalize (object);
 }
 
@@ -656,14 +662,12 @@ fs_rtp_stream_knows_ssrc_locked (FsRtpStream *stream, guint32 ssrc)
 {
   GList *elem;
 
-  for (elem = g_list_first (stream->priv->substreams);
+  for (elem = g_list_first (stream->priv->known_ssrcs);
        elem;
        elem = g_list_next (elem))
   {
-    guint32 substream_ssrc;
-
-    g_object_get (elem->data, "ssrc", &substream_ssrc, NULL);
-    if (substream_ssrc == ssrc)
+    guint32 tmp_ssrc = GPOINTER_TO_UINT (elem->data);
+    if (tmp_ssrc == ssrc)
       return TRUE;
   }
 
@@ -766,3 +770,16 @@ fs_rtp_stream_maybe_emit_codecs_changed (FsRtpStream *stream,
 
   fs_codec_destroy (codec);
 }
+
+void
+fs_rtp_stream_add_known_ssrc (FsRtpStream *stream,
+    guint32 ssrc)
+{
+  FS_RTP_SESSION_LOCK (stream->priv->session);
+  if (!fs_rtp_stream_knows_ssrc_locked (stream, ssrc))
+  {
+    stream->priv->known_ssrcs = g_list_prepend (stream->priv->known_ssrcs,
+        GUINT_TO_POINTER (ssrc));
+  }
+  FS_RTP_SESSION_UNLOCK (stream->priv->session);
+}
diff --git a/gst/fsrtpconference/fs-rtp-stream.h b/gst/fsrtpconference/fs-rtp-stream.h
index a3916aa..c16d9ba 100644
--- a/gst/fsrtpconference/fs-rtp-stream.h
+++ b/gst/fsrtpconference/fs-rtp-stream.h
@@ -96,6 +96,9 @@ void fs_rtp_stream_invalidate_codec_locked (FsRtpStream *stream,
 void fs_rtp_stream_maybe_emit_codecs_changed (FsRtpStream *stream,
     FsRtpSubStream *substream);
 
+void fs_rtp_stream_add_known_ssrc (FsRtpStream *stream,
+    guint32 ssrc);
+
 
 
 G_END_DECLS
-- 
1.5.6.5




More information about the farsight-commits mailing list