mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-29 14:45:55 +08:00
修复可能无限递归的bug
This commit is contained in:
parent
a7e99b9d37
commit
8961ca1659
@ -270,8 +270,18 @@ void FFmpegSource::onRegist(MediaSource &sender, bool regist){
|
||||
}
|
||||
|
||||
void FFmpegSource::onGetMediaSource(const MediaSource::Ptr &src) {
|
||||
_listener = src->getListener();
|
||||
src->setListener(shared_from_this());
|
||||
auto listener = src->getListener();
|
||||
if (listener.lock().get() != this) {
|
||||
//防止多次进入onGetMediaSource函数导致无效递归调用的bug
|
||||
src->setListener(shared_from_this());
|
||||
_listener = listener;
|
||||
} else {
|
||||
WarnL << "多次触发onGetMediaSource事件:"
|
||||
<< src->getSchema() << "/"
|
||||
<< src->getVhost() << "/"
|
||||
<< src->getApp() << "/"
|
||||
<< src->getId();
|
||||
}
|
||||
}
|
||||
|
||||
void FFmpegSnap::makeSnap(const string &play_url, const string &save_path, float timeout_sec, const function<void(bool)> &cb) {
|
||||
|
Loading…
Reference in New Issue
Block a user