aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2016-12-09 14:13:22 +0100
committerHarald Welte <laforge@gnumonks.org>2016-12-15 19:57:04 +0000
commitfed8ce3c5ab740f3a02831e0b00a400e7bbc0e69 (patch)
tree471aa9a5120e10d9860e04b6d4b32129d40cbc1d
parent2c95ae6a091083a7d1108aa852d6bfacd442f62d (diff)
DTX: fix TS adjustment for ONSET
Previously timestamp was always adjusted according to FN difference. In case of ONSET event this causes unnecessary TS gap with subsequent speech packet. Fix this by checking Marker bit before performing adjustment. Change-Id: I9bf4b45aa990dd4014334dd846f43f793366056c Related: OS#1801
-rw-r--r--src/common/l1sap.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index cfa02bde..e9c94f0d 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -71,16 +71,26 @@ get_active_lchan_by_chan_nr(struct gsm_bts_trx *trx, unsigned int chan_nr)
static int l1sap_down(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap);
-static uint32_t fn_ms_adj(uint32_t fn, uint32_t last_fn)
+static uint32_t fn_ms_adj(uint32_t fn, const struct gsm_lchan *lchan)
{
- if (last_fn != LCHAN_FN_DUMMY) {
+ uint32_t samples_passed, r;
+
+ /* don't adjust duration:
+ - when no DTX enabled at all
+ - for ONSET RTP packet to avoid timestamp gap with subsequent SPEECH
+ RTP packet*/
+ if (lchan->rtp_tx_marker ||
+ lchan->ts->trx->bts->dtxu == GSM48_DTX_SHALL_NOT_BE_USED)
+ return GSM_RTP_DURATION;
+
+ if (lchan->tch.last_fn != LCHAN_FN_DUMMY) {
/* 12/13 frames usable for audio in TCH,
160 samples per RTP packet,
1 RTP packet per 4 frames */
- uint32_t samples_passed = (fn - last_fn) * 12 * 160 / (13 * 4);
+ samples_passed = (fn - lchan->tch.last_fn) * 12 * 160 / (13 * 4);
/* round number of samples to the nearest multiple of
GSM_RTP_DURATION */
- uint32_t r = samples_passed + GSM_RTP_DURATION / 2;
+ r = samples_passed + GSM_RTP_DURATION / 2;
r -= r % GSM_RTP_DURATION;
return r;
}
@@ -912,7 +922,7 @@ static int l1sap_tch_ind(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap,
/* hand msg to RTP code for transmission */
if (lchan->abis_ip.rtp_socket)
osmo_rtp_send_frame_ext(lchan->abis_ip.rtp_socket,
- msg->data, msg->len, fn_ms_adj(fn, lchan->tch.last_fn), lchan->rtp_tx_marker);
+ msg->data, msg->len, fn_ms_adj(fn, lchan), lchan->rtp_tx_marker);
/* if loopback is enabled, also queue received RTP data */
if (lchan->loopback) {