openRtpServer接口新增local_ip参数 (#3224)

https://github.com/ZLMediaKit/ZLMediaKit/issues/3218

ipv4环境下,修改local_ip为0.0.0.0后可实现在openRtpServer后startSendRtp复用端口

仅测试windows服务端,sip与sip通话
This commit is contained in:
waken
2024-01-18 10:59:09 +08:00
committed by GitHub
parent 8d951f06a0
commit 3a80b1de1e
2 changed files with 29 additions and 10 deletions

View File

@@ -1197,7 +1197,11 @@ void installWebApi() {
//兼容老版本请求新版本去除enable_tcp参数并新增tcp_mode参数
tcp_mode = 1;
}
auto port = openRtpServer(allArgs["port"], stream_id, tcp_mode, "::", allArgs["re_use_port"].as<bool>(),
std::string local_ip = "::";
if (!allArgs["local_ip"].empty()) {
local_ip = allArgs["local_ip"];
}
auto port = openRtpServer(allArgs["port"], stream_id, tcp_mode, local_ip, allArgs["re_use_port"].as<bool>(),
allArgs["ssrc"].as<uint32_t>(), allArgs["only_audio"].as<bool>());
if (port == 0) {
throw InvalidArgsException("该stream_id已存在");
@@ -1215,9 +1219,11 @@ void installWebApi() {
// 兼容老版本请求新版本去除enable_tcp参数并新增tcp_mode参数
tcp_mode = 1;
}
auto port = openRtpServer(
allArgs["port"], stream_id, tcp_mode, "::", true, 0, allArgs["only_audio"].as<bool>(),true);
std::string local_ip = "::";
if (!allArgs["local_ip"].empty()) {
local_ip = allArgs["local_ip"];
}
auto port = openRtpServer(allArgs["port"], stream_id, tcp_mode, local_ip, true, 0, allArgs["only_audio"].as<bool>(),true);
if (port == 0) {
throw InvalidArgsException("该stream_id已存在");
}