[farsight2/master] Default the rtcp port to rtp port + 1, pass the right parameters to various functions, store pointers to tee and funnel in UdpPort for convenience
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 23 15:19:33 PST 2008
---
transmitters/rawudp/fs-rawudp-stream-transmitter.c | 11 ++++--
transmitters/rawudp/fs-rawudp-transmitter.c | 38 +++++++++++--------
2 files changed, 30 insertions(+), 19 deletions(-)
diff --git a/transmitters/rawudp/fs-rawudp-stream-transmitter.c b/transmitters/rawudp/fs-rawudp-stream-transmitter.c
index 402774d..0ef06b1 100644
--- a/transmitters/rawudp/fs-rawudp-stream-transmitter.c
+++ b/transmitters/rawudp/fs-rawudp-stream-transmitter.c
@@ -462,7 +462,7 @@ fs_rawudp_stream_transmitter_build (FsRawUdpStreamTransmitter *self,
GError **error)
{
const gchar *ip = NULL, *rtcp_ip = NULL;
- guint port = 0, rtcp_port = 0;
+ guint port = 7078, rtcp_port = 0;
GList *item;
for (item = g_list_first (self->priv->prefered_local_candidates);
@@ -513,6 +513,10 @@ fs_rawudp_stream_transmitter_build (FsRawUdpStreamTransmitter *self,
if (!self->priv->rtp_udpport)
return FALSE;
+ if (!rtcp_port)
+ rtcp_port = fs_rawudp_transmitter_udpport_get_port (
+ self->priv->rtp_udpport) + 1;
+
self->priv->rtcp_udpport =
fs_rawudp_transmitter_get_udpport (self->priv->transmitter,
FS_COMPONENT_RTCP, rtcp_ip, rtcp_port, error);
@@ -609,7 +613,7 @@ fs_rawudp_stream_transmitter_add_remote_candidate (
case FS_COMPONENT_RTCP:
if (self->priv->sending) {
- fs_rawudp_transmitter_udpport_add_dest (self->priv->rtp_udpport,
+ fs_rawudp_transmitter_udpport_add_dest (self->priv->rtcp_udpport,
candidate->ip, candidate->port);
}
if (self->priv->remote_rtcp_candidate) {
@@ -961,6 +965,7 @@ fs_rawudp_stream_transmitter_emit_local_candidates (
current;
current = g_list_next(current)) {
FsCandidate *candidate = g_new0 (FsCandidate, 1);
+
candidate->candidate_id = g_strdup_printf ("L%u",
self->priv->next_candidate_id++);
candidate->component_id = component_id;
@@ -1058,7 +1063,7 @@ fs_rawudp_stream_transmitter_maybe_new_active_candidate_pair (
switch (component_id) {
case FS_COMPONENT_RTP:
if (self->priv->local_active_rtp_candidate &&
- self->priv->remote_rtcp_candidate) {
+ self->priv->remote_rtp_candidate) {
g_signal_emit_by_name (self, "new-active-candidate-pair",
self->priv->local_active_rtp_candidate,
self->priv->remote_rtp_candidate);
diff --git a/transmitters/rawudp/fs-rawudp-transmitter.c b/transmitters/rawudp/fs-rawudp-transmitter.c
index b1b8c8c..ee46d3f 100644
--- a/transmitters/rawudp/fs-rawudp-transmitter.c
+++ b/transmitters/rawudp/fs-rawudp-transmitter.c
@@ -416,6 +416,10 @@ struct _UdpPort {
gint fd;
+ /* These are just convenience pointers to our parent transmitter */
+ GstElement *funnel;
+ GstElement *tee;
+
guint component_id;
};
@@ -607,20 +611,23 @@ fs_rawudp_transmitter_get_udpport (FsRawUdpTransmitter *trans,
/* Now lets create the elements */
+ if (component_id == FS_COMPONENT_RTP) {
+ udpport->tee = trans->priv->udpsink_tee;
+ udpport->funnel = trans->priv->udpsrc_funnel;
+ } else if (component_id == FS_COMPONENT_RTCP) {
+ udpport->tee = trans->priv->udprtcpsink_tee;
+ udpport->funnel = trans->priv->udprtcpsrc_funnel;
+ }
+
udpport->udpsrc = _create_sinksource ("udpsrc",
- GST_BIN (trans->priv->gst_src), trans->priv->udpsrc_funnel,
- udpport->fd, GST_PAD_SRC, NULL, &udpport->udpsrc_requested_pad,
- error);
+ GST_BIN (trans->priv->gst_src), udpport->funnel, udpport->fd, GST_PAD_SRC,
+ &udpport->udpsrc_requested_pad, error);
if (!udpport->udpsrc)
goto error;
- if (component_id == FS_COMPONENT_RTP)
- queue = &udpport->queue;
-
- udpport->udpsink = _create_sinksource ("udpsink",
- GST_BIN (trans->priv->gst_sink), trans->priv->udpsink_tee,
- udpport->fd, GST_PAD_SINK, queue, &udpport->udpsink_requested_pad,
- error);
+ udpport->udpsink = _create_sinksource ("multiudpsink",
+ GST_BIN (trans->priv->gst_sink), udpport->tee, udpport->fd, GST_PAD_SINK,
+ &udpport->udpsink_requested_pad, error);
if (!udpport->udpsink)
goto error;
@@ -667,7 +674,7 @@ fs_rawudp_transmitter_put_udpport (FsRawUdpTransmitter *trans,
}
if (udpport->udpsrc_requested_pad) {
- gst_element_release_request_pad (trans->priv->udpsrc_funnel,
+ gst_element_release_request_pad (udpport->funnel,
udpport->udpsrc_requested_pad);
}
@@ -683,7 +690,7 @@ fs_rawudp_transmitter_put_udpport (FsRawUdpTransmitter *trans,
}
if (udpport->udpsink_requested_pad) {
- gst_element_release_request_pad (trans->priv->udpsink_tee,
+ gst_element_release_request_pad (udpport->tee,
udpport->udpsink_requested_pad);
}
@@ -698,8 +705,8 @@ void
fs_rawudp_transmitter_udpport_add_dest (UdpPort *udpport,
const gchar *ip, gint port)
{
- g_signal_emit_by_name (udpport->udpsink, "add", 0,
- ip, port, NULL);
+ g_debug ("Adding dest %s:%d", ip, port);
+ g_signal_emit_by_name (udpport->udpsink, "add", ip, port);
}
@@ -707,8 +714,7 @@ void
fs_rawudp_transmitter_udpport_remove_dest (UdpPort *udpport,
const gchar *ip, gint port)
{
- g_signal_emit_by_name (udpport->udpsink, "remove", 0,
- ip, port, NULL);
+ g_signal_emit_by_name (udpport->udpsink, "remove", ip, port);
}
gboolean
--
1.5.6.5
More information about the farsight-commits
mailing list