summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2014-10-06 23:08:13 +0200
committerChristian Pointner <equinox@spreadspace.org>2014-10-06 23:08:13 +0200
commit0cc548592de9611655f4c680d56ce73bcb38ab9a (patch)
treed9a4bca150e5b14922fbc8744d6825ce96a0a0af
parentfixed rtp reflector init (diff)
closing application when new SSRC shows up (although all depayloader are already connected)
closing application when session times out
-rw-r--r--src/pipelines.c32
-rw-r--r--src/sydra-rtp.c12
2 files changed, 43 insertions, 1 deletions
diff --git a/src/pipelines.c b/src/pipelines.c
index 55054f8..c08c11f 100644
--- a/src/pipelines.c
+++ b/src/pipelines.c
@@ -496,11 +496,39 @@ static void rtpbin_pad_added(GstElement* rtp, GstPad* pad, gpointer user_data)
break;
}
if(!gst_pad_is_linked(pad)) {
- log_printf(ERROR, "rtpbin: no compatible depayloader found for pad %s", src_pad_name);
+ log_printf(ERROR, "rtpbin: no compatible depayloader found for pad %s (or all depayloader already connected)", src_pad_name);
+ GstStructure* ms = gst_structure_new("sydra-rtp", "quit", G_TYPE_BOOLEAN, TRUE, "reason",
+ G_TYPE_STRING, "New RTP Session but all depayloader are already connected or none compatible found", NULL);
+ GstMessage* msg = gst_message_new_application(GST_OBJECT(rtp), ms);
+ if(!ms || ! msg)
+ log_printf(ERROR, "rtpbin: message creation failed!");
+ else {
+ if(!gst_element_post_message(rtp, msg))
+ log_printf(ERROR, "rtpbin: sending message to the application failed: no bus");
+ }
}
g_free(src_pad_name);
}
+static void rtp_new_ssrc(GstElement *rtp, guint session, guint ssrc, gpointer user_data)
+{
+ log_printf(INFO, "rtpbin: new SSRC %u for session %u", ssrc, session);
+}
+
+static void rtp_ssrc_timeout(GstElement *rtp, guint session, guint ssrc, gpointer user_data)
+{
+ log_printf(INFO, "rtpbin: SSRC %u of session %u timed out", ssrc, session);
+ GstStructure* ms = gst_structure_new("sydra-rtp", "quit", G_TYPE_BOOLEAN, TRUE, "reason",
+ G_TYPE_STRING, "RTP session timed out", NULL);
+ GstMessage* msg = gst_message_new_application(GST_OBJECT(rtp), ms);
+ if(!ms || ! msg)
+ log_printf(ERROR, "rtpbin: message creation failed!");
+ else {
+ if(!gst_element_post_message(rtp, msg))
+ log_printf(ERROR, "rtpbin: sending message to the application failed: no bus");
+ }
+}
+
GstElement* create_receiver_pipeline(options_t* opt, struct udp_sources *udp)
{
GstElement *pipeline = gst_pipeline_new ("sydra-rtp-receiver");
@@ -531,6 +559,8 @@ GstElement* create_receiver_pipeline(options_t* opt, struct udp_sources *udp)
depays[0] = video.payloader_;
depays[1] = audio.payloader_;
g_signal_connect_closure(rtp, "pad-added", g_cclosure_new(G_CALLBACK(rtpbin_pad_added), depays, NULL), FALSE);
+ g_signal_connect(rtp, "on-new-ssrc", G_CALLBACK(rtp_new_ssrc), NULL);
+ g_signal_connect(rtp, "on-timeout", G_CALLBACK(rtp_ssrc_timeout), NULL);
if(opt->rec_mux_) {
if(!create_recorder_elements(opt, pipeline, &video, &audio))
diff --git a/src/sydra-rtp.c b/src/sydra-rtp.c
index de65e25..dc6c3c7 100644
--- a/src/sydra-rtp.c
+++ b/src/sydra-rtp.c
@@ -72,6 +72,18 @@ static gboolean bus_call(GstBus *bus, GstMessage *msg, gpointer data)
g_main_loop_quit(loop);
break;
}
+ case GST_MESSAGE_APPLICATION: {
+ log_printf(DEBUG, "Got Application Message!");
+ const GstStructure* ms = gst_message_get_structure(msg);
+ gboolean quit;
+ gst_structure_get_boolean(ms, "quit", &quit);
+ if(quit) {
+ const gchar* reason = gst_structure_get_string (ms, "reason");
+ log_printf(NOTICE, "closing due to message: %s", reason);
+ g_main_loop_quit(loop);
+ }
+ break;
+ }
case GST_MESSAGE_INFO: {
GError *info;
gst_message_parse_info(msg, &info, NULL);