[MERGED] libosmo-abis[master]: Extend RTP frame sending API

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon Jun 6 10:03:08 UTC 2016


Harald Welte has submitted this change and it was merged.

Change subject: Extend RTP frame sending API
......................................................................


Extend RTP frame sending API

Add osmo_rtp_send_frame_ext() which accept boolean parameter in addition
to arguments of osmo_rtp_send_frame() to explicitly set marker bit in
RTP header. Previously it was always unset which resulted in degradation
of speech quality for codecs with explicit talkspurt events (was tested
with AMR's ONSET).

Related: OS#1562
Change-Id: I23e6dccfad5643e662391a0a2abebbb45597ffd9
Reviewed-on: https://gerrit.osmocom.org/82
Tested-by: Jenkins Builder
Reviewed-by: Harald Welte <laforge at gnumonks.org>
---
M include/osmocom/trau/osmo_ortp.h
M src/trau/osmo_ortp.c
2 files changed, 22 insertions(+), 0 deletions(-)

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



diff --git a/include/osmocom/trau/osmo_ortp.h b/include/osmocom/trau/osmo_ortp.h
index 9512759..cec0d2e 100644
--- a/include/osmocom/trau/osmo_ortp.h
+++ b/include/osmocom/trau/osmo_ortp.h
@@ -2,6 +2,7 @@
 #define _OSMO_ORTP_H
 
 #include <stdint.h>
+#include <stdbool.h>
 
 #include <osmocom/core/linuxlist.h>
 #include <osmocom/core/select.h>
@@ -67,6 +68,9 @@
 int osmo_rtp_socket_free(struct osmo_rtp_socket *rs);
 int osmo_rtp_send_frame(struct osmo_rtp_socket *rs, const uint8_t *payload,
 			unsigned int payload_len, unsigned int duration);
+int osmo_rtp_send_frame_ext(struct osmo_rtp_socket *rs, const uint8_t *payload,
+			    unsigned int payload_len, unsigned int duration,
+			    bool marker);
 int osmo_rtp_socket_poll(struct osmo_rtp_socket *rs);
 
 int osmo_rtp_get_bound_ip_port(struct osmo_rtp_socket *rs,
diff --git a/src/trau/osmo_ortp.c b/src/trau/osmo_ortp.c
index 3313798..eb78212 100644
--- a/src/trau/osmo_ortp.c
+++ b/src/trau/osmo_ortp.c
@@ -23,6 +23,7 @@
  */
 
 #include <stdint.h>
+#include <stdbool.h>
 #include <inttypes.h>
 #include <netdb.h>
 
@@ -417,6 +418,22 @@
 int osmo_rtp_send_frame(struct osmo_rtp_socket *rs, const uint8_t *payload,
 			unsigned int payload_len, unsigned int duration)
 {
+	return osmo_rtp_send_frame_ext(rs, payload, payload_len, duration,
+				       false);
+}
+
+/*! \brief Send one RTP frame via a RTP socket
+ *  \param[in] rs OsmoRTP socket
+ *  \param[in] payload pointer to buffer with RTP payload data
+ *  \param[in] payload_len length of \a payload in bytes
+ *  \param[in] duration duration in number of RTP clock ticks
+ *  \param[in] marker the status of Marker bit in RTP header
+ *  \returns 0 on success, <0 in case of error.
+ */
+int osmo_rtp_send_frame_ext(struct osmo_rtp_socket *rs, const uint8_t *payload,
+			unsigned int payload_len, unsigned int duration,
+			bool marker)
+{
 	mblk_t *mblk;
 	int rc;
 
@@ -428,6 +445,7 @@
 	if (!mblk)
 		return -ENOMEM;
 
+	rtp_set_markbit(mblk, marker);
 	rc = rtp_session_sendm_with_ts(rs->sess, mblk,
 				       rs->tx_timestamp);
 	rs->tx_timestamp += duration;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I23e6dccfad5643e662391a0a2abebbb45597ffd9
Gerrit-PatchSet: 3
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list