From 14277e337523a014ed1ac8bc9e05c4879486b8dd Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 29 Apr 2021 21:38:25 +0200 Subject: 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 --- include/osmocom/trau/osmo_ortp.h | 1 + src/trau/osmo_ortp.c | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/include/osmocom/trau/osmo_ortp.h b/include/osmocom/trau/osmo_ortp.h index 1e0720c..4cf2321 100644 --- a/include/osmocom/trau/osmo_ortp.h +++ b/include/osmocom/trau/osmo_ortp.h @@ -77,6 +77,7 @@ int osmo_rtp_socket_connect(struct osmo_rtp_socket *rs, const char *ip, uint16_t int osmo_rtp_socket_autoconnect(struct osmo_rtp_socket *rs); int osmo_rtp_socket_set_pt(struct osmo_rtp_socket *rs, int payload_type); int osmo_rtp_socket_set_dscp(struct osmo_rtp_socket *rs, int dscp); +int osmo_rtp_socket_set_priority(struct osmo_rtp_socket *rs, uint8_t prio); int osmo_rtp_socket_free(struct osmo_rtp_socket *rs); int osmo_rtp_skipped_frame(struct osmo_rtp_socket *rs, unsigned int duration); int osmo_rtp_send_frame(struct osmo_rtp_socket *rs, const uint8_t *payload, 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 +/* (C) 2011-2021 by Harald Welte * (C) 2011 by On-Waves e.h.f * All Rights Reserved * @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -592,6 +593,21 @@ int osmo_rtp_socket_set_dscp(struct osmo_rtp_socket *rs, int dscp) 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 -- cgit v1.2.3