diff --git a/src/Pusher/MediaPusher.cpp b/src/Pusher/MediaPusher.cpp index 78475fb1..26f8de8b 100644 --- a/src/Pusher/MediaPusher.cpp +++ b/src/Pusher/MediaPusher.cpp @@ -52,11 +52,11 @@ MediaPusher::MediaPusher(const string &schema, MediaPusher::~MediaPusher() { } void MediaPusher::publish(const string &strUrl) { - _parser = PusherBase::createPusher(_poller,_src.lock(),strUrl); - _parser->setOnShutdown(_shutdownCB); - _parser->setOnPublished(_publishCB); - _parser->mINI::operator=(*this); - _parser->publish(strUrl); + _delegate = PusherBase::createPusher(_poller,_src.lock(),strUrl); + _delegate->setOnShutdown(_shutdownCB); + _delegate->setOnPublished(_publishCB); + _delegate->mINI::operator=(*this); + _delegate->publish(strUrl); } EventPoller::Ptr MediaPusher::getPoller(){ diff --git a/src/Pusher/PusherBase.h b/src/Pusher/PusherBase.h index 6fc86e5b..752f3358 100644 --- a/src/Pusher/PusherBase.h +++ b/src/Pusher/PusherBase.h @@ -75,7 +75,7 @@ public: virtual void setOnShutdown(const Event &cb) = 0; }; -template +template class PusherImp : public Parent { public: typedef std::shared_ptr Ptr; @@ -90,8 +90,8 @@ public: * @param strUrl 推流url,支持rtsp/rtmp */ void publish(const string &strUrl) override{ - if (_parser) { - _parser->publish(strUrl); + if (_delegate) { + _delegate->publish(strUrl); } } @@ -99,8 +99,8 @@ public: * 中断推流 */ void teardown() override{ - if (_parser) { - _parser->teardown(); + if (_delegate) { + _delegate->teardown(); } } @@ -109,8 +109,8 @@ public: * @param onPublished */ void setOnPublished(const PusherBase::Event &cb) override{ - if (_parser) { - _parser->setOnPublished(cb); + if (_delegate) { + _delegate->setOnPublished(cb); } _publishCB = cb; } @@ -120,15 +120,15 @@ public: * @param onShutdown */ void setOnShutdown(const PusherBase::Event &cb) override{ - if (_parser) { - _parser->setOnShutdown(cb); + if (_delegate) { + _delegate->setOnShutdown(cb); } _shutdownCB = cb; } protected: PusherBase::Event _shutdownCB; PusherBase::Event _publishCB; - std::shared_ptr _parser; + std::shared_ptr _delegate; };