[farsight2/master] Expect the sometimes pad to have appeared once the request ones have been requests from rtpbin, instead of using signal
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 23 15:20:17 PST 2008
---
gst/fsrtpconference/fs-rtp-conference.c | 11 ---
gst/fsrtpconference/fs-rtp-session.c | 113 +++++++++++++------------------
gst/fsrtpconference/fs-rtp-session.h | 2 -
3 files changed, 46 insertions(+), 80 deletions(-)
diff --git a/gst/fsrtpconference/fs-rtp-conference.c b/gst/fsrtpconference/fs-rtp-conference.c
index c061864..5702eb2 100644
--- a/gst/fsrtpconference/fs-rtp-conference.c
+++ b/gst/fsrtpconference/fs-rtp-conference.c
@@ -270,17 +270,6 @@ _rtpbin_pad_added (GstElement *rtpbin, GstPad *new_pad,
g_object_unref (session);
}
}
- } else if (g_str_has_prefix (name, "send_rtp_src_")) {
- guint session_id;
-
- if (sscanf (name, "send_rtp_src_%u", &session_id)) {
- FsRtpSession *session =
- fs_rtp_conference_get_session_by_id (self, session_id);
-
- if (session) {
- fs_rtp_session_link_network_sink (session, new_pad);
- }
- }
}
g_free (name);
diff --git a/gst/fsrtpconference/fs-rtp-session.c b/gst/fsrtpconference/fs-rtp-session.c
index 7f08d08..0aefe9f 100644
--- a/gst/fsrtpconference/fs-rtp-session.c
+++ b/gst/fsrtpconference/fs-rtp-session.c
@@ -575,6 +575,7 @@ fs_rtp_session_constructed (GObject *object)
GstPad *valve_sink_pad = NULL;
GstPad *funnel_src_pad = NULL;
GstPad *muxer_src_pad = NULL;
+ GstPad *transmitter_rtcp_tee_sink_pad;
GstPadLinkReturn ret;
gchar *tmp;
@@ -674,6 +675,17 @@ fs_rtp_session_constructed (GObject *object)
self->priv->transmitter_rtp_tee = gst_object_ref (tee);
+ tmp = g_strdup_printf ("send_rtp_src_%u", self->id);
+ if (!gst_element_link_pads (
+ self->priv->conference->gstrtpbin, tmp,
+ self->priv->transmitter_rtp_tee, "sink")) {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not link rtpbin %s pad to tee sink", tmp);
+ g_free (tmp);
+ return;
+ }
+ g_free (tmp);
/* Now create the transmitter RTCP tee */
@@ -700,6 +712,40 @@ fs_rtp_session_constructed (GObject *object)
self->priv->transmitter_rtcp_tee = gst_object_ref (tee);
+ tmp = g_strdup_printf ("send_rtcp_src_%u", self->id);
+ self->priv->rtpbin_send_rtcp_src =
+ gst_element_get_request_pad (self->priv->conference->gstrtpbin, tmp);
+
+ if (!self->priv->rtpbin_send_rtcp_src)
+ {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not get %s request pad from the gstrtpbin", tmp);
+ g_free (tmp);
+ return;
+ }
+ g_free (tmp);
+
+
+ transmitter_rtcp_tee_sink_pad =
+ gst_element_get_static_pad (self->priv->transmitter_rtcp_tee, "sink");
+ g_assert (transmitter_rtcp_tee_sink_pad);
+
+ ret = gst_pad_link (self->priv->rtpbin_send_rtcp_src,
+ transmitter_rtcp_tee_sink_pad);
+
+ if (GST_PAD_LINK_FAILED (ret))
+ {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not link rtpbin network rtcp src to tee");
+
+ gst_object_unref (transmitter_rtcp_tee_sink_pad);
+ return;
+ }
+
+ gst_object_unref (transmitter_rtcp_tee_sink_pad);
+
/* Now create the transmitter RTP funnel */
@@ -1083,73 +1129,6 @@ fs_rtp_session_request_pt_map (FsRtpSession *session, guint pt)
return caps;
}
-/**
- * fs_rtp_session_link_network_sink:
- * @session: a #FsRtpSession
- * @src_pad: the new source pad from the #GstRtpBin
- *
- * Links a new source pad from the GstRtpBin to the transmitter tee
- */
-
-void
-fs_rtp_session_link_network_sink (FsRtpSession *session, GstPad *src_pad)
-{
- GstPad *transmitter_rtp_tee_sink_pad;
- GstPad *transmitter_rtcp_tee_sink_pad;
- GstPadLinkReturn ret;
- gchar *tmp;
-
- transmitter_rtp_tee_sink_pad =
- gst_element_get_static_pad (session->priv->transmitter_rtp_tee, "sink");
- g_assert (transmitter_rtp_tee_sink_pad);
-
- ret = gst_pad_link (src_pad, transmitter_rtp_tee_sink_pad);
-
- if (GST_PAD_LINK_FAILED (ret)) {
- tmp = g_strdup_printf ("Could not link pad %s (%p) with pad %s (%p)",
- GST_PAD_NAME (src_pad), GST_PAD_CAPS (src_pad),
- GST_PAD_NAME (transmitter_rtp_tee_sink_pad),
- GST_PAD_CAPS (transmitter_rtp_tee_sink_pad));
- fs_session_emit_error (FS_SESSION (session), FS_ERROR_CONSTRUCTION,
- "Could not link rtpbin network src to tee", tmp);
- g_free (tmp);
-
- gst_object_unref (transmitter_rtp_tee_sink_pad);
- return;
- }
-
- gst_object_unref (transmitter_rtp_tee_sink_pad);
-
-
- transmitter_rtcp_tee_sink_pad =
- gst_element_get_static_pad (session->priv->transmitter_rtcp_tee, "sink");
- g_assert (transmitter_rtcp_tee_sink_pad);
-
- tmp = g_strdup_printf ("send_rtcp_src_%u", session->id);
- session->priv->rtpbin_send_rtcp_src =
- gst_element_get_request_pad (session->priv->conference->gstrtpbin, tmp);
-
- ret = gst_pad_link (session->priv->rtpbin_send_rtcp_src,
- transmitter_rtcp_tee_sink_pad);
-
- if (GST_PAD_LINK_FAILED (ret)) {
- tmp = g_strdup_printf ("Could not link pad %s (%p) with pad %s (%p)",
- GST_PAD_NAME (session->priv->rtpbin_send_rtcp_src),
- GST_PAD_CAPS (session->priv->rtpbin_send_rtcp_src),
- GST_PAD_NAME (transmitter_rtcp_tee_sink_pad),
- GST_PAD_CAPS (transmitter_rtcp_tee_sink_pad));
- fs_session_emit_error (FS_SESSION (session), FS_ERROR_CONSTRUCTION,
- "Could not link rtpbin network rtcp src to tee", tmp);
- g_free (tmp);
-
- gst_object_unref (transmitter_rtcp_tee_sink_pad);
- return;
- }
-
- gst_object_unref (transmitter_rtcp_tee_sink_pad);
-
-}
-
static gboolean
_get_request_pad_and_link (GstElement *tee_funnel, const gchar *tee_funnel_name,
GstElement *sinksrc, const gchar *sinksrc_padname, GstPadDirection direction,
diff --git a/gst/fsrtpconference/fs-rtp-session.h b/gst/fsrtpconference/fs-rtp-session.h
index 7bf7a62..6fabe5a 100644
--- a/gst/fsrtpconference/fs-rtp-session.h
+++ b/gst/fsrtpconference/fs-rtp-session.h
@@ -88,8 +88,6 @@ FsRtpSession *fs_rtp_session_new (FsMediaType media_type,
GstCaps *fs_rtp_session_request_pt_map (FsRtpSession *session, guint pt);
-void fs_rtp_session_link_network_sink (FsRtpSession *session, GstPad *pad);
-
void fs_rtp_session_new_recv_pad (FsRtpSession *session, GstPad *new_pad,
guint32 ssrc, guint pt);
--
1.5.6.5
More information about the farsight-commits
mailing list