mirror of
https://gitee.com/xia-chu/ZLMediaKit.git
synced 2026-05-17 07:17:50 +08:00
rtp级联速度太慢时主动限制上游接收速度
This commit is contained in:
parent
444aeceacc
commit
d57c63dca6
@ -423,7 +423,7 @@ void MultiMediaSourceMuxer::startSendRtp(MediaSource &sender, const MediaSourceE
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
rtp_sender->startSend(args, [ssrc,ssrc_multi_send, weak_self, rtp_sender, cb, tracks, ring, poller](uint16_t local_port, const SockException &ex) mutable {
|
rtp_sender->startSend(sender, args, [ssrc,ssrc_multi_send, weak_self, rtp_sender, cb, tracks, ring, poller](uint16_t local_port, const SockException &ex) mutable {
|
||||||
cb(local_port, ex);
|
cb(local_port, ex);
|
||||||
auto strong_self = weak_self.lock();
|
auto strong_self = weak_self.lock();
|
||||||
if (!strong_self || ex) {
|
if (!strong_self || ex) {
|
||||||
|
|||||||
@ -35,7 +35,11 @@ RtpSender::~RtpSender() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RtpSender::startSend(const MediaSourceEvent::SendRtpArgs &args, const function<void(uint16_t local_port, const SockException &ex)> &cb){
|
void RtpSender::startSend(const MediaSource &sender, const MediaSourceEvent::SendRtpArgs &args, const function<void(uint16_t local_port, const SockException &ex)> &cb){
|
||||||
|
try {
|
||||||
|
_origin_socket = dynamic_pointer_cast<Socket>(sender.getOriginSock());
|
||||||
|
} catch (...) {
|
||||||
|
}
|
||||||
_args = args;
|
_args = args;
|
||||||
if (!_interface) {
|
if (!_interface) {
|
||||||
// 重连时不重新创建对象 [AUTO-TRANSLATED:b788cd5d]
|
// 重连时不重新创建对象 [AUTO-TRANSLATED:b788cd5d]
|
||||||
@ -313,6 +317,15 @@ void RtpSender::onConnect() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_socket_rtp->sockType() == toolkit::SockNum::Sock_TCP && _origin_socket) {
|
||||||
|
// rtp 端口是TCP端口,转发速度应当控制收流速度
|
||||||
|
auto origin_socket = _origin_socket;
|
||||||
|
_socket_rtp->setOnFlush([origin_socket]() {
|
||||||
|
origin_socket->enableRecv(true);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
InfoL << "startSend rtp success: " << _socket_rtp->get_peer_ip() << ":" << _socket_rtp->get_peer_port() << ", data_type: " << _args.data_type << ", con_type: " << _args.con_type;
|
InfoL << "startSend rtp success: " << _socket_rtp->get_peer_ip() << ":" << _socket_rtp->get_peer_port() << ", data_type: " << _args.data_type << ", con_type: " << _args.con_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -433,6 +446,9 @@ void RtpSender::onFlushRtpList(shared_ptr<List<Buffer::Ptr>> rtp_list) {
|
|||||||
}
|
}
|
||||||
default: CHECK(0);
|
default: CHECK(0);
|
||||||
}
|
}
|
||||||
|
if (_socket_rtp->sockType() == toolkit::SockNum::Sock_TCP && _socket_rtp->isSocketBusy()) {
|
||||||
|
_socket_rtp->enableRecv(false);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
if (_args.con_type != MediaSourceEvent::SendRtpArgs::kVoiceTalk) {
|
if (_args.con_type != MediaSourceEvent::SendRtpArgs::kVoiceTalk) {
|
||||||
|
|||||||
@ -40,7 +40,7 @@ public:
|
|||||||
|
|
||||||
* [AUTO-TRANSLATED:c31bd9b3]
|
* [AUTO-TRANSLATED:c31bd9b3]
|
||||||
*/
|
*/
|
||||||
void startSend(const MediaSourceEvent::SendRtpArgs &args, const std::function<void(uint16_t local_port, const toolkit::SockException &ex)> &cb);
|
void startSend(const MediaSource &sender, const MediaSourceEvent::SendRtpArgs &args, const std::function<void(uint16_t local_port, const toolkit::SockException &ex)> &cb);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 输入帧数据
|
* 输入帧数据
|
||||||
@ -111,6 +111,7 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool _is_connect = false;
|
bool _is_connect = false;
|
||||||
|
toolkit::Socket::Ptr _origin_socket;
|
||||||
MediaSourceEvent::SendRtpArgs _args;
|
MediaSourceEvent::SendRtpArgs _args;
|
||||||
toolkit::Socket::Ptr _socket_rtp;
|
toolkit::Socket::Ptr _socket_rtp;
|
||||||
toolkit::Socket::Ptr _socket_rtcp;
|
toolkit::Socket::Ptr _socket_rtcp;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user