From 987580746fefae041b6d62e0c2d1cc44fdc1763b Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 6 Oct 2014 20:47:14 +0200 Subject: fixed rtp reflector init --- doc/sydra-rtp.8 | 16 ++++++++++++++-- doc/sydra-rtp.8.txt | 11 +++++++++++ src/pipelines.c | 31 +++++++++++++------------------ src/utils.c | 7 +++++++ src/utils.h | 1 + 5 files changed, 46 insertions(+), 20 deletions(-) diff --git a/doc/sydra-rtp.8 b/doc/sydra-rtp.8 index a768495..ceadcb9 100644 --- a/doc/sydra-rtp.8 +++ b/doc/sydra-rtp.8 @@ -2,12 +2,12 @@ .\" Title: sydra-rtp .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 10/02/2014 +.\" Date: 10/03/2014 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "SYDRA\-RTP" "8" "10/02/2014" "\ \&" "\ \&" +.TH "SYDRA\-RTP" "8" "10/03/2014" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -60,6 +60,8 @@ sydra\-rtp [ \fB\-o|\-\-rtp\-port\-base\fR ] [ \fB\-A|\-\-rtp\-addr\-local\fR
] [ \fB\-O|\-\-rtp\-port\-base\-local\fR ] + [ \fB\-\-rtp\-host\-reflector\fR ] + [ \fB\-\-rtp\-port\-base\-reflector\fR ] [ \fB\-c|\-\-no\-auto\-client\fR ] [ \fB\-t|\-\-timeout\fR ] [ \fB\-k|\-\-keepalive\-interval\fR ] @@ -328,6 +330,16 @@ The local address to wait for incoming UDP messages\&. Leave empty to listen on The base number for local ports to bind to\&. The same mapping as for the remote port\-base is used to map incoming RTP packets to the RTP bin\&. .RE .PP +\fB\-\-rtp\-host\-reflector \fR +.RS 4 +When in receiver mode the incoming RTP packets will get reflected to this host\&. Leave empty to disable RTP packet reflection\&. +.RE +.PP +\fB\-\-rtp\-port\-base\-reflector \fR +.RS 4 +When a reflector\-host gets specified using the option above the RTP packets will get sent to the ports based on this\&. The same mapping as with the other port\-base options is used\&. +.RE +.PP \fB\-c, \-\-no\-auto\-client\fR .RS 4 This disables auto\-detection for clients in diff --git a/doc/sydra-rtp.8.txt b/doc/sydra-rtp.8.txt index 31c1585..7d9c88b 100644 --- a/doc/sydra-rtp.8.txt +++ b/doc/sydra-rtp.8.txt @@ -39,6 +39,8 @@ sydra-rtp [ -o|--rtp-port-base ] [ -A|--rtp-addr-local
] [ -O|--rtp-port-base-local ] + [ --rtp-host-reflector ] + [ --rtp-port-base-reflector ] [ -c|--no-auto-client ] [ -t|--timeout ] [ -k|--keepalive-interval ] @@ -214,6 +216,15 @@ The following options can be passed to the *sydra-rtp* daemon: The base number for local ports to bind to. The same mapping as for the remote port-base is used to map incoming RTP packets to the RTP bin. +*--rtp-host-reflector *:: + When in receiver mode the incoming RTP packets will get reflected to this host. Leave empty + to disable RTP packet reflection. + +*--rtp-port-base-reflector *:: + When a reflector-host gets specified using the option above the RTP packets will get sent to + the ports based on this. The same mapping as with the other port-base options is used. + + *-c, --no-auto-client*:: This disables auto-detection for clients in 'sender' mode. Mind that if you disable the automatic client detection and also omit the rtp-host option *sydra-rtp* won't send any RTP diff --git a/src/pipelines.c b/src/pipelines.c index c8eae3e..55054f8 100644 --- a/src/pipelines.c +++ b/src/pipelines.c @@ -243,10 +243,14 @@ static gboolean create_rtp_reflector(options_t* opt, GstElement* pipeline, struc log_printf(INFO, "udp reflector sinks created successfully!"); int rtp_port_reflector = opt->rtp_port_base_reflector_; - g_object_set(G_OBJECT(rtp_video), "host", opt->rtp_host_reflector_, "port", rtp_port_reflector++, "sync", FALSE, NULL); - g_object_set(G_OBJECT(rtcp_video), "host", opt->rtp_host_reflector_, "port", rtp_port_reflector++, "sync", FALSE, NULL); - g_object_set(G_OBJECT(rtp_audio), "host", opt->rtp_host_reflector_, "port", rtp_port_reflector++, "sync", FALSE, NULL); - g_object_set(G_OBJECT(rtcp_audio), "host", opt->rtp_host_reflector_, "port", rtp_port_reflector++, "sync", FALSE, NULL); + g_object_set(G_OBJECT(rtp_video), "host", opt->rtp_host_reflector_, "port", rtp_port_reflector++, + "sync", FALSE, "async", FALSE, NULL); + g_object_set(G_OBJECT(rtcp_video), "host", opt->rtp_host_reflector_, "port", rtp_port_reflector++, + "sync", FALSE, "async", FALSE, NULL); + g_object_set(G_OBJECT(rtp_audio), "host", opt->rtp_host_reflector_, "port", rtp_port_reflector++, + "sync", FALSE, "async", FALSE, NULL); + g_object_set(G_OBJECT(rtcp_audio), "host", opt->rtp_host_reflector_, "port", rtp_port_reflector++, + "sync", FALSE, "async", FALSE, NULL); log_printf(INFO, "udp reflector sinks configured successfully!"); @@ -275,19 +279,15 @@ static gboolean create_udp_sources(options_t* opt, GstElement* pipeline, GstElem sources->rtp_video_ = sydra_create_element("udpsrc", "udprtpv"); tees.rtpv_ = sydra_create_element("tee", "rtpvt"); - GstElement* qrtpv = sydra_create_element("queue", NULL); sources->rtcp_video_ = sydra_create_element("udpsrc", "udprtcpv"); tees.rtcpv_ = sydra_create_element("tee", "rtcpvt"); - GstElement* qrtcpv = sydra_create_element("queue", NULL); sources->rtp_audio_ = sydra_create_element("udpsrc", "udprtpa"); tees.rtpa_ = sydra_create_element("tee", "rtpat"); - GstElement* qrtpa = sydra_create_element("queue", NULL); sources->rtcp_audio_ = sydra_create_element("udpsrc", "udprtcpa"); tees.rtcpa_ = sydra_create_element("tee", "rtcpat"); - GstElement* qrtcpa = sydra_create_element("queue", NULL); if(!(sources->rtp_video_) || !(sources->rtcp_video_) || !(sources->rtp_audio_) || !(sources->rtcp_audio_) || - !(tees.rtpv_) || !(tees.rtcpv_) || !(tees.rtpa_) || !(tees.rtcpa_) || !qrtpv || !qrtcpv || !qrtpa || !qrtcpa) + !(tees.rtpv_) || !(tees.rtcpv_) || !(tees.rtpa_) || !(tees.rtcpa_)) return FALSE; log_printf(INFO, "udp sources created successfully!"); @@ -317,21 +317,16 @@ static gboolean create_udp_sources(options_t* opt, GstElement* pipeline, GstElem gst_bin_add_many(GST_BIN(pipeline), sources->rtp_video_, sources->rtcp_video_, sources->rtp_audio_, sources->rtcp_audio_, NULL); gst_bin_add_many(GST_BIN(pipeline), tees.rtpv_, tees.rtcpv_, tees.rtpa_, tees.rtcpa_, NULL); - gst_bin_add_many(GST_BIN(pipeline), qrtpv, qrtcpv, qrtpa, qrtcpa, NULL); gst_element_link(sources->rtp_video_, tees.rtpv_); gst_element_link(sources->rtcp_video_, tees.rtcpv_); gst_element_link(sources->rtp_audio_, tees.rtpa_); gst_element_link(sources->rtcp_audio_, tees.rtcpa_); - if(!sydra_link_request_static(tees.rtpv_, "src_%u", qrtpv, "sink") || - !sydra_link_static_request(qrtpv, "src", rtp, "recv_rtp_sink_0") || - !sydra_link_request_static(tees.rtcpv_, "src_%u", qrtcpv, "sink") || - !sydra_link_static_request(qrtcpv, "src", rtp, "recv_rtcp_sink_0") || - !sydra_link_request_static(tees.rtpa_, "src_%u", qrtpa, "sink") || - !sydra_link_static_request(qrtpa, "src", rtp, "recv_rtp_sink_1") || - !sydra_link_request_static(tees.rtcpa_, "src_%u", qrtcpa, "sink") || - !sydra_link_static_request(qrtcpa, "src", rtp, "recv_rtcp_sink_1")) + if(!sydra_link_request_request(tees.rtpv_, "src_%u", rtp, "recv_rtp_sink_0") || + !sydra_link_request_request(tees.rtcpv_, "src_%u", rtp, "recv_rtcp_sink_0") || + !sydra_link_request_request(tees.rtpa_, "src_%u", rtp, "recv_rtp_sink_1") || + !sydra_link_request_request(tees.rtcpa_, "src_%u", rtp, "recv_rtcp_sink_1")) return FALSE; log_printf(INFO, "udp sources linked successfully!"); diff --git a/src/utils.c b/src/utils.c index 443ab62..0797c20 100644 --- a/src/utils.c +++ b/src/utils.c @@ -98,6 +98,13 @@ static gboolean sydra_link_pads(GstElement* src, GstPad* src_pad, const char* sr return TRUE; } +gboolean sydra_link_request_request(GstElement* src, const char* src_pad_name, GstElement* sink, const char* sink_pad_name) +{ + GstPad *src_pad = gst_element_get_request_pad(src, src_pad_name); + GstPad *sink_pad = gst_element_get_request_pad(sink, sink_pad_name); + return sydra_link_pads(src, src_pad, src_pad_name, sink, sink_pad, sink_pad_name); +} + gboolean sydra_link_request_static(GstElement* src, const char* src_pad_name, GstElement* sink, const char* sink_pad_name) { GstPad *src_pad = gst_element_get_request_pad(src, src_pad_name); diff --git a/src/utils.h b/src/utils.h index 215efed..b4693c0 100644 --- a/src/utils.h +++ b/src/utils.h @@ -40,6 +40,7 @@ gint cmp_udp_client(gconstpointer A, gconstpointer B); GstElement* sydra_create_bin_from_desc(const char* name, const char* desc, gboolean ghost_unlinked_pads); GstElement* sydra_create_element(const char* type, const char* name); +gboolean sydra_link_request_request(GstElement* src, const char* src_pad_name, GstElement* sink, const char* sink_pad_name); gboolean sydra_link_request_static(GstElement* src, const char* src_pad_name, GstElement* sink, const char* sink_pad_name); gboolean sydra_link_static_request(GstElement* src, const char* src_pad_name, GstElement* sink, const char* sink_pad_name); gboolean sydra_link_static_static(GstElement* src, const char* src_pad_name, GstElement* sink, const char* sink_pad_name); -- cgit v1.2.3