mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
修复bug
This commit is contained in:
parent
015a61c465
commit
9f07f98001
@ -1 +1 @@
|
|||||||
Subproject commit e54bd41dbf832ecf49358f4b877372808e8be587
|
Subproject commit 337e0ff2f9552b7fb0c1678598288194cc203bf9
|
@ -242,6 +242,10 @@ void RtmpSession::doPlayResponse(const string &err,bool tryDelay,const std::shar
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//切换到自己的线程再回复
|
//切换到自己的线程再回复
|
||||||
|
//如果触发 kBroadcastMediaChanged 事件的线程与本RtmpSession绑定的线程相同,
|
||||||
|
//那么strongSelf->async操作可能是同步操作,
|
||||||
|
//通过指定参数may_sync为false确保 NoticeCenter::delListener操作延后执行,
|
||||||
|
//以便防止遍历事件监听对象map时做删除操作
|
||||||
strongSelf->async([task_id,weakSelf,pToken,media_info](){
|
strongSelf->async([task_id,weakSelf,pToken,media_info](){
|
||||||
auto strongSelf = weakSelf.lock();
|
auto strongSelf = weakSelf.lock();
|
||||||
if(!strongSelf) {
|
if(!strongSelf) {
|
||||||
@ -252,9 +256,11 @@ void RtmpSession::doPlayResponse(const string &err,bool tryDelay,const std::shar
|
|||||||
strongSelf->doPlayResponse("",false,pToken);
|
strongSelf->doPlayResponse("",false,pToken);
|
||||||
//取消延时任务,防止多次回复
|
//取消延时任务,防止多次回复
|
||||||
strongSelf->cancelDelyaTask();
|
strongSelf->cancelDelyaTask();
|
||||||
|
|
||||||
//取消事件监听
|
//取消事件监听
|
||||||
|
//在事件触发时不能在当前线程移除事件监听,否则会导致遍历map时做删除操作导致程序崩溃
|
||||||
NoticeCenter::Instance().delListener(task_id,Broadcast::kBroadcastMediaChanged);
|
NoticeCenter::Instance().delListener(task_id,Broadcast::kBroadcastMediaChanged);
|
||||||
});
|
}, false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user