修复rtp单端口模式主动关闭时线程安全问题

This commit is contained in:
xia-chu 2024-11-29 21:08:09 +08:00
parent 64285b6b09
commit 02a0b0402a

View File

@ -127,8 +127,7 @@ void RtpSession::onRtpPacket(const char *data, size_t len) {
weak_ptr<RtpSession> weak_self = static_pointer_cast<RtpSession>(shared_from_this()); weak_ptr<RtpSession> weak_self = static_pointer_cast<RtpSession>(shared_from_this());
_process->setOnDetach([weak_self](const SockException &ex) { _process->setOnDetach([weak_self](const SockException &ex) {
if (auto strong_self = weak_self.lock()) { if (auto strong_self = weak_self.lock()) {
strong_self->_process = nullptr; strong_self->safeShutdown(ex);
strong_self->shutdown(ex);
} }
}); });
} }