mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
修复rtp组播的bug
This commit is contained in:
parent
b2e650f9f6
commit
5901ff197d
@ -58,6 +58,8 @@ void RtpBroadCaster::setDetachCB(void* listener, const onDetach& cb) {
|
||||
}
|
||||
}
|
||||
RtpBroadCaster::~RtpBroadCaster() {
|
||||
m_pReader->setReadCB(nullptr);
|
||||
m_pReader->setDetachCB(nullptr);
|
||||
DebugL;
|
||||
}
|
||||
RtpBroadCaster::RtpBroadCaster(const string &strLocalIp,const string &strApp,const string &strStream) {
|
||||
@ -93,15 +95,13 @@ RtpBroadCaster::RtpBroadCaster(const string &strLocalIp,const string &strApp,con
|
||||
pSock->sendTo((char *) pkt->payload + 4, pkt->length - 4,(struct sockaddr *)(&peerAddr));
|
||||
});
|
||||
m_pReader->setDetachCB([this](){
|
||||
unordered_map<void * , onDetach > m_mapDetach_copy;
|
||||
{
|
||||
lock_guard<recursive_mutex> lck(m_mtx);
|
||||
list<onDetach> lst;
|
||||
for(auto &pr : m_mapDetach){
|
||||
lst.emplace_back(pr.second);
|
||||
m_mapDetach_copy.swap(m_mapDetach);
|
||||
}
|
||||
m_mapDetach.clear();
|
||||
|
||||
for(auto &cb : lst){
|
||||
cb();
|
||||
for(auto &pr : m_mapDetach_copy){
|
||||
pr.second();
|
||||
}
|
||||
});
|
||||
DebugL << MultiCastAddressMaker::toString(*m_multiAddr) << " "
|
||||
|
Loading…
Reference in New Issue
Block a user