支持客户端自定义设置EventPoller对象,提高线程安全性

This commit is contained in:
xiongziliang
2019-04-01 10:16:15 +08:00
parent 6e2002e451
commit 9247cb9571
20 changed files with 70 additions and 57 deletions

View File

@@ -35,7 +35,8 @@ using namespace mediakit::Client;
namespace mediakit {
PusherBase::Ptr PusherBase::createPusher(const MediaSource::Ptr &src,
PusherBase::Ptr PusherBase::createPusher(const EventPoller::Ptr &poller,
const MediaSource::Ptr &src,
const string & strUrl) {
static auto releasePusher = [](PusherBase *ptr){
onceToken token(nullptr,[&](){
@@ -45,12 +46,12 @@ PusherBase::Ptr PusherBase::createPusher(const MediaSource::Ptr &src,
};
string prefix = FindField(strUrl.data(), NULL, "://");
if (strcasecmp("rtsp",prefix.data()) == 0) {
return PusherBase::Ptr(new RtspPusher(dynamic_pointer_cast<RtspMediaSource>(src)),releasePusher);
return PusherBase::Ptr(new RtspPusher(poller,dynamic_pointer_cast<RtspMediaSource>(src)),releasePusher);
}
if (strcasecmp("rtmp",prefix.data()) == 0) {
return PusherBase::Ptr(new RtmpPusher(dynamic_pointer_cast<RtmpMediaSource>(src)),releasePusher);
return PusherBase::Ptr(new RtmpPusher(poller,dynamic_pointer_cast<RtmpMediaSource>(src)),releasePusher);
}
return PusherBase::Ptr(new RtspPusher(dynamic_pointer_cast<RtspMediaSource>(src)),releasePusher);
return PusherBase::Ptr(new RtspPusher(poller,dynamic_pointer_cast<RtspMediaSource>(src)),releasePusher);
}
PusherBase::PusherBase() {