mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
rtpjitterbuffer: implement rtx statistics
This commit is contained in:
parent
be01e80e6b
commit
22ceb80ba9
2 changed files with 54 additions and 0 deletions
|
@ -149,6 +149,7 @@ enum
|
|||
PROP_RTX_DELAY_REORDER,
|
||||
PROP_RTX_RETRY_TIMEOUT,
|
||||
PROP_RTX_RETRY_PERIOD,
|
||||
PROP_RTX_STATS,
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
|
@ -399,6 +400,9 @@ static void remove_all_timers (GstRtpJitterBuffer * jitterbuffer);
|
|||
|
||||
static void wait_next_timeout (GstRtpJitterBuffer * jitterbuffer);
|
||||
|
||||
static GstStructure *gst_rtp_jitter_buffer_create_stats (GstRtpJitterBuffer *
|
||||
jitterbuffer);
|
||||
|
||||
static void
|
||||
gst_rtp_jitter_buffer_class_init (GstRtpJitterBufferClass * klass)
|
||||
{
|
||||
|
@ -554,6 +558,23 @@ gst_rtp_jitter_buffer_class_init (GstRtpJitterBufferClass * klass)
|
|||
"Try to get a retransmission for this many ms "
|
||||
"(-1 automatic)", -1, G_MAXINT, DEFAULT_RTX_RETRY_PERIOD,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
/**
|
||||
* GstRtpJitterBuffer::rtx-stats:
|
||||
*
|
||||
* Various retransmission statistics. This property returns a GstStructure
|
||||
* with name application/x-rtp-jitterbuffer-stats with the following fields:
|
||||
*
|
||||
* "count" G_TYPE_UINT64 The number of retransmissions requested
|
||||
* "success-count" G_TYPE_UINT64 The number of successful retransmissions
|
||||
* "rtx-per-packet" G_TYPE_DOUBLE Average number of RTX per packet
|
||||
* "rtx-rtt" G_TYPE_UINT64 Average round trip time per RTX
|
||||
*
|
||||
* Since: 1.2.1
|
||||
*/
|
||||
g_object_class_install_property (gobject_class, PROP_RTX_STATS,
|
||||
g_param_spec_boxed ("rtx-stats", "RTX statistics",
|
||||
"Various retransmission statistics", GST_TYPE_STRUCTURE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* GstRtpJitterBuffer::request-pt-map:
|
||||
|
@ -3207,8 +3228,28 @@ gst_rtp_jitter_buffer_get_property (GObject * object,
|
|||
g_value_set_int (value, priv->rtx_retry_period);
|
||||
JBUF_UNLOCK (priv);
|
||||
break;
|
||||
case PROP_RTX_STATS:
|
||||
g_value_take_boxed (value,
|
||||
gst_rtp_jitter_buffer_create_stats (jitterbuffer));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static GstStructure *
|
||||
gst_rtp_jitter_buffer_create_stats (GstRtpJitterBuffer * jbuf)
|
||||
{
|
||||
GstStructure *s;
|
||||
|
||||
JBUF_LOCK (jbuf->priv);
|
||||
s = gst_structure_new ("application/x-rtp-jitterbuffer-stats",
|
||||
"count", G_TYPE_UINT64, jbuf->priv->num_rtx_requests,
|
||||
"success-count", G_TYPE_UINT64, jbuf->priv->num_rtx_success,
|
||||
"rtx-per-packet", G_TYPE_DOUBLE, jbuf->priv->avg_rtx_num,
|
||||
"rtx-rtt", G_TYPE_UINT64, jbuf->priv->avg_rtx_rtt, NULL);
|
||||
JBUF_UNLOCK (jbuf->priv);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
|
@ -999,6 +999,8 @@ GST_START_TEST (test_rtx_two_missing)
|
|||
GstEvent *out_event;
|
||||
gint jb_latency_ms = 200;
|
||||
gint i;
|
||||
GstStructure *rtx_stats;
|
||||
const GValue *rtx_stat;
|
||||
GstRTPBuffer rtp = GST_RTP_BUFFER_INIT;
|
||||
|
||||
setup_testharness (&data);
|
||||
|
@ -1111,6 +1113,17 @@ GST_START_TEST (test_rtx_two_missing)
|
|||
/* should still have only seen 1 packet lost events */
|
||||
g_assert_cmpint (data.lost_event_count, ==, 1);
|
||||
|
||||
g_object_get (data.jitter_buffer, "stats", &rtx_stats, NULL);
|
||||
|
||||
rtx_stat = gst_structure_get_value (rtx_stats, "count");
|
||||
g_assert_cmpuint (g_value_get_uint64 (rtx_stat), ==, 5);
|
||||
|
||||
rtx_stat = gst_structure_get_value (rtx_stats, "success-count");
|
||||
g_assert_cmpuint (g_value_get_uint64 (rtx_stat), ==, 1);
|
||||
|
||||
rtx_stat = gst_structure_get_value (rtx_stats, "rtx-rtt");
|
||||
g_assert_cmpuint (g_value_get_uint64 (rtx_stat), ==, 0);
|
||||
|
||||
destroy_testharness (&data);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue