aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-09-21 10:52:52 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-09-21 10:55:12 +0200
commitfe01908428d9745e7d111a0902d3d090d0090f91 (patch)
treee9402d7c807181c97b5da3f4bfb03bcbc71f90fd
parentb37c5d48f0e5ceed98da7523ddab7878ab1b1cd9 (diff)
ortp: Export statistics for the bts or similarv0.3.2
We might want to know how many things arrived at the BTS and ortp is already counting for us. We don't intend to use RTCP so I am not sure what the last "sender report" is and how accurate the jitter is.
-rw-r--r--include/osmocom/trau/osmo_ortp.h6
-rw-r--r--src/trau/osmo_ortp.c26
2 files changed, 32 insertions, 0 deletions
diff --git a/include/osmocom/trau/osmo_ortp.h b/include/osmocom/trau/osmo_ortp.h
index 2d32b02..c02cca8 100644
--- a/include/osmocom/trau/osmo_ortp.h
+++ b/include/osmocom/trau/osmo_ortp.h
@@ -79,4 +79,10 @@ void osmo_rtp_socket_log_stats(struct osmo_rtp_socket *rs,
int subsys, int level,
const char *pfx);
+void osmo_rtp_socket_stats(struct osmo_rtp_socket *rs,
+ uint32_t *sent_packets, uint32_t *sent_octets,
+ uint32_t *recv_packets, uint32_t *recv_octets,
+ uint32_t *recv_lost, uint32_t *last_jitter);
+
+
#endif /* _OSMO_ORTP_H */
diff --git a/src/trau/osmo_ortp.c b/src/trau/osmo_ortp.c
index fedc977..7edcd03 100644
--- a/src/trau/osmo_ortp.c
+++ b/src/trau/osmo_ortp.c
@@ -546,3 +546,29 @@ void osmo_rtp_socket_log_stats(struct osmo_rtp_socket *rs,
stats->packet_recv, stats->hw_recv, stats->outoftime,
stats->cum_packet_loss, stats->discarded);
}
+
+void osmo_rtp_socket_stats(struct osmo_rtp_socket *rs,
+ uint32_t *sent_packets, uint32_t *sent_octets,
+ uint32_t *recv_packets, uint32_t *recv_octets,
+ uint32_t *recv_lost, uint32_t *last_jitter)
+{
+ const rtp_stats_t *stats;
+ const jitter_stats_t *jitter;
+
+ *sent_packets = *sent_octets = *recv_packets = *recv_octets = 0;
+ *recv_lost = *last_jitter = 0;
+
+ stats = rtp_session_get_stats(rs->sess);
+ if (stats) {
+ /* truncate from 64bit to 32bit here */
+ *sent_packets = stats->packet_sent;
+ *sent_octets = stats->sent;
+ *recv_packets = stats->packet_recv;
+ *recv_octets = stats->recv;
+ *recv_lost = stats->cum_packet_loss;
+ }
+
+ jitter = rtp_session_get_jitter_stats(rs->sess);
+ if (jitter)
+ *last_jitter = jitter->jitter;
+}