iuup_cn_node.c: use correct header for AMR SID frames
rx_data(): if iuup header (4 bytes) + amr payload (5 bytes) is 9 bytes then it means that this is AMR SID (Comfort Noise Frame) and other header should be used. The second byte of AMR header is set to 0x44.
This commit is contained in:
parent
fdfa1849e4
commit
f2c1523ff7
|
@ -87,9 +87,12 @@ static int rx_data(struct osmo_iuup_cn *cn, struct msgb *pdu,
|
|||
/* Remove the IuUP bit from the middle of the buffer by writing the RTP header forward. */
|
||||
/* And append AMR 12.2k header "0xf03c". - AD HOC fix */
|
||||
unsigned int pre_hdr_len = ((uint8_t*)hdr) - pdu->data;
|
||||
|
||||
int is_comfort_noise = ((pdu->len - pre_hdr_len) == 9);
|
||||
|
||||
memmove(pdu->data + sizeof(*hdr) - 2, pdu->data, pre_hdr_len);
|
||||
((uint8_t*)hdr)[2] = 0xf0;
|
||||
((uint8_t*)hdr)[3] = 0x3c;
|
||||
((uint8_t*)hdr)[3] = is_comfort_noise ? 0x44 : 0x3c;
|
||||
msgb_pull(pdu, sizeof(*hdr) - 2);
|
||||
|
||||
LOGP(DIUUP, LOGL_DEBUG, "(%s) IuUP stripping IuUP header from RTP data\n", cn->name);
|
||||
|
|
|
@ -116,6 +116,13 @@ void test_cn_session()
|
|||
msgb_from_hex("IuUP-Data",
|
||||
RTP_HEADER IUUP_HEADER RTP_PAYLOAD));
|
||||
|
||||
printf("\nReceive payload encapsulated in IuUP. Expecting rx_payload() of just RTP packet\n");
|
||||
printf("i.e. should strip away " "0401479e" "\n");
|
||||
expect_rx_payload = RTP_HEADER "f044" "26e9b851ee";
|
||||
rx_pdu(cn,
|
||||
msgb_from_hex("IuUP-Data",
|
||||
RTP_HEADER "0401479e" "26e9b851ee"));
|
||||
|
||||
printf("\nTransmit RTP. Expecting tx_msg() with inserted IuUP header\n");
|
||||
expect_tx_msg = RTP_HEADER "000002b3" RTP_PAYLOAD;
|
||||
tx_payload(cn,
|
||||
|
|
|
@ -20,6 +20,17 @@ node_priv=0x2342
|
|||
ok: matches expected msg
|
||||
rc=0
|
||||
|
||||
Receive payload encapsulated in IuUP. Expecting rx_payload() of just RTP packet
|
||||
i.e. should strip away 0401479e
|
||||
-PDU-> [IuUP]
|
||||
8060944c6256042c000101020401479e26e9b851ee
|
||||
rx_payload() invoked by iuup_cn!
|
||||
[IuUP] -RTP->
|
||||
8060944c6256042c00010102f04426e9b851ee
|
||||
node_priv=0x2342
|
||||
ok: matches expected msg
|
||||
rc=0
|
||||
|
||||
Transmit RTP. Expecting tx_msg() with inserted IuUP header
|
||||
[IuUP] <-RTP-
|
||||
8060944c6256042c00010102f03c6cfb23bc46d18180c3e5ffe040045600005a7d35b625b80005fff03214ced0
|
||||
|
|
Loading…
Reference in New Issue