[PATCH] osmo-bts[master]: l1sap.c: Avoid sending RTP frame with empty payload

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Wed Jun 28 15:46:41 UTC 2017


Review at  https://gerrit.osmocom.org/3071

l1sap.c: Avoid sending RTP frame with empty payload

Depends on libosmo-abis Id6099372b6231c0a4b6ea0716f46f5daee7049e1

Change-Id: Ie9053674aa4f43aac20dbd5c865d70317360abbc
---
M src/common/l1sap.c
1 file changed, 23 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/71/3071/1

diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 1fb6134..3d53795 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -1011,22 +1011,31 @@
 
 	msgb_pull(msg, sizeof(*l1sap));
 
-	/* hand msg to RTP code for transmission */
-	if (lchan->abis_ip.rtp_socket)
-		osmo_rtp_send_frame_ext(lchan->abis_ip.rtp_socket,
-			msg->data, msg->len, fn_ms_adj(fn, lchan), lchan->rtp_tx_marker);
-
-	/* if loopback is enabled, also queue received RTP data */
-	if (lchan->loopback) {
-		/* make sure the queue doesn't get too long */
-		queue_limit_to(gsm_lchan_name(lchan), &lchan->dl_tch_queue, 1);
-		/* add new frame to queue */
-		msgb_enqueue(&lchan->dl_tch_queue, msg);
-		/* Return 1 to signal that we're still using msg and it should not be freed */
-		return 1;
+	/* Low level layers always call us when TCH content is expected to be
+	 * available, even if the content is not available due to decoding
+	 * issues. Content not available is expected as empty payload. */
+	if(msg->len) {
+		/* hand msg to RTP code for transmission */
+		if (lchan->abis_ip.rtp_socket)
+			osmo_rtp_send_frame_ext(lchan->abis_ip.rtp_socket,
+				msg->data, msg->len, fn_ms_adj(fn, lchan), lchan->rtp_tx_marker);
+		/* if loopback is enabled, also queue received RTP data */
+		if (lchan->loopback) {
+			/* make sure the queue doesn't get too long */
+			queue_limit_to(gsm_lchan_name(lchan), &lchan->dl_tch_queue, 1);
+			/* add new frame to queue */
+			msgb_enqueue(&lchan->dl_tch_queue, msg);
+			/* Return 1 to signal that we're still using msg and it should not be freed */
+			return 1;
+		}
+		/* Only clear the marker bit once we have sent a RTP packet with it */
+		lchan->rtp_tx_marker = false;
+	} else {
+		DEBUGP(DL1P, "Dropping RTP frame with lost payload\n");
+		if (lchan->abis_ip.rtp_socket)
+			osmo_rtp_drop_frame(lchan->abis_ip.rtp_socket, fn_ms_adj(fn, lchan));
 	}
 
-	lchan->rtp_tx_marker = false;
 	lchan->tch.last_fn = fn;
 	return 0;
 }

-- 
To view, visit https://gerrit.osmocom.org/3071
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie9053674aa4f43aac20dbd5c865d70317360abbc
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list