Change in libosmo-netif[master]: osmux: Extend osmux_out_handle and add new API to set rtp payload_type

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun May 19 07:17:25 UTC 2019


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/14076 )

Change subject: osmux: Extend osmux_out_handle and add new API to set rtp payload_type
......................................................................

osmux: Extend osmux_out_handle and add new API to set rtp payload_type

Previously payload_type was always hardcoded to 98 for generated rtp
packets from incoming osmux frame.

Change-Id: I5cbeb494a8932953d9fd2dc24dacf8cd97fd84e4
---
M TODO-RELEASE
M include/osmocom/netif/osmux.h
M src/osmux.c
M tests/jibuf/jibuf_tool.c
M tests/osmo-pcap-test/osmux_test.c
M tests/osmux/osmux_test.c
M tests/osmux/osmux_test2.c
7 files changed, 22 insertions(+), 11 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/TODO-RELEASE b/TODO-RELEASE
index d0852fc..45ebb75 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -7,3 +7,5 @@
 # If any interfaces have been added since the last public release: c:r:a + 1.
 # If any interfaces have been removed or changed since the last public release: c:r:0.
 #library	what		description / commit summary line
+libosmo-netif	Add new field to struct osmux_out_handle	Breaks ABI with older versions
+libosmo-netif	Add new API osmux_xfrm_output_init2	Deprecates old osmux_xfrm_output_init
diff --git a/include/osmocom/netif/osmux.h b/include/osmocom/netif/osmux.h
index dfed66a..7dee438 100644
--- a/include/osmocom/netif/osmux.h
+++ b/include/osmocom/netif/osmux.h
@@ -80,6 +80,7 @@
 	uint16_t rtp_seq;
 	uint32_t rtp_timestamp;
 	uint32_t rtp_ssrc;
+	uint8_t rtp_payload_type;
 	uint8_t osmux_seq_ack; /* Latest received seq num */
 	struct osmo_timer_list	timer;
 	struct llist_head list;
@@ -106,7 +107,8 @@
 int osmux_xfrm_input(struct osmux_in_handle *h, struct msgb *msg, int ccid);
 void osmux_xfrm_input_deliver(struct osmux_in_handle *h);
 
-void osmux_xfrm_output_init(struct osmux_out_handle *h, uint32_t rtp_ssrc);
+void osmux_xfrm_output_init(struct osmux_out_handle *h, uint32_t rtp_ssrc) OSMO_DEPRECATED("Use osmux_xfrm_output_init2() instead");
+void osmux_xfrm_output_init2(struct osmux_out_handle *h, uint32_t rtp_ssrc, uint8_t rtp_payload_type);
 void osmux_xfrm_output_set_tx_cb(struct osmux_out_handle *h, void (*tx_cb)(struct msgb *msg, void *data), void *data);
 int osmux_xfrm_output(struct osmux_hdr *osmuxh, struct osmux_out_handle *h, struct llist_head *list) OSMO_DEPRECATED("Use osmux_xfrm_output_sched() instead");
 int osmux_xfrm_output_sched(struct osmux_out_handle *h, struct osmux_hdr *osmuxh);
diff --git a/src/osmux.c b/src/osmux.c
index 7a6ce60..8b6a115 100644
--- a/src/osmux.c
+++ b/src/osmux.c
@@ -146,7 +146,7 @@
 	rtph->csrc_count = 0;
 	rtph->extension = 0;
 	rtph->version = RTP_VERSION;
-	rtph->payload_type = 98;
+	rtph->payload_type = h->rtp_payload_type;
 	/* ... emulate timestamp and ssrc */
 	rtph->timestamp = htonl(h->rtp_timestamp);
 	rtph->sequence = htons(h->rtp_seq);
@@ -999,16 +999,23 @@
 	}
 }
 
-void osmux_xfrm_output_init(struct osmux_out_handle *h, uint32_t rtp_ssrc)
+void osmux_xfrm_output_init2(struct osmux_out_handle *h, uint32_t rtp_ssrc, uint8_t rtp_payload_type)
 {
 	memset(h, 0, sizeof(*h));
 	h->rtp_seq = (uint16_t)random();
 	h->rtp_timestamp = (uint32_t)random();
 	h->rtp_ssrc = rtp_ssrc;
+	h->rtp_payload_type = rtp_payload_type;
 	INIT_LLIST_HEAD(&h->list);
 	osmo_timer_setup(&h->timer, osmux_xfrm_output_trigger, h);
 }
 
+void osmux_xfrm_output_init(struct osmux_out_handle *h, uint32_t rtp_ssrc)
+{
+	/* backward compatibility with old users, where 98 was harcoded in osmux_rebuild_rtp()  */
+	osmux_xfrm_output_init2(h, rtp_ssrc, 98);
+}
+
 #define SNPRINTF_BUFFER_SIZE(ret, remain, offset)	\
 	if (ret < 0)					\
 		ret = 0;				\
