mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 04:31:37 +08:00
MediaSource: 禁止重复推送一个已经注册的流
This commit is contained in:
parent
afdc5e4267
commit
0b79de9d13
@ -418,7 +418,11 @@ void MediaSource::regist() {
|
|||||||
{
|
{
|
||||||
//减小互斥锁临界区
|
//减小互斥锁临界区
|
||||||
lock_guard<recursive_mutex> lock(s_media_source_mtx);
|
lock_guard<recursive_mutex> lock(s_media_source_mtx);
|
||||||
s_media_source_map[_schema][_vhost][_app][_stream_id] = shared_from_this();
|
auto &ref = s_media_source_map[_schema][_vhost][_app][_stream_id];
|
||||||
|
if (ref.lock()) {
|
||||||
|
throw std::invalid_argument("media source already existed:" + _schema + "/" + _vhost + "/" + _app + "/" + _stream_id);
|
||||||
|
}
|
||||||
|
ref = shared_from_this();
|
||||||
}
|
}
|
||||||
emitEvent(true);
|
emitEvent(true);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user