diff options
author | Harald Welte <laforge@gnumonks.org> | 2011-09-08 14:42:58 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2011-09-08 14:42:58 +0200 |
commit | 65a50893d5f9577c17dc4485d585c12d349c8e30 (patch) | |
tree | 2d71278ca34b7b07b249705fb80f8f82fda3be1f /src/trau | |
parent | ddfaca45feda2f07481fb4a7d70c303fe7b70e29 (diff) |
add osmo_rtp_socket_set_param() and osmo_rtp_socket_log_stats()
Diffstat (limited to 'src/trau')
-rw-r--r-- | src/trau/osmo_ortp.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/trau/osmo_ortp.c b/src/trau/osmo_ortp.c index cac2508..be1d1c0 100644 --- a/src/trau/osmo_ortp.c +++ b/src/trau/osmo_ortp.c @@ -23,6 +23,7 @@ */ #include <stdint.h> +#include <inttypes.h> #include <netdb.h> #include <osmocom/core/logging.h> @@ -32,6 +33,7 @@ #include <osmocom/trau/osmo_ortp.h> #include <ortp/ortp.h> +#include <ortp/rtp.h> static PayloadType *payload_type_efr; @@ -248,6 +250,27 @@ void osmo_rtp_init(void *ctx) create_payload_types(); } +int osmo_rtp_socket_set_param(struct osmo_rtp_socket *rs, + enum osmo_rtp_param param, int val) +{ + int rc = 0; + + switch (param) { + case OSMO_RTP_P_JITBUF: + rtp_session_set_jitter_compensation(rs->sess, val); + break; +#if 0 + case OSMO_RTP_P_JIT_ADAP: + rc = jitter_control_enable_adaptive(rs->sess, val); + break; +#endif + default: + return -EINVAL; + } + + return rc; +} + /*! \brief Create a new RTP socket * \param[in] talloc_cxt talloc context for this allocation. NULL for * dafault context @@ -466,3 +489,22 @@ int osmo_rtp_get_bound_addr(struct osmo_rtp_socket *rs, return 0; } + + +void osmo_rtp_socket_log_stats(struct osmo_rtp_socket *rs, + int subsys, int level, + const char *pfx) +{ + const rtp_stats_t *stats; + + stats = rtp_session_get_stats(rs->sess); + if (!stats) + return; + + LOGP(subsys, level, "%sRTP Tx(%"PRIu64" pkts, %"PRIu64" bytes) " + "Rx(%"PRIu64" pkts, %"PRIu64" bytes, %"PRIu64" late, " + "%"PRIu64" loss, %"PRIu64" qmax)\n", + pfx, stats->packet_sent, stats->sent, + stats->packet_recv, stats->hw_recv, stats->outoftime, + stats->cum_packet_loss, stats->discarded); +} |