aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2014-05-18 19:32:37 +0200
committerHarald Welte <laforge@gnumonks.org>2014-05-18 22:31:45 +0200
commit76c309e9f751840ce539e9043a8ad80da90b83e5 (patch)
tree1c6e4e3d8e4c7bb07b6f308b6bb34740d319b093
parentc64d42573894d8295b58b268a64541c914b69bcd (diff)
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.
-rw-r--r--src/osmo-bts-sysmo/tch.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/osmo-bts-sysmo/tch.c b/src/osmo-bts-sysmo/tch.c
index 205e6e9..88c0754 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));