Commit b9294c87 by xzl

播放器统一在主线程析构

parent fd9df3f5
......@@ -21,13 +21,18 @@ namespace Player {
PlayerBase::Ptr PlayerBase::createPlayer(const char* strUrl) {
string prefix = FindField(strUrl, NULL, "://");
auto onDestory = [](PlayerBase *ptr){
EventPoller::Instance().async([ptr](){
delete ptr;
});
};
if (strcasecmp("rtsp",prefix.data()) == 0) {
return PlayerBase::Ptr(new RtspPlayerImp());
return PlayerBase::Ptr(new RtspPlayerImp(),onDestory);
}
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 */
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论