mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
parent
5e08e43e9a
commit
3062ea0e7c
@ -1 +1 @@
|
|||||||
Subproject commit 0d11a09d5e6d76dc9f91b796cd303edb4c9d573a
|
Subproject commit 442f682b1aebc67ee60a1c43718b8bf66e3c1667
|
@ -1056,7 +1056,7 @@ void installWebApi() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RtpServer::Ptr server = std::make_shared<RtpServer>();
|
RtpServer::Ptr server = std::make_shared<RtpServer>();
|
||||||
server->start(allArgs["port"], stream_id, allArgs["enable_tcp"].as<bool>(), "0.0.0.0",
|
server->start(allArgs["port"], stream_id, allArgs["enable_tcp"].as<bool>(), "::",
|
||||||
allArgs["re_use_port"].as<bool>(), allArgs["ssrc"].as<uint32_t>());
|
allArgs["re_use_port"].as<bool>(), allArgs["ssrc"].as<uint32_t>());
|
||||||
server->setOnDetach([stream_id]() {
|
server->setOnDetach([stream_id]() {
|
||||||
//设置rtp超时移除事件
|
//设置rtp超时移除事件
|
||||||
|
@ -209,7 +209,7 @@ string RtpProcess::get_local_ip() {
|
|||||||
if (_sock) {
|
if (_sock) {
|
||||||
return _sock->get_local_ip();
|
return _sock->get_local_ip();
|
||||||
}
|
}
|
||||||
return "0.0.0.0";
|
return "::";
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t RtpProcess::get_local_port() {
|
uint16_t RtpProcess::get_local_port() {
|
||||||
|
@ -37,13 +37,13 @@ void RtpSender::startSend(const MediaSourceEvent::SendRtpArgs &args, const funct
|
|||||||
} else {
|
} else {
|
||||||
auto pr = std::make_pair(std::move(_socket), Socket::createSocket(_poller, false));
|
auto pr = std::make_pair(std::move(_socket), Socket::createSocket(_poller, false));
|
||||||
//从端口池获取随机端口
|
//从端口池获取随机端口
|
||||||
makeSockPair(pr, "0.0.0.0", true);
|
makeSockPair(pr, "::", true);
|
||||||
_socket = std::move(pr.first);
|
_socket = std::move(pr.first);
|
||||||
}
|
}
|
||||||
auto poller = _poller;
|
auto poller = _poller;
|
||||||
auto local_port = _socket->get_local_port();
|
auto local_port = _socket->get_local_port();
|
||||||
WorkThreadPool::Instance().getPoller()->async([cb, args, weak_self, poller, local_port]() {
|
WorkThreadPool::Instance().getPoller()->async([cb, args, weak_self, poller, local_port]() {
|
||||||
struct sockaddr addr;
|
struct sockaddr_storage addr;
|
||||||
//切换线程目的是为了dns解析放在后台线程执行
|
//切换线程目的是为了dns解析放在后台线程执行
|
||||||
if (!SockUtil::getDomainIP(args.dst_url.data(), args.dst_port, addr)) {
|
if (!SockUtil::getDomainIP(args.dst_url.data(), args.dst_port, addr)) {
|
||||||
poller->async([args, cb, local_port]() {
|
poller->async([args, cb, local_port]() {
|
||||||
@ -59,7 +59,7 @@ void RtpSender::startSend(const MediaSourceEvent::SendRtpArgs &args, const funct
|
|||||||
cb(local_port, SockException());
|
cb(local_port, SockException());
|
||||||
auto strong_self = weak_self.lock();
|
auto strong_self = weak_self.lock();
|
||||||
if (strong_self) {
|
if (strong_self) {
|
||||||
strong_self->_socket->bindPeerAddr(&addr);
|
strong_self->_socket->bindPeerAddr((struct sockaddr *)&addr);
|
||||||
strong_self->onConnect();
|
strong_self->onConnect();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -76,7 +76,7 @@ void RtpSender::startSend(const MediaSourceEvent::SendRtpArgs &args, const funct
|
|||||||
} else {
|
} else {
|
||||||
cb(0, err);
|
cb(0, err);
|
||||||
}
|
}
|
||||||
}, 5.0F, "0.0.0.0", args.src_port);
|
}, 5.0F, "::", args.src_port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ public:
|
|||||||
* @param re_use_port 是否设置socket为re_use属性
|
* @param re_use_port 是否设置socket为re_use属性
|
||||||
*/
|
*/
|
||||||
void start(uint16_t local_port, const std::string &stream_id = "", bool enable_tcp = true,
|
void start(uint16_t local_port, const std::string &stream_id = "", bool enable_tcp = true,
|
||||||
const char *local_ip = "0.0.0.0", bool re_use_port = true, uint32_t ssrc = 0);
|
const char *local_ip = "::", bool re_use_port = true, uint32_t ssrc = 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取绑定的本地端口
|
* 获取绑定的本地端口
|
||||||
|
@ -292,7 +292,7 @@ void RtspPlayer::handleResSETUP(const Parser &parser, unsigned int track_idx) {
|
|||||||
//udp组播
|
//udp组播
|
||||||
auto multiAddr = transport_map["destination"];
|
auto multiAddr = transport_map["destination"];
|
||||||
pRtpSockRef = createSocket();
|
pRtpSockRef = createSocket();
|
||||||
if (!pRtpSockRef->bindUdpSock(rtp_port, "0.0.0.0")) {
|
if (!pRtpSockRef->bindUdpSock(rtp_port, "::")) {
|
||||||
pRtpSockRef.reset();
|
pRtpSockRef.reset();
|
||||||
throw std::runtime_error("open udp sock err");
|
throw std::runtime_error("open udp sock err");
|
||||||
}
|
}
|
||||||
@ -303,7 +303,7 @@ void RtspPlayer::handleResSETUP(const Parser &parser, unsigned int track_idx) {
|
|||||||
|
|
||||||
//设置rtcp发送端口
|
//设置rtcp发送端口
|
||||||
pRtcpSockRef = createSocket();
|
pRtcpSockRef = createSocket();
|
||||||
if (!pRtcpSockRef->bindUdpSock(0, "0.0.0.0")) {
|
if (!pRtcpSockRef->bindUdpSock(0, "::")) {
|
||||||
//分配端口失败
|
//分配端口失败
|
||||||
throw runtime_error("open udp socket failed");
|
throw runtime_error("open udp socket failed");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user