[2/3] Fix RTCP port allocation
diff mbox

Message ID 1461926375-18893-2-git-send-email-msuraev@sysmocom.de
State New
Headers show

Commit Message

Max April 29, 2016, 10:39 a.m. UTC
From: Max <msuraev@sysmocom.de>

Force use of random RTCP port if random RTP port is used. Before port 0
could be selected for RTCP.
---
 src/trau/osmo_ortp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch
diff mbox

diff --git a/src/trau/osmo_ortp.c b/src/trau/osmo_ortp.c
index 22c5856..5ab5bf5 100644
--- a/src/trau/osmo_ortp.c
+++ b/src/trau/osmo_ortp.c
@@ -357,7 +357,8 @@  int osmo_rtp_socket_bind(struct osmo_rtp_socket *rs, const char *ip, int port)
 {
 	int rc;
 #if HAVE_ORTP_021
-	rc = rtp_session_set_local_addr(rs->sess, ip, port, port+1);
+	int rtcp = (-1 != port) ? port + 1 : -1;
+	rc = rtp_session_set_local_addr(rs->sess, ip, port, rtcp);
 #else
 	rc = rtp_session_set_local_addr(rs->sess, ip, port);
 #endif