Merge pull request #599 from sunhui2013/master

解决RtpServer启动UDPServer收流造成崩溃问题
This commit is contained in:
夏楚 2020-11-29 09:27:58 +08:00 committed by GitHub
commit 5f01eb7f73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,10 +24,10 @@ RtpServer::~RtpServer() {
void RtpServer::start(uint16_t local_port, const string &stream_id, bool enable_tcp, const char *local_ip) {
//创建udp服务器
Socket::Ptr udp_server = Socket::createSocket(nullptr, false);
Socket::Ptr udp_server = Socket::createSocket(nullptr, true);
if (local_port == 0) {
//随机端口rtp端口采用偶数
Socket::Ptr rtcp_server = Socket::createSocket(nullptr, false);
Socket::Ptr rtcp_server = Socket::createSocket(nullptr, true);
auto pair = std::make_pair(udp_server, rtcp_server);
makeSockPair(pair, local_ip);
//取偶数端口