From 4cf90aa8d963d9e65564f42de1ce8252f4ebed48 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Wed, 3 Jan 2018 11:48:06 +0100 Subject: [PATCH] Fixed RTSP input VLC compatibility --- lib/sdp.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/sdp.cpp b/lib/sdp.cpp index 235ef6d3..f3bd7e13 100644 --- a/lib/sdp.cpp +++ b/lib/sdp.cpp @@ -208,8 +208,12 @@ namespace SDP{ // A little more tricky: we need to find free ports and remember them. data.SetDestination(dest, 1337); rtcp.SetDestination(dest, 1337); - portA = data.bind(0); - portB = rtcp.bind(0); + portA = portB = 0; + int retries = 0; + while (portB != portA+1 && retries < 10){ + portA = data.bind(0); + portB = rtcp.bind(portA+1); + } std::stringstream tStr; tStr << "RTP/AVP/UDP;unicast;client_port=" << portA << "-" << portB; return tStr.str();