Allows for applications to get internal source's RTP statistics.
(eg. sender sources for a server/client)
https://bugzilla.gnome.org/show_bug.cgi?id=746747
guint arg1
</SIGNAL>
+<SIGNAL>
+<NAME>GstRtpBin::on-new-sender-ssrc</NAME>
+<RETURNS>void</RETURNS>
+<FLAGS>l</FLAGS>
+GstRtpBin *gstrtpbin
+guint arg1
+guint arg2
+</SIGNAL>
+
+<SIGNAL>
+<NAME>GstRtpBin::on-sender-ssrc-active</NAME>
+<RETURNS>void</RETURNS>
+<FLAGS>l</FLAGS>
+GstRtpBin *gstrtpbin
+guint arg1
+guint arg2
+</SIGNAL>
+
<SIGNAL>
<NAME>GstRtpJitterBuffer::clear-pt-map</NAME>
<RETURNS>void</RETURNS>
guint arg1
</SIGNAL>
+<SIGNAL>
+<NAME>GstRtpSession::on-new-sender-ssrc</NAME>
+<RETURNS>void</RETURNS>
+<FLAGS>l</FLAGS>
+GstRtpSession *gstrtpsession
+guint arg1
+</SIGNAL>
+
+<SIGNAL>
+<NAME>GstRtpSession::on-sender-ssrc-active</NAME>
+<RETURNS>void</RETURNS>
+<FLAGS>l</FLAGS>
+GstRtpSession *gstrtpsession
+guint arg1
+</SIGNAL>
+
<SIGNAL>
<NAME>GstRtpSsrcDemux::clear-ssrc</NAME>
<RETURNS>void</RETURNS>
SIGNAL_REQUEST_AUX_SENDER,
SIGNAL_REQUEST_AUX_RECEIVER,
+ SIGNAL_ON_NEW_SENDER_SSRC,
+ SIGNAL_ON_SENDER_SSRC_ACTIVE,
+
LAST_SIGNAL
};
stream->session->id, stream->ssrc);
}
+static void
+on_new_sender_ssrc (GstElement * session, guint32 ssrc, GstRtpBinSession * sess)
+{
+ g_signal_emit (sess->bin, gst_rtp_bin_signals[SIGNAL_ON_NEW_SENDER_SSRC], 0,
+ sess->id, ssrc);
+}
+
+static void
+on_sender_ssrc_active (GstElement * session, guint32 ssrc,
+ GstRtpBinSession * sess)
+{
+ g_signal_emit (sess->bin, gst_rtp_bin_signals[SIGNAL_ON_SENDER_SSRC_ACTIVE],
+ 0, sess->id, ssrc);
+}
+
/* must be called with the SESSION lock */
static GstRtpBinStream *
find_stream_by_ssrc (GstRtpBinSession * session, guint32 ssrc)
g_signal_connect (sess->session, "on-timeout", (GCallback) on_timeout, sess);
g_signal_connect (sess->session, "on-sender-timeout",
(GCallback) on_sender_timeout, sess);
+ g_signal_connect (sess->session, "on-new-sender-ssrc",
+ (GCallback) on_new_sender_ssrc, sess);
+ g_signal_connect (sess->session, "on-sender-ssrc-active",
+ (GCallback) on_sender_ssrc_active, sess);
gst_bin_add (GST_BIN_CAST (rtpbin), session);
gst_bin_add (GST_BIN_CAST (rtpbin), demux);
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstRtpBinClass,
request_aux_receiver), _gst_element_accumulator, NULL,
g_cclosure_marshal_generic, GST_TYPE_ELEMENT, 1, G_TYPE_UINT);
+ /**
+ * GstRtpBin::on-new-sender-ssrc:
+ * @rtpbin: the object which received the signal
+ * @session: the session
+ * @ssrc: the sender SSRC
+ *
+ * Since: 1.8
+ *
+ * Notify of a new sender SSRC that entered @session.
+ */
+ gst_rtp_bin_signals[SIGNAL_ON_NEW_SENDER_SSRC] =
+ g_signal_new ("on-new-sender-ssrc", G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstRtpBinClass, on_new_sender_ssrc),
+ NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 2, G_TYPE_UINT,
+ G_TYPE_UINT);
+ /**
+ * GstRtpBin::on-ssrc-active:
+ * @rtpbin: the object which received the signal
+ * @session: the session
+ * @ssrc: the sender SSRC
+ *
+ * Since: 1.8
+ *
+ * Notify of a sender SSRC that is active, i.e., sending RTCP.
+ */
+ gst_rtp_bin_signals[SIGNAL_ON_SENDER_SSRC_ACTIVE] =
+ g_signal_new ("on-sender-ssrc-active", G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstRtpBinClass,
+ on_sender_ssrc_active), NULL, NULL, g_cclosure_marshal_generic,
+ G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT);
g_object_class_install_property (gobject_class, PROP_SDES,
g_param_spec_boxed ("sdes", "SDES",
GstElement* (*request_aux_sender) (GstRtpBin *rtpbin, guint session);
GstElement* (*request_aux_receiver) (GstRtpBin *rtpbin, guint session);
+
+ void (*on_new_sender_ssrc) (GstRtpBin *rtpbin, guint session, guint32 ssrc);
+ void (*on_sender_ssrc_active) (GstRtpBin *rtpbin, guint session, guint32 ssrc);
};
GType gst_rtp_bin_get_type (void);
SIGNAL_ON_BYE_TIMEOUT,
SIGNAL_ON_TIMEOUT,
SIGNAL_ON_SENDER_TIMEOUT,
+ SIGNAL_ON_NEW_SENDER_SSRC,
+ SIGNAL_ON_SENDER_SSRC_ACTIVE,
LAST_SIGNAL
};
src->ssrc);
}
+static void
+on_new_sender_ssrc (RTPSession * session, RTPSource * src, GstRtpSession * sess)
+{
+ g_signal_emit (sess, gst_rtp_session_signals[SIGNAL_ON_NEW_SENDER_SSRC], 0,
+ src->ssrc);
+}
+
+static void
+on_sender_ssrc_active (RTPSession * session, RTPSource * src,
+ GstRtpSession * sess)
+{
+ g_signal_emit (sess, gst_rtp_session_signals[SIGNAL_ON_SENDER_SSRC_ACTIVE], 0,
+ src->ssrc);
+}
+
#define gst_rtp_session_parent_class parent_class
G_DEFINE_TYPE (GstRtpSession, gst_rtp_session, GST_TYPE_ELEMENT);
on_ssrc_validated), NULL, NULL, g_cclosure_marshal_VOID__UINT,
G_TYPE_NONE, 1, G_TYPE_UINT);
/**
- * GstRtpSession::on-ssrc_active:
+ * GstRtpSession::on-ssrc-active:
* @sess: the object which received the signal
* @ssrc: the SSRC
*
on_sender_timeout), NULL, NULL, g_cclosure_marshal_VOID__UINT,
G_TYPE_NONE, 1, G_TYPE_UINT);
+ /**
+ * GstRtpSession::on-new-sender-ssrc:
+ * @sess: the object which received the signal
+ * @ssrc: the sender SSRC
+ *
+ * Since: 1.8
+ *
+ * Notify of a new sender SSRC that entered @session.
+ */
+ gst_rtp_session_signals[SIGNAL_ON_NEW_SENDER_SSRC] =
+ g_signal_new ("on-new-sender-ssrc", G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstRtpSessionClass, on_new_ssrc),
+ NULL, NULL, g_cclosure_marshal_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT);
+
+ /**
+ * GstRtpSession::on-sender-ssrc-active:
+ * @sess: the object which received the signal
+ * @ssrc: the sender SSRC
+ *
+ * Since: 1.8
+ *
+ * Notify of a sender SSRC that is active, i.e., sending RTCP.
+ */
+ gst_rtp_session_signals[SIGNAL_ON_SENDER_SSRC_ACTIVE] =
+ g_signal_new ("on-sender-ssrc-active", G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstRtpSessionClass,
+ on_ssrc_active), NULL, NULL, g_cclosure_marshal_VOID__UINT,
+ G_TYPE_NONE, 1, G_TYPE_UINT);
+
g_object_class_install_property (gobject_class, PROP_BANDWIDTH,
g_param_spec_double ("bandwidth", "Bandwidth",
"The bandwidth of the session in bytes per second (0 for auto-discover)",
(GCallback) on_timeout, rtpsession);
g_signal_connect (rtpsession->priv->session, "on-sender-timeout",
(GCallback) on_sender_timeout, rtpsession);
+ g_signal_connect (rtpsession->priv->session, "on-new-sender-ssrc",
+ (GCallback) on_new_sender_ssrc, rtpsession);
+ g_signal_connect (rtpsession->priv->session, "on-sender-ssrc-active",
+ (GCallback) on_sender_ssrc_active, rtpsession);
rtpsession->priv->ptmap = g_hash_table_new_full (NULL, NULL, NULL,
(GDestroyNotify) gst_caps_unref);
void (*on_bye_timeout) (GstRtpSession *sess, guint32 ssrc);
void (*on_timeout) (GstRtpSession *sess, guint32 ssrc);
void (*on_sender_timeout) (GstRtpSession *sess, guint32 ssrc);
+ void (*on_new_sender_ssrc) (GstRtpSession *sess, guint32 ssrc);
+ void (*on_sender_ssrc_active) (GstRtpSession *sess, guint32 ssrc);
};
GType gst_rtp_session_get_type (void);
SIGNAL_SEND_RTCP,
SIGNAL_SEND_RTCP_FULL,
SIGNAL_ON_RECEIVING_RTCP,
+ SIGNAL_ON_NEW_SENDER_SSRC,
+ SIGNAL_ON_SENDER_SSRC_ACTIVE,
LAST_SIGNAL
};
NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 1,
GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE);
+ /**
+ * RTPSession::on-new-sender-ssrc:
+ * @session: the object which received the signal
+ * @src: the new sender RTPSource
+ *
+ * Notify of a new sender SSRC that entered @session.
+ *
+ * Since: 1.8
+ */
+ rtp_session_signals[SIGNAL_ON_NEW_SENDER_SSRC] =
+ g_signal_new ("on-new-sender-ssrc", G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (RTPSessionClass, on_new_sender_ssrc),
+ NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1,
+ RTP_TYPE_SOURCE);
+
+ /**
+ * RTPSession::on-sender-ssrc-active:
+ * @session: the object which received the signal
+ * @src: the active sender RTPSource
+ *
+ * Notify of a sender SSRC that is active, i.e., sending RTCP.
+ *
+ * Since: 1.8
+ */
+ rtp_session_signals[SIGNAL_ON_SENDER_SSRC_ACTIVE] =
+ g_signal_new ("on-sender-ssrc-active", G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (RTPSessionClass,
+ on_sender_ssrc_active), NULL, NULL, g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1, RTP_TYPE_SOURCE);
+
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)",
g_object_unref (source);
}
+static void
+on_new_sender_ssrc (RTPSession * sess, RTPSource * source)
+{
+ g_object_ref (source);
+ RTP_SESSION_UNLOCK (sess);
+ g_signal_emit (sess, rtp_session_signals[SIGNAL_ON_NEW_SENDER_SSRC], 0,
+ source);
+ RTP_SESSION_LOCK (sess);
+ g_object_unref (source);
+}
+
+static void
+on_sender_ssrc_active (RTPSession * sess, RTPSource * source)
+{
+ g_object_ref (source);
+ RTP_SESSION_UNLOCK (sess);
+ g_signal_emit (sess, rtp_session_signals[SIGNAL_ON_SENDER_SSRC_ACTIVE], 0,
+ source);
+ RTP_SESSION_LOCK (sess);
+ g_object_unref (source);
+}
+
/**
* rtp_session_new:
*
sess->internal_ssrc_from_caps_or_property = TRUE;
if (source) {
rtp_source_update_caps (source, caps);
+
+ if (created)
+ on_new_sender_ssrc (sess, source);
+
g_object_unref (source);
}
goto invalid_packet;
source = obtain_internal_source (sess, pinfo.ssrc, &created, current_time);
+ if (created)
+ on_new_sender_ssrc (sess, source);
prevsender = RTP_SOURCE_IS_SENDER (source);
oldrate = source->bitrate;
source = obtain_internal_source (sess, sess->suggested_ssrc, &created,
current_time);
sess->internal_ssrc_set = TRUE;
+
+ if (created)
+ on_new_sender_ssrc (sess, source);
+
g_object_unref (source);
}
sess->callbacks.send_rtcp (sess, source, buffer, output->is_bye,
sess->send_rtcp_user_data);
sess->stats.nacks_sent += data.nacked_seqnums;
+
+ RTP_SESSION_LOCK (sess);
+ on_sender_ssrc_active (sess, source);
+ RTP_SESSION_UNLOCK (sess);
} else {
GST_DEBUG ("freeing packet callback: %p"
" do_not_suppress: %d may_suppress: %d", sess->callbacks.send_rtcp,
guint sender_ssrc, guint media_ssrc, GstBuffer *fci);
gboolean (*send_rtcp) (RTPSession *sess, GstClockTime max_delay);
void (*on_receiving_rtcp) (RTPSession *sess, GstBuffer *buffer);
+ void (*on_new_sender_ssrc) (RTPSession *sess, RTPSource *source);
+ void (*on_sender_ssrc_active) (RTPSession *sess, RTPSource *source);
};
GType rtp_session_get_type (void);