summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2014-09-24 01:01:27 +0200
committerChristian Pointner <equinox@spreadspace.org>2014-09-24 01:01:27 +0200
commit8be88489308742b36789b120f7b3ae2e09a878b1 (patch)
treed466f8db8ce5cfbb58687bc2f398a23f596f8b14 /src
parentadding host to udp sink when incoming packet is seen works now (diff)
make rtp-host and port optional
Diffstat (limited to 'src')
-rw-r--r--src/options.c2
-rw-r--r--src/sydra.c32
2 files changed, 18 insertions, 16 deletions
diff --git a/src/options.c b/src/options.c
index e090bdd..60ee6e5 100644
--- a/src/options.c
+++ b/src/options.c
@@ -271,7 +271,7 @@ void options_default(options_t* opt)
opt->audio_enc_ = strdup("opusenc bitrate=64000 cbr=true packet-loss-percentage=0 inband-fec=false");
opt->audio_payloader_ = strdup("rtpopuspay");
- opt->rtp_host_ = strdup("127.0.0.1");
+ opt->rtp_host_ = NULL;
opt->rtp_port_base_ = 5000;
opt->rtp_addr_local_ = NULL;
opt->rtp_port_base_local_ = 5000;
diff --git a/src/sydra.c b/src/sydra.c
index faa6641..ab1176d 100644
--- a/src/sydra.c
+++ b/src/sydra.c
@@ -310,27 +310,29 @@ struct udp_elements {
static gboolean create_udp_elements(options_t* opt, GstElement* pipeline, GstElement* rtp, struct udp_elements *udp)
{
- udp->rtp_video_ = sydra_create_element("udpsink", "udprtpv");
- udp->rtcp_video_ = sydra_create_element("udpsink", "udprtcpv");
- udp->rtp_audio_ = sydra_create_element("udpsink", "udprtpa");
- udp->rtcp_audio_ = sydra_create_element("udpsink", "udprtcpa");
+ udp->rtp_video_ = sydra_create_element("multiudpsink", "udprtpv");
+ udp->rtcp_video_ = sydra_create_element("multiudpsink", "udprtcpv");
+ udp->rtp_audio_ = sydra_create_element("multiudpsink", "udprtpa");
+ udp->rtcp_audio_ = sydra_create_element("multiudpsink", "udprtcpa");
if(!udp->rtp_video_ || !udp->rtcp_video_ || !udp->rtp_audio_ || !udp->rtcp_audio_)
return FALSE;
log_printf(DEBUG, "udp elements created successfully!");
- int rtp_port = opt->rtp_port_base_;
int rtp_port_local = opt->rtp_port_base_local_;
- g_object_set(G_OBJECT(udp->rtp_video_), "host", opt->rtp_host_, "port", rtp_port++,
- "bind-port", rtp_port_local++, NULL);
- g_object_set(G_OBJECT(udp->rtcp_video_), "host", opt->rtp_host_, "port", rtp_port++,
- "bind-port", rtp_port_local++, "sync", FALSE, "async", FALSE, NULL);
- g_object_set(G_OBJECT(udp->rtp_audio_), "host", opt->rtp_host_, "port", rtp_port++,
- "bind-port", rtp_port_local++, NULL);
- g_object_set(G_OBJECT(udp->rtcp_audio_), "host", opt->rtp_host_, "port", rtp_port++,
- "bind-port", rtp_port_local++, "sync", FALSE, "async", FALSE, NULL);
-
+ g_object_set(G_OBJECT(udp->rtp_video_), "bind-port", rtp_port_local++, NULL);
+ g_object_set(G_OBJECT(udp->rtcp_video_), "bind-port", rtp_port_local++, "sync", FALSE, "async", FALSE, NULL);
+ g_object_set(G_OBJECT(udp->rtp_audio_), "bind-port", rtp_port_local++, NULL);
+ g_object_set(G_OBJECT(udp->rtcp_audio_), "bind-port", rtp_port_local++, "sync", FALSE, "async", FALSE, NULL);
+
+ if(opt->rtp_host_) {
+ int rtp_port = opt->rtp_port_base_;
+ g_signal_emit_by_name(G_OBJECT(udp->rtp_video_), "add", opt->rtp_host_, rtp_port++, NULL);
+ g_signal_emit_by_name(G_OBJECT(udp->rtcp_video_), "add", opt->rtp_host_, rtp_port++, NULL);
+ g_signal_emit_by_name(G_OBJECT(udp->rtp_audio_), "add", opt->rtp_host_, rtp_port++, NULL);
+ g_signal_emit_by_name(G_OBJECT(udp->rtcp_audio_), "add", opt->rtp_host_, rtp_port++, NULL);
+ }
if(opt->rtp_addr_local_) {
g_object_set(G_OBJECT(udp->rtp_video_), "bind-address", opt->rtp_addr_local_, NULL);
g_object_set(G_OBJECT(udp->rtcp_video_), "bind-address", opt->rtp_addr_local_, NULL);
@@ -499,7 +501,7 @@ static void udp_add_client(struct sockaddr_storage *addr, socklen_t addrlen, Gst
gchar* name = gst_element_get_name(udp);
log_printf(DEBUG, "adding host %s%c%d to list of receivers to element %s", addrstr, addrport_sep, port, name);
g_free(name);
- g_signal_emit_by_name(udp, "add", addrstr, port, NULL);
+ g_signal_emit_by_name(G_OBJECT(udp), "add", addrstr, port, NULL);
}
static gboolean on_udp_desc_ready(gint fd, GIOCondition cond, gpointer user_data)