diff --git a/tests/jibuf/jibuf_tool.c b/tests/jibuf/jibuf_tool.c
index bd444a7..df11131 100644
--- a/tests/jibuf/jibuf_tool.c
+++ b/tests/jibuf/jibuf_tool.c
@@ -517,7 +517,7 @@
 	osmo_pcap.timer.cb = pcap_pkt_timer_cb;
 
 	if(opt_osmux) {
-		osmux_xfrm_output_init(&pcap_osmux_h, 0);
+		osmux_xfrm_output_init2(&pcap_osmux_h, 0, 98);
 		osmux_xfrm_output_set_tx_cb(&pcap_osmux_h, glue_cb, NULL);
 	}
 
diff --git a/tests/osmo-pcap-test/osmux_test.c b/tests/osmo-pcap-test/osmux_test.c
index 7ec78a0..9163753 100644
--- a/tests/osmo-pcap-test/osmux_test.c
+++ b/tests/osmo-pcap-test/osmux_test.c
@@ -189,7 +189,7 @@
 	osmo_pcap.timer.cb = osmo_pcap_pkt_timer_cb;
 
 	osmux_xfrm_input_init(&h_input);
-	osmux_xfrm_output_init(&h_output);
+	osmux_xfrm_output_init2(&h_output, 0, 98);
 	osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, NULL);
 
 	/* first run */
diff --git a/tests/osmux/osmux_test.c b/tests/osmux/osmux_test.c
index 704ccbc..e2eb777 100644
--- a/tests/osmux/osmux_test.c
+++ b/tests/osmux/osmux_test.c
@@ -269,7 +269,7 @@
 	osmo_init_logging2(tall_ctx, &osmux_test_log_info);
 	log_set_log_level(osmo_stderr_target, LOGL_DEBUG);
 
-	osmux_xfrm_output_init(&h_output, 0x7000000);
+	osmux_xfrm_output_init2(&h_output, 0x7000000, 98);
 	osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, NULL);
 
 	/* If the test takes longer than 10 seconds, abort it */
diff --git a/tests/osmux/osmux_test2.c b/tests/osmux/osmux_test2.c
index ecd9296..ffe1101 100644
--- a/tests/osmux/osmux_test2.c
+++ b/tests/osmux/osmux_test2.c
@@ -164,7 +164,7 @@
 	clock_override_enable(true);
 	clock_override_set(0, 0);
 	osmux_init(32);
-	osmux_xfrm_output_init(&h_output, 0x7000000);
+	osmux_xfrm_output_init2(&h_output, 0x7000000, 98);
 	h_output.rtp_seq = (uint16_t)50;
 	h_output.rtp_timestamp = (uint32_t)500;
 	osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, &h_output);
@@ -226,7 +226,7 @@
 	clock_override_enable(true);
 	clock_override_set(0, 0);
 	osmux_init(32);
-	osmux_xfrm_output_init(&h_output, 0x7000000);
+	osmux_xfrm_output_init2(&h_output, 0x7000000, 98);
 	h_output.rtp_seq = (uint16_t)50;
 	h_output.rtp_timestamp = (uint32_t)500;
 	osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, &h_output);
@@ -263,7 +263,7 @@
 	clock_override_enable(true);
 	clock_override_set(0, 0);
 	osmux_init(32);
-	osmux_xfrm_output_init(&h_output, 0x7000000);
+	osmux_xfrm_output_init2(&h_output, 0x7000000, 98);
 	h_output.rtp_seq = (uint16_t)50;
 	h_output.rtp_timestamp = (uint32_t)500;
 	osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, &h_output);
@@ -297,7 +297,7 @@
 	clock_override_enable(true);
 	clock_override_set(0, 0);
 	osmux_init(32);
-	osmux_xfrm_output_init(&h_output, 0x7000000);
+	osmux_xfrm_output_init2(&h_output, 0x7000000, 98);
 	h_output.rtp_seq = (uint16_t)50;
 	h_output.rtp_timestamp = (uint32_t)500;
 	osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, &h_output);
@@ -329,7 +329,7 @@
 	clock_override_enable(true);
 	clock_override_set(0, 0);
 	osmux_init(32);
-	osmux_xfrm_output_init(&h_output, 0x7000000);
+	osmux_xfrm_output_init2(&h_output, 0x7000000, 98);
 	h_output.rtp_seq = (uint16_t)50;
 	h_output.rtp_timestamp = (uint32_t)500;
 	osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, &h_output);

-- 
To view, visit https://gerrit.osmocom.org/14076
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I5cbeb494a8932953d9fd2dc24dacf8cd97fd84e4
Gerrit-Change-Number: 14076
Gerrit-PatchSet: 2
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190519/64511262/attachment.html>


More information about the gerrit-log mailing list