[farsight2/master] Add a no-rtcp-timeout property on the FsRtpSubStream and set it at construct time from the session

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


---
 gst/fsrtpconference/fs-rtp-session.c   |    7 +++++-
 gst/fsrtpconference/fs-rtp-substream.c |   34 ++++++++++++++++++++++++++++++-
 gst/fsrtpconference/fs-rtp-substream.h |    1 +
 3 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-session.c b/gst/fsrtpconference/fs-rtp-session.c
index a97b340..54ebdb2 100644
--- a/gst/fsrtpconference/fs-rtp-session.c
+++ b/gst/fsrtpconference/fs-rtp-session.c
@@ -1671,9 +1671,14 @@ fs_rtp_session_new_recv_pad (FsRtpSession *session, GstPad *new_pad,
   FsRtpSubStream *substream = NULL;
   FsRtpStream *stream = NULL;
   GError *error = NULL;
+  gint no_rtcp_timeout;
+
+  FS_RTP_SESSION_LOCK (session);
+  no_rtcp_timeout = session->priv->no_rtcp_timeout;
+  FS_RTP_SESSION_UNLOCK (session);
 
   substream = fs_rtp_sub_stream_new (session->priv->conference, session,
-      new_pad, ssrc, pt, &error);
+      new_pad, ssrc, pt, no_rtcp_timeout, &error);
 
   if (substream == NULL) {
     if (error && error->domain == FS_ERROR)
diff --git a/gst/fsrtpconference/fs-rtp-substream.c b/gst/fsrtpconference/fs-rtp-substream.c
index cdc8255..48fe2b4 100644
--- a/gst/fsrtpconference/fs-rtp-substream.c
+++ b/gst/fsrtpconference/fs-rtp-substream.c
@@ -57,9 +57,12 @@ enum
   PROP_PT,
   PROP_CODEC,
   PROP_RECEIVING,
-  PROP_OUTPUT_GHOSTPAD
+  PROP_OUTPUT_GHOSTPAD,
+  PROP_NO_RTCP_TIMEOUT
 };
 
+#define DEFAULT_NO_RTCP_TIMEOUT (7000)
+
 struct _FsRtpSubStreamPrivate {
   gboolean disposed;
 
@@ -92,6 +95,11 @@ struct _FsRtpSubStreamPrivate {
 
   gboolean receiving;
 
+  gint no_rtcp_timeout;
+
+  /* Protected by the session mutex */
+  gint no_rtcp_timeout_id;
+
   GError *construction_error;
 };
 
@@ -207,6 +215,16 @@ fs_rtp_sub_stream_class_init (FsRtpSubStreamClass *klass)
           GST_TYPE_PAD,
           G_PARAM_READABLE));
 
+  g_object_class_install_property (gobject_class,
+      PROP_NO_RTCP_TIMEOUT,
+      g_param_spec_int ("no-rtcp-timeout",
+          "The timeout (in ms) before no RTCP is assumed",
+          "This is the time (in ms) after which data received without RTCP"
+          " is attached the FsStream, this only works if there is only one"
+          " FsStream. <=0 will do nothing",
+          -1, G_MAXINT, DEFAULT_NO_RTCP_TIMEOUT,
+          G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
+
   g_type_class_add_private (klass, sizeof (FsRtpSubStreamPrivate));
 }
 
@@ -372,6 +390,11 @@ fs_rtp_sub_stream_set_property (GObject *object,
             NULL);
       FS_RTP_SESSION_UNLOCK (self->priv->session);
       break;
+    case PROP_NO_RTCP_TIMEOUT:
+      FS_RTP_SESSION_LOCK (self->priv->session);
+      self->priv->no_rtcp_timeout = g_value_get_int (value);
+      FS_RTP_SESSION_UNLOCK (self->priv->session);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -422,7 +445,12 @@ fs_rtp_sub_stream_get_property (GObject *object,
       g_value_set_object (value, self->priv->output_ghostpad);
       FS_RTP_SESSION_UNLOCK (self->priv->session);
       break;
-   default:
+    case PROP_NO_RTCP_TIMEOUT:
+      FS_RTP_SESSION_LOCK (self);
+      g_value_set_int (value, self->priv->no_rtcp_timeout);
+      FS_RTP_SESSION_UNLOCK (self);
+      break;
+    default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
   }
@@ -578,6 +606,7 @@ fs_rtp_sub_stream_new (FsRtpConference *conference,
     GstPad *rtpbin_pad,
     guint32 ssrc,
     guint pt,
+    gint no_rtcp_timeout,
     GError **error)
 {
   FsRtpSubStream *substream = g_object_new (FS_TYPE_RTP_SUB_STREAM,
@@ -586,6 +615,7 @@ fs_rtp_sub_stream_new (FsRtpConference *conference,
     "rtpbin-pad", rtpbin_pad,
     "ssrc", ssrc,
     "pt", pt,
+    "no-rtcp-timeout", no_rtcp_timeout,
     NULL);
 
   if (substream->priv->construction_error) {
diff --git a/gst/fsrtpconference/fs-rtp-substream.h b/gst/fsrtpconference/fs-rtp-substream.h
index 952992f..49f7941 100644
--- a/gst/fsrtpconference/fs-rtp-substream.h
+++ b/gst/fsrtpconference/fs-rtp-substream.h
@@ -76,6 +76,7 @@ FsRtpSubStream *fs_rtp_sub_stream_new (FsRtpConference *conference,
     GstPad *pad,
     guint32 ssrc,
     guint pt,
+    gint no_rtcp_timeout,
     GError **error);
 
 
-- 
1.5.6.5




More information about the farsight-commits mailing list