changeset 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 4f1f3f799295
children 36cce9b0bbe2
files osmo-patches/osmo-bts-rtp-bfi.patch
diffstat 1 files changed, 52 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/osmo-patches/osmo-bts-rtp-bfi.patch	Mon Nov 21 01:05:58 2022 -0800
@@ -0,0 +1,52 @@
+diff --git a/src/common/l1sap.c b/src/common/l1sap.c
+index 8bcd417..bfdc37f 100644
+--- a/src/common/l1sap.c
++++ b/src/common/l1sap.c
+@@ -1244,6 +1244,12 @@ static bool rtppayload_is_octet_aligned(const uint8_t *rtp_pl, uint8_t payload_l
+ 
+ static bool rtppayload_is_valid(struct gsm_lchan *lchan, struct msgb *resp_msg)
+ {
++	/* Discard Themyscira BFI packets - because we have our own
++	 * TDMA timing, there is no difference for us between receiving
++	 * an explicit BFI packet vs receiving nothing at all. */
++	if (resp_msg->len == 2 && resp_msg->data[0] == 0xBF)
++		return false;
++
+ 	/* Avoid sending bw-efficient AMR to lower layers, most bts models
+ 	 * don't support it. */
+ 	if (lchan->tch_mode == GSM48_CMODE_SPEECH_AMR &&
+@@ -1574,6 +1580,7 @@ static int l1sap_tch_ind(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap,
+ 	struct gsm_lchan *lchan;
+ 	uint8_t  chan_nr;
+ 	uint32_t fn;
++	uint8_t bfi[2];
+ 
+ 	chan_nr = tch_ind->chan_nr;
+ 	fn = tch_ind->fn;
+@@ -1619,13 +1626,19 @@ static int l1sap_tch_ind(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap,
+ 		/* Only clear the marker bit once we have sent a RTP packet with it */
+ 		lchan->rtp_tx_marker = false;
+ 	} else {
+-		DEBUGPGT(DRTP, &g_time, "Skipping RTP frame with lost payload (chan_nr=0x%02x)\n",
+-			 chan_nr);
+-		if (lchan->abis_ip.osmux.use)
+-			lchan_osmux_skipped_frame(lchan, fn_ms_adj(fn, lchan));
+-		else if (lchan->abis_ip.rtp_socket)
+-			osmo_rtp_skipped_frame(lchan->abis_ip.rtp_socket, fn_ms_adj(fn, lchan));
+-		lchan->rtp_tx_marker = true;
++		/* Themyscira change: send explicit BFI packets instead of
++		 * gaps in the RTP stream. */
++		bfi[0] = 0xBF;
++		bfi[1] = 0;	/* TAF will go here */
++		if (lchan->abis_ip.osmux.use) {
++			lchan_osmux_send_frame(lchan, bfi, 2,
++					       fn_ms_adj(fn, lchan), lchan->rtp_tx_marker);
++		} else if (lchan->abis_ip.rtp_socket) {
++			osmo_rtp_send_frame_ext(lchan->abis_ip.rtp_socket,
++				bfi, 2, fn_ms_adj(fn, lchan), lchan->rtp_tx_marker);
++		}
++		/* clear the marker like in the regular code path */
++		lchan->rtp_tx_marker = false;
+ 	}
+ 
+ 	lchan->tch.last_fn = fn;