支持rtcp心跳包

This commit is contained in:
xiongziliang
2017-11-08 16:56:02 +08:00
parent 8242ad674d
commit 101261c299
4 changed files with 64 additions and 42 deletions

View File

@@ -39,15 +39,15 @@ UDPServer::~UDPServer() {
InfoL;
}
Socket::Ptr UDPServer::getSock(const char* strLocalIp, int iTrackIndex) {
Socket::Ptr UDPServer::getSock(const char* strLocalIp, int iTrackIndex,uint16_t iLocalPort) {
lock_guard<mutex> lck(m_mtxUpdSock);
string strKey = StrPrinter << strLocalIp << ":" << iTrackIndex << endl;
auto it = m_mapUpdSock.find(strKey);
if (it == m_mapUpdSock.end()) {
Socket::Ptr pSock(new Socket());
//InfoL<<localIp;
if (!pSock->bindUdpSock(0, strLocalIp)) {
//系统随机分配端口
if (!pSock->bindUdpSock(iLocalPort, strLocalIp)) {
//分配失败
return nullptr;
}