MediaPusher: 抽象精简代码

This commit is contained in:
ziyue
2021-11-09 16:46:38 +08:00
parent b96a2291eb
commit dad0c5e3cc
6 changed files with 58 additions and 70 deletions

View File

@@ -27,14 +27,6 @@ public:
void publish(const string &url) override ;
void teardown() override;
void setOnPublished(const Event &cb) override {
_on_published = cb;
}
void setOnShutdown(const Event &cb) override{
_on_shutdown = cb;
}
protected:
//for Tcpclient override
void onRecv(const Buffer::Ptr &buf) override;
@@ -48,7 +40,7 @@ protected:
}
private:
void onPublishResult(const SockException &ex, bool handshake_done);
void onPublishResult_l(const SockException &ex, bool handshake_done);
template<typename FUN>
inline void addOnResultCB(const FUN &fun) {
@@ -81,16 +73,14 @@ private:
deque<function<void(AMFValue &dec)> > _deque_on_status;
unordered_map<int, function<void(AMFDecoder &dec)> > _map_on_result;
//事件监听
Event _on_shutdown;
Event _on_published;
//推流超时定时器
std::shared_ptr<Timer> _publish_timer;
std::weak_ptr<RtmpMediaSource> _publish_src;
RtmpMediaSource::RingType::RingReader::Ptr _rtmp_reader;
};
using RtmpPusherImp = PusherImp<RtmpPusher, PusherBase>;
} /* namespace mediakit */
#endif /* SRC_RTMP_RTMPPUSHER_H_ */