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
This commit is contained in:
Santiago Carot-Nemesio 2015-03-03 16:01:53 +01:00 committed by Sebastian Dröge
parent c4e542de69
commit 22791413f9
3 changed files with 13 additions and 1 deletions

View file

@ -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 */

View file

@ -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);
}

View file

@ -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;