mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 04:31:37 +08:00
修复组播bug (#3602)
当多个客户端拉同一个组播源时,如果此时源被析构,会偶现使用该源的组播对象没有被析构的情况,在RtpMultiCaster的_rtp_reader->setDetachCB回调函数中,先移除该组播对象再通知上层session可以解决此问题 --------- Co-authored-by: zhengwang <carl.zheng@lednets.com>
This commit is contained in:
parent
4cd735f61d
commit
9a5fdd3dac
@ -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;
|
unordered_map<void *, onDetach> _detach_map_copy;
|
||||||
{
|
{
|
||||||
lock_guard<recursive_mutex> lck(_mtx);
|
lock_guard<recursive_mutex> lck(_mtx);
|
||||||
|
Loading…
Reference in New Issue
Block a user