diff options
author | Harald Welte <laforge@osmocom.org> | 2021-04-29 21:38:25 +0200 |
---|---|---|
committer | Harald Welte <laforge@osmocom.org> | 2021-04-29 21:44:18 +0200 |
commit | 14277e337523a014ed1ac8bc9e05c4879486b8dd (patch) | |
tree | 06b8f10b7f3a9512b7789d89e196321931d5cb30 | |
parent | 41547559da9fd396a8919c1498119988cbc832a8 (diff) |
trau: Introduce osmo_rtp_socket_set_priority()2021q1
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
-rw-r--r-- | include/osmocom/trau/osmo_ortp.h | 1 | ||||
-rw-r--r-- | src/trau/osmo_ortp.c | 18 |
2 files changed, 18 insertions, 1 deletions
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 <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 @@ 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 |