diff --git a/src/Rtsp/RtpMultiCaster.cpp b/src/Rtsp/RtpMultiCaster.cpp index fefc0f84..c358e68e 100644 --- a/src/Rtsp/RtpMultiCaster.cpp +++ b/src/Rtsp/RtpMultiCaster.cpp @@ -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 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 _detach_map_copy; { lock_guard lck(_mtx);