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
This commit is contained in:
Harald Welte 2021-04-29 21:38:25 +02:00
parent 41547559da
commit 14277e3375
2 changed files with 18 additions and 1 deletions

View File

@ -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,

View File

@ -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