From 76c309e9f751840ce539e9043a8ad80da90b83e5 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 18 May 2014 19:32:37 +0200 Subject: sysmoBTS TCH: Set CMR in AMR RTP frames Enable the previously commented-out logic to set the CMR (Codec Mode Request) in AMR RTP frames based on the CMI (CMR Index) of the AMR speech frame on the Um interface. This is of course anyway the right thing to do, but also required for an AMR receiver which doesn't have out-of-band information on the codec mode, and which also doesn't determine the AMR codec mode based on the size of the AMR frame (such as lcr as of current master). We also move the entire CMR generation into the #ifdef section which is only compiled-in if we do _not_ use the RTP mode of L1. --- src/osmo-bts-sysmo/tch.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/osmo-bts-sysmo/tch.c b/src/osmo-bts-sysmo/tch.c index 205e6e9f..88c0754b 100644 --- a/src/osmo-bts-sysmo/tch.c +++ b/src/osmo-bts-sysmo/tch.c @@ -247,18 +247,20 @@ static struct msgb *l1_to_rtppayload_amr(uint8_t *l1_payload, uint8_t payload_le struct amr_multirate_conf *amr_mrc) { struct msgb *msg; - uint8_t *cur; - u_int8_t cmr; - uint8_t ft = l1_payload[2] & 0xF; uint8_t amr_if2_len = payload_len - 2; + uint8_t *cur; msg = msgb_alloc_headroom(1024, 128, "L1C-to-RTP"); if (!msg) return NULL; -#if 0 +#ifdef USE_L1_RTP_MODE + cur = msgb_put(msg, amr_if2_len); + memcpy(cur, l1_payload+2, amr_if2_len); +#else + u_int8_t cmr; + uint8_t ft = l1_payload[2] & 0xF; uint8_t cmr_idx = l1_payload[1]; - /* CMR == Unset means CMR was not transmitted at this TDMA */ if (cmr_idx >= GsmL1_AmrCodecMode_Unset) cmr = AMR_CMR_NONE; @@ -269,14 +271,7 @@ static struct msgb *l1_to_rtppayload_amr(uint8_t *l1_payload, uint8_t payload_le } else { cmr = amr_mrc->mode[cmr_idx].mode; } -#else - cmr = AMR_CMR_NONE; -#endif -#ifdef USE_L1_RTP_MODE - cur = msgb_put(msg, amr_if2_len); - memcpy(cur, l1_payload+2, amr_if2_len); -#else /* RFC 3267 4.4.1 Payload Header */ msgb_put_u8(msg, (cmr << 4)); -- cgit v1.2.3