summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorSantiago Carot-Nemesio <sancane@gmail.com>2015-03-03 16:01:53 +0100
committerSebastian Dröge <sebastian@centricular.com>2015-03-04 12:04:07 +0100
commit22791413f9d2e6fc4d9dc3d435fd6c3499da7078 (patch)
treeecbf51947bd7ac9116b135a4ea436ce3ac0c9b14 /gst
parentc4e542de695e07cab64f390b4523b9b68ba84971 (diff)
rtp: Add Packet Loss Indication (PLI) to statistics
This is helpful to provide statistics in the format defined in http://w3c.github.io/webrtc-stats/#dictionary-rtcrtpstreamstats-members. https://bugzilla.gnome.org/show_bug.cgi?id=745587
Diffstat (limited to 'gst')
-rw-r--r--gst/rtpmanager/rtpsession.c4
-rw-r--r--gst/rtpmanager/rtpsource.c7
-rw-r--r--gst/rtpmanager/rtpstats.h3
3 files changed, 13 insertions, 1 deletions
diff --git a/gst/rtpmanager/rtpsession.c b/gst/rtpmanager/rtpsession.c
index cc819fbf1..020336295 100644
--- a/gst/rtpmanager/rtpsession.c
+++ b/gst/rtpmanager/rtpsession.c
@@ -2391,6 +2391,8 @@ rtp_session_process_pli (RTPSession * sess, guint32 sender_ssrc,
return;
rtp_session_request_local_key_unit (sess, src, FALSE, current_time);
+
+ src->stats.recv_pli_count++;
}
static void
@@ -3209,6 +3211,8 @@ session_pli (const gchar * key, RTPSource * source, ReportData * data)
source->send_pli = FALSE;
data->may_suppress = FALSE;
+
+ source->stats.sent_pli_count++;
}
/* construct NACK */
diff --git a/gst/rtpmanager/rtpsource.c b/gst/rtpmanager/rtpsource.c
index 610d7ae96..7c4220580 100644
--- a/gst/rtpmanager/rtpsource.c
+++ b/gst/rtpmanager/rtpsource.c
@@ -238,6 +238,8 @@ rtp_source_reset (RTPSource * src)
src->stats.last_rtptime = GST_CLOCK_TIME_NONE;
src->stats.last_rtcptime = GST_CLOCK_TIME_NONE;
g_array_set_size (src->nacks, 0);
+
+ src->stats.sent_pli_count = 0;
}
static void
@@ -364,7 +366,9 @@ rtp_source_create_stats (RTPSource * src)
"bitrate", G_TYPE_UINT64, src->bitrate,
"packets-lost", G_TYPE_INT,
(gint) rtp_stats_get_packets_lost (&src->stats), "jitter", G_TYPE_UINT,
- (guint) (src->stats.jitter >> 4), NULL);
+ (guint) (src->stats.jitter >> 4),
+ "sent-pli-count", G_TYPE_UINT, src->stats.sent_pli_count,
+ "recv-pli-count", G_TYPE_UINT, src->stats.recv_pli_count, NULL);
/* get the last SR. */
have_sr = rtp_source_get_last_sr (src, &time, &ntptime, &rtptime,
@@ -942,6 +946,7 @@ init_seq (RTPSource * src, guint16 seq)
src->stats.bytes_received = 0;
src->stats.prev_received = 0;
src->stats.prev_expected = 0;
+ src->stats.recv_pli_count = 0;
GST_DEBUG ("base_seq %d", seq);
}
diff --git a/gst/rtpmanager/rtpstats.h b/gst/rtpmanager/rtpstats.h
index 137ece3b9..f2062e934 100644
--- a/gst/rtpmanager/rtpstats.h
+++ b/gst/rtpmanager/rtpstats.h
@@ -135,6 +135,9 @@ typedef struct {
guint64 packets_sent;
guint64 octets_sent;
+ guint sent_pli_count;
+ guint recv_pli_count;
+
/* when we received stuff */
GstClockTime prev_rtptime;
GstClockTime prev_rtcptime;