diff options
author | Christian Pointner <equinox@spreadspace.org> | 2014-10-06 23:08:13 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2014-10-06 23:08:13 +0200 |
commit | 0cc548592de9611655f4c680d56ce73bcb38ab9a (patch) | |
tree | d9a4bca150e5b14922fbc8744d6825ce96a0a0af /src/pipelines.c | |
parent | fixed rtp reflector init (diff) |
closing application when new SSRC shows up (although all depayloader are already connected)
closing application when session times out
Diffstat (limited to 'src/pipelines.c')
-rw-r--r-- | src/pipelines.c | 32 |
1 files changed, 31 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)) |