mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-29 22:55:52 +08:00
媒体注册、重置事件改成同步触发
This commit is contained in:
parent
075a615a92
commit
6a97fcb3de
@ -78,14 +78,7 @@ vector<Track::Ptr> MediaSource::getTracks(bool trackReady) const {
|
|||||||
|
|
||||||
void MediaSource::setTrackSource(const std::weak_ptr<TrackSource> &track_src) {
|
void MediaSource::setTrackSource(const std::weak_ptr<TrackSource> &track_src) {
|
||||||
_track_source = track_src;
|
_track_source = track_src;
|
||||||
weak_ptr<MediaSource> weakPtr = shared_from_this();
|
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastMediaResetTracks, *this);
|
||||||
EventPollerPool::Instance().getPoller()->async([weakPtr,this](){
|
|
||||||
auto strongPtr = weakPtr.lock();
|
|
||||||
if (!strongPtr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastMediaResetTracks, *this);
|
|
||||||
},false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MediaSource::setListener(const std::weak_ptr<MediaSourceEvent> &listener){
|
void MediaSource::setListener(const std::weak_ptr<MediaSourceEvent> &listener){
|
||||||
@ -293,14 +286,7 @@ void MediaSource::regist() {
|
|||||||
g_mapMediaSrc[_strSchema][_strVhost][_strApp][_strId] = shared_from_this();
|
g_mapMediaSrc[_strSchema][_strVhost][_strApp][_strId] = shared_from_this();
|
||||||
}
|
}
|
||||||
InfoL << _strSchema << " " << _strVhost << " " << _strApp << " " << _strId;
|
InfoL << _strSchema << " " << _strVhost << " " << _strApp << " " << _strId;
|
||||||
weak_ptr<MediaSource> weakPtr = shared_from_this();
|
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastMediaChanged, true, *this);
|
||||||
EventPollerPool::Instance().getPoller()->async([weakPtr,this](){
|
|
||||||
auto strongPtr = weakPtr.lock();
|
|
||||||
if (!strongPtr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastMediaChanged, true, *this);
|
|
||||||
},false);
|
|
||||||
}
|
}
|
||||||
bool MediaSource::unregist() {
|
bool MediaSource::unregist() {
|
||||||
//反注册该源
|
//反注册该源
|
||||||
|
Loading…
Reference in New Issue
Block a user