修复组播bug (#3602)

当多个客户端拉同一个组播源时,如果此时源被析构,会偶现使用该源的组播对象没有被析构的情况,在RtpMultiCaster的_rtp_reader->setDetachCB回调函数中,先移除该组播对象再通知上层session可以解决此问题

---------

Co-authored-by: zhengwang <carl.zheng@lednets.com>
This commit is contained in:
zwcarl 2024-06-09 10:42:02 +08:00 committed by GitHub
parent 4cd735f61d
commit 9a5fdd3dac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -144,7 +144,16 @@ RtpMultiCaster::RtpMultiCaster(SocketHelper &helper, const string &local_ip, con
});
});
_rtp_reader->setDetachCB([this]() {
string strKey = StrPrinter << local_ip << " " << vhost << " " << app << " " << stream << endl;
_rtp_reader->setDetachCB([this, strKey]() {
{
lock_guard<recursive_mutex> lck(g_mtx);
auto it = g_multi_caster_map.find(strKey);
if (it != g_multi_caster_map.end()) {
g_multi_caster_map.erase(it);
}
}
unordered_map<void *, onDetach> _detach_map_copy;
{
lock_guard<recursive_mutex> lck(_mtx);