aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2016-12-15 19:57:57 +0100
committerPhilipp <pmaier@sysmocom.de>2016-12-22 18:22:25 +0100
commitbdb67a70da86f720bc7f53731d156cf8b080be7f (patch)
tree856e8d6fffa433a32fb5e31342d934cd128596d8
parent181318d06a53620da5d90967da475cf500e61c90 (diff)
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
-rw-r--r--src/trau/osmo_ortp.c26
1 files changed, 16 insertions, 10 deletions
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,