From 4fb514de0b917e1bd8757ef456568f26caf0bcd5 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 27 Sep 2014 20:32:16 +0200 Subject: RTP bin SSRC callbacks --- src/pipelines.c | 10 ++++++++ src/sydra.c | 76 ++++++++++++++++++++++++++++----------------------------- 2 files changed, 48 insertions(+), 38 deletions(-) diff --git a/src/pipelines.c b/src/pipelines.c index 0ae2124..3a092a4 100644 --- a/src/pipelines.c +++ b/src/pipelines.c @@ -336,7 +336,15 @@ GstElement* create_sender_pipeline(options_t* opt, struct udp_sinks *udp) rtpbin. ! $V_DEPAY ! tee ! queue ! $V_DECODER ! tee ! queue ! $V_SINK rtpbin. ! $A_DEPAY ! tee ! queue ! $A_DECODER ! tee ! queue ! $A_SINK */ +static void rtp_new_ssrc(GstElement *rtpbin, guint session, guint ssrc, gpointer user_data) +{ + log_printf(DEBUG, "rtpbin: new SSRC %u for session %u", ssrc, session); +} +static void rtp_ssrc_validated(GstElement *rtpbin, guint session, guint ssrc, gpointer user_data) +{ + log_printf(DEBUG, "rtpbin: SSRC %u for session %u got validated", ssrc, session); +} GstElement* create_receiver_pipeline(options_t* opt, struct udp_sources *udp) { @@ -350,6 +358,8 @@ GstElement* create_receiver_pipeline(options_t* opt, struct udp_sources *udp) return NULL; } log_printf(DEBUG, "rtpbin created successfully!"); + g_signal_connect(rtp, "on-new-ssrc", G_CALLBACK(rtp_new_ssrc), NULL); + g_signal_connect(rtp, "on-ssrc-validated", G_CALLBACK(rtp_ssrc_validated), NULL); if(!create_udp_sources(opt, pipeline, rtp, udp)) { return NULL; diff --git a/src/sydra.c b/src/sydra.c index ca48724..22f0157 100644 --- a/src/sydra.c +++ b/src/sydra.c @@ -118,44 +118,44 @@ static gboolean bus_call(GstBus *bus, GstMessage *msg, gpointer data) (msg->src ? GST_OBJECT_NAME(msg->src) : "NULL"), running_time, stream_time, timestamp, duration); break; } - /* case GST_MESSAGE_STREAM_STATUS: */ - /* { */ - /* GstStreamStatusType type; */ - /* GstElement *owner; */ - /* const GValue *val; */ - /* gchar *path, *ownerstr; */ - /* GstTask *task = NULL; */ - - /* gst_message_parse_stream_status (msg, &type, &owner); */ - /* val = gst_message_get_stream_status_object (msg); */ - - /* path = gst_object_get_path_string (GST_MESSAGE_SRC (msg)); */ - /* ownerstr = gst_object_get_path_string (GST_OBJECT (owner)); */ - /* log_printf(DEBUG,"Recevied Stream-Status message type: %d, source: %s, owner: %s, object: type %s, value %p", */ - /* type, path, ownerstr, G_VALUE_TYPE_NAME (val), g_value_get_object (val)); */ - /* g_free (path); */ - /* g_free (ownerstr); */ - - /* /\* see if we know how to deal with this object *\/ */ - /* if (G_VALUE_TYPE (val) == GST_TYPE_TASK) { */ - /* task = g_value_get_object (val); */ - /* } */ - - /* switch (type) { */ - /* case GST_STREAM_STATUS_TYPE_CREATE: */ - /* log_printf(DEBUG," created task %p", task); */ - /* break; */ - /* case GST_STREAM_STATUS_TYPE_ENTER: */ - /* /\* log_printf(DEBUG," raising task priority"); *\/ */ - /* /\* setpriority (PRIO_PROCESS, 0, -10); *\/ */ - /* break; */ - /* case GST_STREAM_STATUS_TYPE_LEAVE: */ - /* break; */ - /* default: */ - /* break; */ - /* } */ - /* break; */ - /* } */ + case GST_MESSAGE_STREAM_STATUS: + { + GstStreamStatusType type; + GstElement *owner; + const GValue *val; + gchar *path, *ownerstr; + GstTask *task = NULL; + + gst_message_parse_stream_status (msg, &type, &owner); + val = gst_message_get_stream_status_object (msg); + + path = gst_object_get_path_string (GST_MESSAGE_SRC (msg)); + ownerstr = gst_object_get_path_string (GST_OBJECT (owner)); + log_printf(DEBUG,"Recevied Stream-Status message type: %d, source: %s, owner: %s, object: type %s, value %p", + type, path, ownerstr, G_VALUE_TYPE_NAME (val), g_value_get_object (val)); + g_free (path); + g_free (ownerstr); + + /* see if we know how to deal with this object */ + if (G_VALUE_TYPE (val) == GST_TYPE_TASK) { + task = g_value_get_object (val); + } + + switch (type) { + case GST_STREAM_STATUS_TYPE_CREATE: + log_printf(DEBUG," created task %p", task); + break; + case GST_STREAM_STATUS_TYPE_ENTER: + /* log_printf(DEBUG," raising task priority"); */ + /* setpriority (PRIO_PROCESS, 0, -10); */ + break; + case GST_STREAM_STATUS_TYPE_LEAVE: + break; + default: + break; + } + break; + } default: log_printf(DEBUG, "unkonwn message %s from %s", GST_MESSAGE_TYPE_NAME(msg), GST_MESSAGE_SRC_NAME(msg)); return TRUE; -- cgit v1.2.3