mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 04:31:37 +08:00
播放器统一在主线程析构
This commit is contained in:
parent
fd9df3f5cf
commit
b9294c87cc
@ -21,13 +21,18 @@ namespace Player {
|
|||||||
|
|
||||||
PlayerBase::Ptr PlayerBase::createPlayer(const char* strUrl) {
|
PlayerBase::Ptr PlayerBase::createPlayer(const char* strUrl) {
|
||||||
string prefix = FindField(strUrl, NULL, "://");
|
string prefix = FindField(strUrl, NULL, "://");
|
||||||
|
auto onDestory = [](PlayerBase *ptr){
|
||||||
|
EventPoller::Instance().async([ptr](){
|
||||||
|
delete ptr;
|
||||||
|
});
|
||||||
|
};
|
||||||
if (strcasecmp("rtsp",prefix.data()) == 0) {
|
if (strcasecmp("rtsp",prefix.data()) == 0) {
|
||||||
return PlayerBase::Ptr(new RtspPlayerImp());
|
return PlayerBase::Ptr(new RtspPlayerImp(),onDestory);
|
||||||
}
|
}
|
||||||
if (strcasecmp("rtmp",prefix.data()) == 0) {
|
if (strcasecmp("rtmp",prefix.data()) == 0) {
|
||||||
return PlayerBase::Ptr(new RtmpPlayerImp());
|
return PlayerBase::Ptr(new RtmpPlayerImp(),onDestory);
|
||||||
}
|
}
|
||||||
return PlayerBase::Ptr(new RtspPlayerImp());
|
return PlayerBase::Ptr(new RtspPlayerImp(),onDestory);
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace Player */
|
} /* namespace Player */
|
||||||
|
Loading…
Reference in New Issue
Block a user