trau: Introduce osmo_rtp_socket_set_priority()
For consistency reasons with osmo_rtp_socket_set_dscp(), let's also
introduce a osmo_rtp_socket_set_priority() function to wrap the two
calls to osmo_sock_set_priority().
Change-Id: I52c08f4b2a46981d002ef0c21e6549445d845a6e
diff --git a/src/trau/osmo_ortp.c b/src/trau/osmo_ortp.c
index d105ca8..b72f681 100644
--- a/src/trau/osmo_ortp.c
+++ b/src/trau/osmo_ortp.c
@@ -1,4 +1,4 @@
-/* (C) 2011 by Harald Welte <laforge@gnumonks.org>
+/* (C) 2011-2021 by Harald Welte <laforge@gnumonks.org>
* (C) 2011 by On-Waves e.h.f
* All Rights Reserved
*
@@ -33,6 +33,7 @@
#include <osmocom/core/talloc.h>
#include <osmocom/core/utils.h>
#include <osmocom/core/select.h>
+#include <osmocom/core/socket.h>
#include <osmocom/trau/osmo_ortp.h>
#include <ortp/ortp.h>
@@ -592,6 +593,21 @@
return rtp_session_set_dscp(rs->sess, dscp);
}
+/*! \brief Set the socket priority for outgoing RTP packets
+ * \param[in] rs OsmoRTP socket
+ * \param[in] prio socket priority
+ * \returns 0 on success, < 0 otherwise
+ */
+int osmo_rtp_socket_set_priority(struct osmo_rtp_socket *rs, uint8_t prio)
+{
+ int rc;
+
+ rc = osmo_sock_set_priority(rs->rtp_bfd.fd, prio);
+ if (rc < 0)
+ return rc;
+ return osmo_sock_set_priority(rs->rtcp_bfd.fd, prio);
+}
+
/*! \brief completely close the RTP socket and release all resources
* \param[in] rs OsmoRTP socket to be released
* \returns 0 on success