1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Refine kbps more testable

This commit is contained in:
winlin 2018-12-23 20:30:12 +08:00
parent 16fa4c588a
commit 4c40370986
9 changed files with 144 additions and 14 deletions

View file

@ -126,6 +126,21 @@ public:
virtual void cleanup() = 0;
};
/**
* A time source to provide wall clock.
*/
class SrsWallClock
{
public:
SrsWallClock();
virtual ~SrsWallClock();
public:
/**
* Current time in ms.
*/
virtual int64_t time_ms();
};
/**
* to statistic the kbps of io.
* itself can be a statistic source, for example, used for SRS bytes stat.
@ -167,8 +182,10 @@ class SrsKbps : virtual public ISrsProtocolStatistic, virtual public IKbpsDelta
private:
SrsKbpsSlice is;
SrsKbpsSlice os;
SrsWallClock* clock;
public:
SrsKbps();
// We will free the clock c.
SrsKbps(SrsWallClock* c);
virtual ~SrsKbps();
public:
/**