[farsight2/master] Add fakesink to the tee between the rtpbin and the transmitters
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 23 15:20:34 PST 2008
---
gst/fsrtpconference/fs-rtp-session.c | 114 +++++++++++++++++++++++++++++++++-
1 files changed, 112 insertions(+), 2 deletions(-)
diff --git a/gst/fsrtpconference/fs-rtp-session.c b/gst/fsrtpconference/fs-rtp-session.c
index bb9c94e..6d4149e 100644
--- a/gst/fsrtpconference/fs-rtp-session.c
+++ b/gst/fsrtpconference/fs-rtp-session.c
@@ -88,6 +88,8 @@ struct _FsRtpSessionPrivate
GstElement *transmitter_rtcp_tee;
GstElement *transmitter_rtp_funnel;
GstElement *transmitter_rtcp_funnel;
+ GstElement *transmitter_rtp_fakesink;
+ GstElement *transmitter_rtcp_fakesink;
GstElement *rtpmuxer;
@@ -305,12 +307,16 @@ fs_rtp_session_dispose (GObject *object)
if (self->priv->transmitters)
g_hash_table_foreach (self->priv->transmitters, _stop_transmitter_elem,
"gst-sink");
- if (self->priv->rtpbin_send_rtcp_src)
- gst_pad_set_active (self->priv->rtpbin_send_rtcp_src, FALSE);
+ if (self->priv->transmitter_rtp_fakesink)
+ gst_element_set_state (self->priv->transmitter_rtp_tee, GST_STATE_NULL);
+ if (self->priv->transmitter_rtcp_fakesink)
+ gst_element_set_state (self->priv->transmitter_rtcp_tee, GST_STATE_NULL);
if (self->priv->transmitter_rtcp_tee)
gst_element_set_state (self->priv->transmitter_rtcp_tee, GST_STATE_NULL);
if (self->priv->transmitter_rtp_tee)
gst_element_set_state (self->priv->transmitter_rtp_tee, GST_STATE_NULL);
+ if (self->priv->rtpbin_send_rtcp_src)
+ gst_pad_set_active (self->priv->rtpbin_send_rtcp_src, FALSE);
if (self->priv->rtpbin_send_rtp_sink)
gst_pad_set_active (self->priv->rtpbin_send_rtp_sink, FALSE);
if (self->priv->rtpmuxer)
@@ -396,6 +402,24 @@ fs_rtp_session_dispose (GObject *object)
self->priv->transmitter_rtcp_tee = NULL;
}
+ if (self->priv->transmitter_rtp_fakesink) {
+ gst_bin_remove (GST_BIN (self->priv->conference),
+ self->priv->transmitter_rtp_fakesink);
+ gst_element_set_state (self->priv->transmitter_rtp_fakesink,
+ GST_STATE_NULL);
+ gst_object_unref (self->priv->transmitter_rtp_fakesink);
+ self->priv->transmitter_rtp_fakesink = NULL;
+ }
+
+ if (self->priv->transmitter_rtcp_fakesink) {
+ gst_bin_remove (GST_BIN (self->priv->conference),
+ self->priv->transmitter_rtcp_fakesink);
+ gst_element_set_state (self->priv->transmitter_rtcp_fakesink,
+ GST_STATE_NULL);
+ gst_object_unref (self->priv->transmitter_rtcp_fakesink);
+ self->priv->transmitter_rtcp_tee = NULL;
+ }
+
if (self->priv->rtpbin_send_rtcp_src) {
gst_pad_set_active (self->priv->rtpbin_send_rtcp_src, FALSE);
gst_element_release_request_pad (self->priv->conference->gstrtpbin,
@@ -616,10 +640,12 @@ fs_rtp_session_constructed (GObject *object)
GstElement *tee = NULL;
GstElement *funnel = NULL;
GstElement *muxer = NULL;
+ GstElement *fakesink = NULL;
GstPad *valve_sink_pad = NULL;
GstPad *funnel_src_pad = NULL;
GstPad *muxer_src_pad = NULL;
GstPad *transmitter_rtcp_tee_sink_pad;
+ GstPad *pad1, *pad2;
GstPadLinkReturn ret;
gchar *tmp;
@@ -880,6 +906,48 @@ fs_rtp_session_constructed (GObject *object)
}
g_free (tmp);
+ /* Now add a fakesink to the RTP tee */
+
+ tmp = g_strdup_printf ("sink_rtp_fakesink_%u", self->id);
+ fakesink = gst_element_factory_make ("fakesink", tmp);
+ g_free (tmp);
+
+ if (!fakesink) {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not create the rtp fakesink element");
+ return;
+ }
+
+ if (!gst_bin_add (GST_BIN (self->priv->conference), fakesink)) {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not add the rtp fakesink element to the FsRtpConference");
+ gst_object_unref (tee);
+ return;
+ }
+
+ g_object_set (fakesink, "sync", FALSE, "async", FALSE, NULL);
+
+ gst_element_set_state (fakesink, GST_STATE_PLAYING);
+
+ self->priv->transmitter_rtp_fakesink = fakesink;
+
+ pad1 = gst_element_get_request_pad (tee, "src%d");
+ pad2 = gst_element_get_static_pad (fakesink, "sink");
+
+ ret = gst_pad_link (pad1, pad2);
+
+ gst_object_unref (pad2);
+ gst_object_unref (pad1);
+
+ if (GST_PAD_LINK_FAILED (ret)) {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not link the rtp tee to its fakesink");
+ return;
+ }
+
/* Now create the transmitter RTCP tee */
tmp = g_strdup_printf ("send_rtcp_tee_%u", self->id);
@@ -940,6 +1008,48 @@ fs_rtp_session_constructed (GObject *object)
gst_object_unref (transmitter_rtcp_tee_sink_pad);
+ /* Now add a fakesink to the RTCP tee */
+
+ tmp = g_strdup_printf ("sink_rtcp_fakesink_%u", self->id);
+ fakesink = gst_element_factory_make ("fakesink", tmp);
+ g_free (tmp);
+
+ if (!fakesink) {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not create the rtcp fakesink element");
+ return;
+ }
+
+ if (!gst_bin_add (GST_BIN (self->priv->conference), fakesink)) {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not add the rtcp fakesink element to the FsRtcpConference");
+ gst_object_unref (tee);
+ return;
+ }
+
+ g_object_set (fakesink, "sync", FALSE, "async", FALSE, NULL);
+
+ gst_element_set_state (fakesink, GST_STATE_PLAYING);
+
+ self->priv->transmitter_rtcp_fakesink = fakesink;
+
+ pad1 = gst_element_get_request_pad (tee, "src%d");
+ pad2 = gst_element_get_static_pad (fakesink, "sink");
+
+ ret = gst_pad_link (pad1, pad2);
+
+ gst_object_unref (pad2);
+ gst_object_unref (pad1);
+
+ if (GST_PAD_LINK_FAILED (ret)) {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not link the rtcp tee to its fakesink");
+ return;
+ }
+
/* Lets now do the send_capsfilter */
tmp = g_strdup_printf ("send_rtp_capsfilter_%u", self->id);
--
1.5.6.5
More information about the farsight-commits
mailing list