aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/trau2rtp
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-08-24 15:20:37 +0200
committerHarald Welte <laforge@osmocom.org>2020-09-17 23:34:28 +0200
commit71dce2a4e4bf111030ba4f88c571a80cdf4400c2 (patch)
tree3f2bef9f4fe4266575fde18a049b52ca1ce6bdb4 /contrib/trau2rtp
parent9319514041c2f9f8bea1736d3731bacb94cb041b (diff)
AMR: WIPlaforge/trau
Diffstat (limited to 'contrib/trau2rtp')
-rw-r--r--contrib/trau2rtp/trau2rtp.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/contrib/trau2rtp/trau2rtp.c b/contrib/trau2rtp/trau2rtp.c
index fc9462d..7a29f4c 100644
--- a/contrib/trau2rtp/trau2rtp.c
+++ b/contrib/trau2rtp/trau2rtp.c
@@ -35,7 +35,7 @@ const int g_remote_port = 9000;
const int g_local_port = 8000;
/* codec; can be OSMO_TRAU16_FT_FR or OSMO_TRAU16_FT_EFR */
-const enum osmo_trau_frame_type g_ftype = OSMO_TRAU16_FT_EFR;
+const enum osmo_trau_frame_type g_ftype = OSMO_TRAU16_FT_AMR;
/***********************************************************************
* END CONFIGURATION
@@ -114,21 +114,35 @@ static void sync_frame_out_cb(void *user_data, const ubit_t *bits, unsigned int
if (g_local_loop) {
/* Mirror back to other sub-slot */
struct sc_state *peer = opposite_schan(sc);
- if (peer) {
- struct msgb *msg = msgb_alloc(2*40*8, "mirror");
+ if (!peer)
+ return;
+
+ struct msgb *msg = msgb_alloc(2*40*8, "mirror");
+
+ if (fr.type == OSMO_TRAU16_FT_AMR) {
+ //fr.c_bits[12-1] = FIXME; /* Req/Ind flag; use from UL */
+ fr.c_bits[13-1] = 1; /* UFT: no errors */
+ memset(&fr.c_bits[14-1], 0, 3); /* Config_Prot: no TFO */
+ memset(&fr.c_bits[17-1], 0, 2); /* Message_No: no TFO */
+ fr.c_bits[19-1] = 1; /* Reserved */
+ fr.c_bits[20-1] = 1; /* Reserved */
+
+ } else {
fr.c_bits[12-1] = 1; /* C12 = good u-link frame */
memset(&fr.c_bits[13-1], 1, 3); /* C13..C15: spare */
fr.c_bits[16-1] = 1; /* C16 = SP[eech]; no DTX */
memset(&fr.c_bits[6-1], 0, 6); /* C6..C11: tie alignment */
- fr.dir = OSMO_TRAU_DIR_DL;
- rc = osmo_trau_frame_encode(msgb_data(msg), 2*40*8, &fr);
- OSMO_ASSERT(rc >= 0);
- msgb_put(msg, rc);
- osmo_i460_mux_enqueue(peer->i460_sc, msg);
}
+ fr.dir = OSMO_TRAU_DIR_DL;
+ rc = osmo_trau_frame_encode(msgb_data(msg), 2*40*8, &fr);
+ OSMO_ASSERT(rc >= 0);
+ msgb_put(msg, rc);
+ osmo_i460_mux_enqueue(peer->i460_sc, msg);
} else {
/* Convert to RTP */
- if (fr.type != OSMO_TRAU16_FT_FR && fr.type != OSMO_TRAU16_FT_EFR)
+ if (fr.type != OSMO_TRAU16_FT_FR &&
+ fr.type != OSMO_TRAU16_FT_EFR &&
+ fr.type != OSMO_TRAU16_FT_AMR)
goto skip;
uint8_t rtpbuf[35];