mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-13 19:51:49 +08:00
重写mp4录制驱动机制
This commit is contained in:
@@ -80,6 +80,19 @@ vector<Track::Ptr> MediaSource::getTracks(bool trackReady) const {
|
||||
|
||||
void MediaSource::setTrackSource(const std::weak_ptr<TrackSource> &track_src) {
|
||||
_track_source = track_src;
|
||||
weak_ptr<MediaSource> weakPtr = shared_from_this();
|
||||
EventPollerPool::Instance().getPoller()->async([weakPtr,this](){
|
||||
auto strongPtr = weakPtr.lock();
|
||||
if (!strongPtr) {
|
||||
return;
|
||||
}
|
||||
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastMediaResetTracks,
|
||||
_strSchema,
|
||||
_strVhost,
|
||||
_strApp,
|
||||
_strId,
|
||||
*this);
|
||||
},false);
|
||||
}
|
||||
|
||||
void MediaSource::setListener(const std::weak_ptr<MediaSourceEvent> &listener){
|
||||
@@ -293,13 +306,20 @@ void MediaSource::regist() {
|
||||
g_mapMediaSrc[_strSchema][_strVhost][_strApp][_strId] = shared_from_this();
|
||||
}
|
||||
InfoL << _strSchema << " " << _strVhost << " " << _strApp << " " << _strId;
|
||||
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastMediaChanged,
|
||||
true,
|
||||
_strSchema,
|
||||
_strVhost,
|
||||
_strApp,
|
||||
_strId,
|
||||
*this);
|
||||
weak_ptr<MediaSource> weakPtr = shared_from_this();
|
||||
EventPollerPool::Instance().getPoller()->async([weakPtr,this](){
|
||||
auto strongPtr = weakPtr.lock();
|
||||
if (!strongPtr) {
|
||||
return;
|
||||
}
|
||||
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastMediaChanged,
|
||||
true,
|
||||
_strSchema,
|
||||
_strVhost,
|
||||
_strApp,
|
||||
_strId,
|
||||
*this);
|
||||
},false);
|
||||
}
|
||||
bool MediaSource::unregist() {
|
||||
//反注册该源
|
||||
@@ -328,6 +348,21 @@ void MediaSource::unregisted(){
|
||||
_strApp,
|
||||
_strId,
|
||||
*this);
|
||||
|
||||
weak_ptr<MediaSource> weakPtr = shared_from_this();
|
||||
EventPollerPool::Instance().getPoller()->async([weakPtr,this](){
|
||||
auto strongPtr = weakPtr.lock();
|
||||
if (!strongPtr) {
|
||||
return;
|
||||
}
|
||||
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastMediaChanged,
|
||||
true,
|
||||
_strSchema,
|
||||
_strVhost,
|
||||
_strApp,
|
||||
_strId,
|
||||
*this);
|
||||
},false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user