修复当源析构时组播对象偶现析构不了的问题

This commit is contained in:
zhengwang 2024-06-03 16:41:17 +08:00 committed by zwcarl
parent 4cd735f61d
commit c40aa6d031
No known key found for this signature in database
GPG Key ID: 636ED03F0D9BA31D
1 changed files with 9 additions and 0 deletions

View File

@ -144,7 +144,16 @@ RtpMultiCaster::RtpMultiCaster(SocketHelper &helper, const string &local_ip, con
});
});
string strKey = StrPrinter << local_ip << " " << vhost << " " << app << " " << stream << endl;
_rtp_reader->setDetachCB([this]() {
{
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);