rtp级联速度太慢时主动限制上游接收速度 3

This commit is contained in:
xia-chu 2025-04-20 20:27:08 +08:00
parent 921a6505d6
commit 1e14d296f5

View File

@ -36,19 +36,15 @@ RtpSender::~RtpSender() {
} }
void RtpSender::startSend(const MediaSource &sender, 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 { auto origin_socket = sender.getOriginSock();
_origin_socket = dynamic_pointer_cast<Socket>(sender.getOriginSock()); _origin_socket = dynamic_pointer_cast<Socket>(origin_socket);
} catch (...) {
}
if (!_origin_socket) { if (!_origin_socket) {
try { auto process = dynamic_pointer_cast<RtpProcess>(origin_socket);
auto process = dynamic_pointer_cast<RtpProcess>(sender.getOriginSock());
if (process) { if (process) {
_origin_socket = process->getSock(); _origin_socket = process->getSock();
} }
} catch (...) {
}
} }
_args = args; _args = args;
if (!_interface) { if (!_interface) {
// 重连时不重新创建对象 [AUTO-TRANSLATED:b788cd5d] // 重连时不重新创建对象 [AUTO-TRANSLATED:b788cd5d]
@ -455,8 +451,8 @@ 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()) { if (_socket_rtp->sockType() == toolkit::SockNum::Sock_TCP && _socket_rtp->isSocketBusy() && _origin_socket) {
_socket_rtp->enableRecv(false); _origin_socket->enableRecv(false);
} }
}); });
}; };