From bf42e0a91fcf79efa9b68c38568021e4d68c87b2 Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 15 Dec 2016 19:57:57 +0100 Subject: Enable adaptive jitter compensation * check RTP socket parameter and enable necessary jitter buffering * return the status of requested jitter buffering instead of always returning 0 * document function parameters and return value Change-Id: I87d4d9fe990683adbb02b64cb39b78de533d8046 --- src/trau/osmo_ortp.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/trau/osmo_ortp.c b/src/trau/osmo_ortp.c index 8171655..d4d4ff5 100644 --- a/src/trau/osmo_ortp.c +++ b/src/trau/osmo_ortp.c @@ -278,28 +278,35 @@ void osmo_rtp_init(void *ctx) create_payload_types(); } +/*! \brief Set Osmocom RTP socket parameters + * \param[in] rs OsmoRTP socket + * \param[in] param defined which parameter to set + OSMO_RTP_P_JITBUF - enables regular jitter buffering + OSMO_RTP_P_JIT_ADAP - enables adaptive jitter buffering + * \param[in] val Size of jitter buffer (in ms), 0 means disable buffering + * \returns negative value on error, 0 or 1 otherwise + (depending on whether given jitter buffering is enabled) + */ 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_JIT_ADAP: + rtp_session_enable_adaptive_jitter_compensation(rs->sess, + (bool)val); + /* fall-through on-purpose - we have to set val anyway */ case OSMO_RTP_P_JITBUF: rtp_session_enable_jitter_buffer(rs->sess, (val) ? TRUE : FALSE); if (val) 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; + if (param == OSMO_RTP_P_JIT_ADAP) + return rtp_session_adaptive_jitter_compensation_enabled(rs->sess); + return rtp_session_jitter_buffer_enabled(rs->sess); } /*! \brief Create a new RTP socket @@ -328,7 +335,6 @@ struct osmo_rtp_socket *osmo_rtp_socket_create(void *talloc_ctx, unsigned int fl rtp_session_set_data(rs->sess, rs); rtp_session_set_profile(rs->sess, osmo_pt_profile); rtp_session_set_jitter_compensation(rs->sess, 100); - //jitter_control_enable_adaptive(rs->sess, 0); rtp_session_signal_connect(rs->sess, "ssrc_changed", (RtpCallback) ortp_sig_cb_ssrc, -- cgit v1.2.3