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:
PioLing
2025-05-02 16:23:25 +08:00
committed by GitHub
parent ab14adb94d
commit 7b1f8fedac
35 changed files with 325 additions and 19 deletions

View File

@@ -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;

View File

@@ -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) {