mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-07-01 23:57:37 +08:00
Add network traffic statistics (#4239)
Co-authored-by: xiongguangjie <xiong_panda@163.com> Co-authored-by: xia-chu <771730766@qq.com>
This commit is contained in:
@@ -35,6 +35,7 @@ public:
|
||||
void setOnCreateSocket(toolkit::Socket::onCreateSocket cb);
|
||||
std::shared_ptr<MediaSource> getSrc() { return _src.lock(); }
|
||||
const std::string& getUrl() const { return _url; }
|
||||
|
||||
private:
|
||||
std::weak_ptr<MediaSource> _src;
|
||||
toolkit::EventPoller::Ptr _poller;
|
||||
|
||||
@@ -67,6 +67,9 @@ public:
|
||||
*/
|
||||
virtual void setOnShutdown(const Event &cb) = 0;
|
||||
|
||||
virtual size_t getSendSpeed() { return 0; }
|
||||
virtual size_t getSendTotalBytes() { return 0; }
|
||||
|
||||
protected:
|
||||
virtual void onShutdown(const toolkit::SockException &ex) = 0;
|
||||
virtual void onPublishResult(const toolkit::SockException &ex) = 0;
|
||||
@@ -133,6 +136,14 @@ public:
|
||||
_on_shutdown = cb;
|
||||
}
|
||||
|
||||
size_t getSendSpeed() override {
|
||||
return _delegate ? _delegate->getSendSpeed() : Parent::getSendSpeed();
|
||||
}
|
||||
|
||||
size_t getSendTotalBytes() override {
|
||||
return _delegate ? _delegate->getSendTotalBytes() : Parent::getSendTotalBytes();
|
||||
}
|
||||
|
||||
protected:
|
||||
void onShutdown(const toolkit::SockException &ex) override {
|
||||
if (_on_shutdown) {
|
||||
|
||||
Reference in New Issue
Block a user