rtpsession: Add new on-receiving-rtcp signal
authorSebastian Dröge <sebastian@centricular.com>
Fri, 30 Jan 2015 15:50:36 +0000 (16:50 +0100)
committerSebastian Dröge <sebastian@centricular.com>
Fri, 30 Jan 2015 15:50:36 +0000 (16:50 +0100)
This will be emitted whenever an RTCP packet is received. Different to
on-feedback-rtcp, this signal gets every complete RTCP packet and not
just the individual feedback packets.

gst/rtpmanager/rtpsession.c
gst/rtpmanager/rtpsession.h

index d5af155cca32bdcee9434d3e5b98efe73e2a3d70..cdcd686a015c220ba3aa450401b270831e4d1f00 100644 (file)
@@ -50,6 +50,7 @@ enum
   SIGNAL_ON_FEEDBACK_RTCP,
   SIGNAL_SEND_RTCP,
   SIGNAL_SEND_RTCP_FULL,
+  SIGNAL_ON_RECEIVING_RTCP,
   LAST_SIGNAL
 };
 
@@ -340,6 +341,22 @@ rtp_session_class_init (RTPSessionClass * klass)
       G_STRUCT_OFFSET (RTPSessionClass, send_rtcp), NULL, NULL,
       g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 1, G_TYPE_UINT64);
 
+  /**
+   * RTPSession::on-receiving-rtcp
+   * @session: the object which received the signal
+   * @buffer: the #GstBuffer containing the RTCP packet that was received
+   *
+   * This signal is emitted when receiving an RTCP packet before it is handled
+   * by the session. It can be used to extract custom information from RTCP packets.
+   *
+   * Since: 1.6
+   */
+  rtp_session_signals[SIGNAL_ON_RECEIVING_RTCP] =
+      g_signal_new ("on-sending-rtcp", G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (RTPSessionClass, on_receiving_rtcp),
+      NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 1,
+      GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE);
+
   g_object_class_install_property (gobject_class, PROP_INTERNAL_SSRC,
       g_param_spec_uint ("internal-ssrc", "Internal SSRC",
           "The internal SSRC used for the session (deprecated)",
@@ -2560,6 +2577,9 @@ rtp_session_process_rtcp (RTPSession * sess, GstBuffer * buffer,
 
   GST_DEBUG ("received RTCP packet");
 
+  g_signal_emit (sess, rtp_session_signals[SIGNAL_ON_RECEIVING_RTCP], 0,
+      buffer);
+
   RTP_SESSION_LOCK (sess);
   /* update pinfo stats */
   update_packet_info (sess, &pinfo, FALSE, FALSE, FALSE, buffer, current_time,
index 11763ac3cac229efb46ba5ff1e04fcb552cad81a..3f565a601f61ee9354ed4d1f3db985c1e386cc67 100644 (file)
@@ -302,6 +302,7 @@ struct _RTPSessionClass {
   void (*on_feedback_rtcp)  (RTPSession *sess, guint type, guint fbtype,
       guint sender_ssrc, guint media_ssrc, GstBuffer *fci);
   gboolean (*send_rtcp)     (RTPSession *sess, GstClockTime max_delay);
+  void (*on_receiving_rtcp) (RTPSession *sess, GstBuffer *buffer);
 };
 
 GType rtp_session_get_type (void);