修复udp单端口模式下rtp鉴权失败后无法关闭流的问题(#2985)

如果rtp推流鉴权失败,在udp模式下延时断开连接,等待超时自动关闭,防止频繁创建销毁RtpSession对象,
tcp模式则立即断开链接。
This commit is contained in:
taotaobujue
2023-11-15 11:02:12 +08:00
committed by GitHub
parent 2a9a51af1f
commit 7865f2c360
3 changed files with 14 additions and 2 deletions

View File

@@ -79,6 +79,9 @@ bool RtpProcess::inputRtp(bool is_udp, const Socket::Ptr &sock, const char *data
WarnP(this) << "Not rtp packet";
return false;
}
if (!_auth_err.empty()) {
throw toolkit::SockException(toolkit::Err_other, _auth_err);
}
if (_sock != sock) {
// 第一次运行本函数
bool first = !_sock;
@@ -260,6 +263,7 @@ void RtpProcess::emitOnPublish() {
strong_self->doCachedFunc();
InfoP(strong_self) << "允许RTP推流";
} else {
strong_self->_auth_err = err;
WarnP(strong_self) << "禁止RTP推流:" << err;
}
});