diff options
author | Stian Selnes <stian@pexip.com> | 2015-11-17 18:17:35 +0100 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2016-03-30 15:42:01 +0300 |
commit | 4c0e50932863fdeed376d92e92946e282ba9eab2 (patch) | |
tree | 91d27d3f846443fca0223ed6c77911aa533be7a3 /gst/rtpmanager/rtpsession.c | |
parent | eb13a1d6076212d85e1093ed18840a4704771347 (diff) |
rtpsession: Add new signal 'on-app-rtcp'
Similar to the 'on-feedback-rtcp' signal, but emitted for RTCP APP
packets.
https://bugzilla.gnome.org/show_bug.cgi?id=762217
Diffstat (limited to 'gst/rtpmanager/rtpsession.c')
-rw-r--r-- | gst/rtpmanager/rtpsession.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/gst/rtpmanager/rtpsession.c b/gst/rtpmanager/rtpsession.c index 75908c00e..3c26e3467 100644 --- a/gst/rtpmanager/rtpsession.c +++ b/gst/rtpmanager/rtpsession.c @@ -47,6 +47,7 @@ enum SIGNAL_ON_TIMEOUT, SIGNAL_ON_SENDER_TIMEOUT, SIGNAL_ON_SENDING_RTCP, + SIGNAL_ON_APP_RTCP, SIGNAL_ON_FEEDBACK_RTCP, SIGNAL_SEND_RTCP, SIGNAL_SEND_RTCP_FULL, @@ -297,6 +298,23 @@ rtp_session_class_init (RTPSessionClass * klass) GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE, G_TYPE_BOOLEAN); /** + * RTPSession::on-app-rtcp: + * @session: the object which received the signal + * @subtype: The subtype of the packet + * @ssrc: The SSRC/CSRC of the packet + * @name: The name of the packet + * @data: a #GstBuffer with the application-dependant data or %NULL if + * there was no data + * + * Notify that a RTCP APP packet has been received + */ + rtp_session_signals[SIGNAL_ON_APP_RTCP] = + g_signal_new ("on-app-rtcp", G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (RTPSessionClass, on_app_rtcp), + NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 4, + G_TYPE_UINT, G_TYPE_UINT, G_TYPE_STRING, GST_TYPE_BUFFER); + + /** * RTPSession::on-feedback-rtcp: * @session: the object which received the signal * @type: Type of RTCP packet, will be %GST_RTCP_TYPE_RTPFB or @@ -2517,6 +2535,33 @@ rtp_session_process_app (RTPSession * sess, GstRTCPPacket * packet, RTPPacketInfo * pinfo) { GST_DEBUG ("received APP"); + + if (g_signal_has_handler_pending (sess, + rtp_session_signals[SIGNAL_ON_APP_RTCP], 0, TRUE)) { + GstBuffer *data_buffer = NULL; + guint16 data_length; + gchar name[5]; + + data_length = gst_rtcp_packet_app_get_data_length (packet) * 4; + if (data_length > 0) { + guint8 *data = gst_rtcp_packet_app_get_data (packet); + data_buffer = gst_buffer_copy_region (packet->rtcp->buffer, + GST_BUFFER_COPY_MEMORY, data - packet->rtcp->map.data, data_length); + GST_BUFFER_PTS (data_buffer) = pinfo->running_time; + } + + memcpy (name, gst_rtcp_packet_app_get_name (packet), 4); + name[4] = '\0'; + + RTP_SESSION_UNLOCK (sess); + g_signal_emit (sess, rtp_session_signals[SIGNAL_ON_APP_RTCP], 0, + gst_rtcp_packet_app_get_subtype (packet), + gst_rtcp_packet_app_get_ssrc (packet), name, data_buffer); + RTP_SESSION_LOCK (sess); + + if (data_buffer) + gst_buffer_unref (data_buffer); + } } static gboolean |