mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-bts.git
synced 2025-10-23 08:22:10 +00:00
csd_v110_rtp_decode: preserve E2 & E3 bits for RLP alignment
Modify CSD RTP input path code so incoming bits E2 & E3 from V.110 frames reach the TCH-RTS.ind handler in l1sap. These bits will be used in the next patch to ensure proper alignment of DL RLP frames in non-transparent CSD modes. Related: OS#6579 Change-Id: I43b97caa6030b9401779998ca5dddc4cfe636e2f
This commit is contained in:
@@ -17,4 +17,4 @@ int csd_v110_rtp_encode(const struct gsm_lchan *lchan, uint8_t *rtp,
|
||||
const uint8_t *data, size_t data_len,
|
||||
uint8_t nt48_half_num);
|
||||
int csd_v110_rtp_decode(const struct gsm_lchan *lchan, uint8_t *data,
|
||||
const uint8_t *rtp, size_t rtp_len);
|
||||
uint8_t *align_bits, const uint8_t *rtp, size_t rtp_len);
|
||||
|
@@ -25,6 +25,9 @@ struct msgb;
|
||||
/* Access 4th part of msgb control buffer */
|
||||
#define rtpmsg_is_rfc5993_sid(x) ((x)->cb[3])
|
||||
|
||||
/* Access 5th part of msgb control buffer */
|
||||
#define rtpmsg_csd_align_bits(x) ((x)->cb[4])
|
||||
|
||||
/**
|
||||
* Classification of OML message. ETSI for plain GSM 12.21
|
||||
* messages and IPA/Osmo for manufacturer messages.
|
||||
|
@@ -166,10 +166,11 @@ static bool check_v110_align(const ubit_t *ra_bits)
|
||||
}
|
||||
|
||||
int csd_v110_rtp_decode(const struct gsm_lchan *lchan, uint8_t *data,
|
||||
const uint8_t *rtp, size_t rtp_len)
|
||||
uint8_t *align_bits, const uint8_t *rtp, size_t rtp_len)
|
||||
{
|
||||
const struct csd_v110_lchan_desc *desc;
|
||||
ubit_t ra_bits[80 * 4];
|
||||
uint8_t align_accum = 0;
|
||||
|
||||
OSMO_ASSERT(lchan->tch_mode < ARRAY_SIZE(csd_v110_lchan_desc));
|
||||
desc = &csd_v110_lchan_desc[lchan->tch_mode];
|
||||
@@ -207,7 +208,13 @@ int csd_v110_rtp_decode(const struct gsm_lchan *lchan, uint8_t *data,
|
||||
osmo_csd_12k_6k_encode_frame(&data[i * 60], 60, &df);
|
||||
else /* desc->num_bits == 36 */
|
||||
osmo_csd_3k6_encode_frame(&data[i * 36], 36, &df);
|
||||
/* save bits E2 & E3 that may be needed for RLP alignment */
|
||||
align_accum <<= 2;
|
||||
align_accum |= df.e_bits[1] << 1;
|
||||
align_accum |= df.e_bits[2] << 0;
|
||||
}
|
||||
|
||||
if (align_bits)
|
||||
*align_bits = align_accum;
|
||||
return desc->num_blocks * desc->num_bits;
|
||||
}
|
||||
|
@@ -2597,6 +2597,7 @@ void l1sap_rtp_rx_cb(struct osmo_rtp_socket *rs, const uint8_t *rtp_pl,
|
||||
struct gsm_bts *bts = lchan->ts->trx->bts;
|
||||
struct msgb *msg;
|
||||
bool rfc5993_sid = false;
|
||||
uint8_t csd_align_bits = 0;
|
||||
|
||||
rate_ctr_inc2(bts->ctrs, BTS_CTR_RTP_RX_TOTAL);
|
||||
if (marker)
|
||||
@@ -2631,7 +2632,7 @@ void l1sap_rtp_rx_cb(struct osmo_rtp_socket *rs, const uint8_t *rtp_pl,
|
||||
return;
|
||||
|
||||
if (lchan->rsl_cmode == RSL_CMOD_SPD_DATA) {
|
||||
int rc = csd_v110_rtp_decode(lchan, msg->tail,
|
||||
int rc = csd_v110_rtp_decode(lchan, msg->tail, &csd_align_bits,
|
||||
rtp_pl, rtp_pl_len);
|
||||
if (rc > 0) {
|
||||
/* 'fake' tch_ind containing all-zero so gsmtap code can be shared
|
||||
@@ -2664,6 +2665,8 @@ void l1sap_rtp_rx_cb(struct osmo_rtp_socket *rs, const uint8_t *rtp_pl,
|
||||
rtpmsg_ts(msg) = timestamp;
|
||||
/* Store RFC 5993 SID flag likewise */
|
||||
rtpmsg_is_rfc5993_sid(msg) = rfc5993_sid;
|
||||
/* ditto with CSD alignment bits */
|
||||
rtpmsg_csd_align_bits(msg) = csd_align_bits;
|
||||
|
||||
/* make sure the queue doesn't get too long */
|
||||
lchan_dl_tch_queue_enqueue(lchan, msg, 1);
|
||||
|
@@ -133,7 +133,7 @@ static void exec_test_case(const struct test_case *tc)
|
||||
fprintf(stderr, " %s\n", osmo_hexdump(&rtp[i * 16], 16));
|
||||
|
||||
/* decode the encoded RTP frame */
|
||||
rc = csd_v110_rtp_decode(&lchan, &data_dec[0], &rtp[0], sizeof(rtp));
|
||||
rc = csd_v110_rtp_decode(&lchan, &data_dec[0], NULL, &rtp[0], sizeof(rtp));
|
||||
fprintf(stderr, "[i] csd_v110_rtp_decode() returns %d\n", rc);
|
||||
if (rc != bit_num)
|
||||
return;
|
||||
|
Reference in New Issue
Block a user