diff options
author | Havard Graff <havard.graff@tandberg.com> | 2009-08-31 18:34:08 +0200 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2010-09-24 13:26:10 +0200 |
commit | 0fa589a3dd5df5a588401c173a66db60860b557c (patch) | |
tree | 2d818abea1d9f0eb3cf0bfa9b08f8c8b1cce7b7c /gst/rtpmanager/rtpstats.c | |
parent | d32d596b2e1ed3170a1f8d5890861b884b246f56 (diff) | |
download | gstreamer-plugins-good-0fa589a3dd5df5a588401c173a66db60860b557c.tar.gz |
rtpmanager: provide additional statistics
Diffstat (limited to 'gst/rtpmanager/rtpstats.c')
-rw-r--r-- | gst/rtpmanager/rtpstats.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gst/rtpmanager/rtpstats.c b/gst/rtpmanager/rtpstats.c index 245c6c007..a6de7d880 100644 --- a/gst/rtpmanager/rtpstats.c +++ b/gst/rtpmanager/rtpstats.c @@ -261,3 +261,27 @@ rtp_stats_calculate_bye_interval (RTPSessionStats * stats) return interval * GST_SECOND; } + +/** + * rtp_stats_get_packets_lost: + * @stats: an #RTPSourceStats struct + * + * Calculate the total number of RTP packets lost since beginning of + * reception. Packets that arrive late are not considered lost, and + * duplicates are not taken into account. Hence, the loss may be negative + * if there are duplicates. + * + * Returns: total RTP packets lost. + */ +gint64 +rtp_stats_get_packets_lost (const RTPSourceStats *stats) +{ + gint64 lost; + guint64 extended_max, expected; + + extended_max = stats->cycles + stats->max_seq; + expected = extended_max - stats->base_seq + 1; + lost = expected - stats->packets_received; + + return lost; +}
\ No newline at end of file |