src->ssrc);
}
+static void
+on_notify_stats (RTPSession * session, GParamSpec *spec, GstRtpSession *rtpsession)
+{
+ g_object_notify (G_OBJECT (rtpsession), "stats");
+}
+
#define gst_rtp_session_parent_class parent_class
G_DEFINE_TYPE (GstRtpSession, gst_rtp_session, GST_TYPE_ELEMENT);
* dropped (due to bandwidth constraints)
* "sent-nack-count" G_TYPE_UINT Number of NACKs sent
* "recv-nack-count" G_TYPE_UINT Number of NACKs received
+ * "source-stats" G_TYPE_BOXED GValueArray of #RTPSource::stats for all
+ * RTP sources (Since 1.8)
*
* Since: 1.4
*/
(GCallback) on_new_sender_ssrc, rtpsession);
g_signal_connect (rtpsession->priv->session, "on-sender-ssrc-active",
(GCallback) on_sender_ssrc_active, rtpsession);
+ g_signal_connect (rtpsession->priv->session, "notify::stats",
+ (GCallback) on_notify_stats, rtpsession);
rtpsession->priv->ptmap = g_hash_table_new_full (NULL, NULL, NULL,
(GDestroyNotify) gst_caps_unref);
* dropped (due to bandwidth constraints)
* "sent-nack-count" G_TYPE_UINT Number of NACKs sent
* "recv-nack-count" G_TYPE_UINT Number of NACKs received
+ * "source-stats" G_TYPE_BOXED GValueArray of #RTPSource::stats for all
+ * RTP sources (Since 1.8)
*
* Since: 1.4
*/
return res;
}
+static void
+create_source_stats (gpointer key, RTPSource * source, GValueArray *arr)
+{
+ GValue value = G_VALUE_INIT;
+ GstStructure *s;
+
+ g_object_get (source, "stats", &s, NULL);
+
+ g_value_init (&value, GST_TYPE_STRUCTURE);
+ gst_value_set_structure (&value, s);
+ g_value_array_append (arr, &value);
+ gst_structure_free (s);
+ g_value_unset (&value);
+}
+
static GstStructure *
rtp_session_create_stats (RTPSession * sess)
{
GstStructure *s;
+ GValueArray *source_stats;
+ GValue source_stats_v = G_VALUE_INIT;
+ guint size;
s = gst_structure_new ("application/x-rtp-session-stats",
"rtx-drop-count", G_TYPE_UINT, sess->stats.nacks_dropped,
"sent-nack-count", G_TYPE_UINT, sess->stats.nacks_sent,
- "recv-nack-count", G_TYPE_UINT, sess->stats.nacks_received, NULL);
+ "recv-nack-count", G_TYPE_UINT, sess->stats.nacks_received,
+ NULL);
+
+ size = g_hash_table_size (sess->ssrcs[sess->mask_idx]);
+ source_stats = g_value_array_new (size);
+ g_hash_table_foreach (sess->ssrcs[sess->mask_idx],
+ (GHFunc) create_source_stats, source_stats);
+
+ g_value_init (&source_stats_v, G_TYPE_VALUE_ARRAY);
+ g_value_take_boxed (&source_stats_v, source_stats);
+ gst_structure_take_value (s, "source-stats", &source_stats_v);
return s;
}
/* update point-to-point status */
session_update_ptp (sess);
+ /* notify about updated statistics */
+ g_object_notify (G_OBJECT (sess), "stats");
+
/* see if we need to generate SR or RR packets */
if (!is_rtcp_time (sess, current_time, &data))
goto done;