From 1eaa3d72eaa10bb854b2adff48d3f7f3e06dcb8c Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 21 Sep 2015 11:28:03 +0200 Subject: audio/rsl: Honor the speech mode and don't send anything Spotted by Ciaby while debugging an audio issue. Do not send anything to port==0 to the BSC/NITB. Look at the upper bits of the speech_mode to determine if sending is allowed. 0x1 means recv_only and all other modes allow us to send. Manually verified with a single phone call with LCR bridge mode to send a CRCX early but a MDCX sendrecv later. The audio starts to flow after the MDCX message. Virtual Addr space didn't increase over 10 calls. The l1p_msg is freed by the caller. The code might not re-set speech_mode from one call to another but if it is ever != 0 it can be expected that the BSC will always set it. This is because we do not (and don't want to) allocate the lchan dynamically on every usage. Fixes: SYS#2111 --- src/osmo-bts-sysmo/tch.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/osmo-bts-sysmo/tch.c b/src/osmo-bts-sysmo/tch.c index 422df0f7..9e8903b2 100644 --- a/src/osmo-bts-sysmo/tch.c +++ b/src/osmo-bts-sysmo/tch.c @@ -529,6 +529,11 @@ void bts_model_rtp_rx_cb(struct osmo_rtp_socket *rs, const uint8_t *rtp_pl, msgb_enqueue(&lchan->dl_tch_queue, msg); } +static int is_recv_only(uint8_t speech_mode) +{ + return (speech_mode & 0xF0) == (1 << 4); +} + /*! \brief receive a traffic L1 primitive for a given lchan */ int l1if_tch_rx(struct gsm_lchan *lchan, struct msgb *l1p_msg) { @@ -539,6 +544,9 @@ int l1if_tch_rx(struct gsm_lchan *lchan, struct msgb *l1p_msg) uint8_t payload_len; struct msgb *rmsg = NULL; + if (is_recv_only(lchan->abis_ip.speech_mode)) + return -EAGAIN; + if (data_ind->msgUnitParam.u8Size < 1) { LOGP(DL1C, LOGL_ERROR, "%s Rx Payload size 0\n", gsm_lchan_name(lchan)); -- cgit v1.2.3