comparison osmo-patches/osmo-bts-rtp-bfi.patch @ 172:60e2d6379fce

osmo-patches/osmo-bts-rtp-bfi.patch: checking in
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 21 Nov 2022 01:05:58 -0800
parents
children f5c4f9a764be
comparison
equal deleted inserted replaced
171:4f1f3f799295 172:60e2d6379fce
1 diff --git a/src/common/l1sap.c b/src/common/l1sap.c
2 index 8bcd417..bfdc37f 100644
3 --- a/src/common/l1sap.c
4 +++ b/src/common/l1sap.c
5 @@ -1244,6 +1244,12 @@ static bool rtppayload_is_octet_aligned(const uint8_t *rtp_pl, uint8_t payload_l
6
7 static bool rtppayload_is_valid(struct gsm_lchan *lchan, struct msgb *resp_msg)
8 {
9 + /* Discard Themyscira BFI packets - because we have our own
10 + * TDMA timing, there is no difference for us between receiving
11 + * an explicit BFI packet vs receiving nothing at all. */
12 + if (resp_msg->len == 2 && resp_msg->data[0] == 0xBF)
13 + return false;
14 +
15 /* Avoid sending bw-efficient AMR to lower layers, most bts models
16 * don't support it. */
17 if (lchan->tch_mode == GSM48_CMODE_SPEECH_AMR &&
18 @@ -1574,6 +1580,7 @@ static int l1sap_tch_ind(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap,
19 struct gsm_lchan *lchan;
20 uint8_t chan_nr;
21 uint32_t fn;
22 + uint8_t bfi[2];
23
24 chan_nr = tch_ind->chan_nr;
25 fn = tch_ind->fn;
26 @@ -1619,13 +1626,19 @@ static int l1sap_tch_ind(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap,
27 /* Only clear the marker bit once we have sent a RTP packet with it */
28 lchan->rtp_tx_marker = false;
29 } else {
30 - DEBUGPGT(DRTP, &g_time, "Skipping RTP frame with lost payload (chan_nr=0x%02x)\n",
31 - chan_nr);
32 - if (lchan->abis_ip.osmux.use)
33 - lchan_osmux_skipped_frame(lchan, fn_ms_adj(fn, lchan));
34 - else if (lchan->abis_ip.rtp_socket)
35 - osmo_rtp_skipped_frame(lchan->abis_ip.rtp_socket, fn_ms_adj(fn, lchan));
36 - lchan->rtp_tx_marker = true;
37 + /* Themyscira change: send explicit BFI packets instead of
38 + * gaps in the RTP stream. */
39 + bfi[0] = 0xBF;
40 + bfi[1] = 0; /* TAF will go here */
41 + if (lchan->abis_ip.osmux.use) {
42 + lchan_osmux_send_frame(lchan, bfi, 2,
43 + fn_ms_adj(fn, lchan), lchan->rtp_tx_marker);
44 + } else if (lchan->abis_ip.rtp_socket) {
45 + osmo_rtp_send_frame_ext(lchan->abis_ip.rtp_socket,
46 + bfi, 2, fn_ms_adj(fn, lchan), lchan->rtp_tx_marker);
47 + }
48 + /* clear the marker like in the regular code path */
49 + lchan->rtp_tx_marker = false;
50 }
51
52 lchan->tch.last_fn = fn;