修正on_rtp_server_timeout hook时获取的端口非真实端口

local_port为0时启动RtpServer,当hook 获取rtp_server_timeout时获取端口不是实际分配端口
This commit is contained in:
ljx0305 2023-03-07 11:51:38 +08:00 committed by GitHub
parent e326d04aed
commit 07aaf4c8f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -161,6 +161,7 @@ void RtpServer::start(uint16_t local_port, const string &stream_id, TcpMode tcp_
//随机端口rtp端口采用偶数
auto pair = std::make_pair(rtp_socket, rtcp_socket);
makeSockPair(pair, local_ip, re_use_port);
local_port = rtp_socket->get_local_port();
} else if (!rtp_socket->bindUdpSock(local_port, local_ip, re_use_port)) {
//用户指定端口
throw std::runtime_error(StrPrinter << "创建rtp端口 " << local_ip << ":" << local_port << " 失败:" << get_uv_errmsg(true));