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

STAT: Extract an ephemeral delta object.

This commit is contained in:
winlin 2022-08-29 13:37:27 +08:00
parent 4fe90d4885
commit db91102e67
5 changed files with 70 additions and 19 deletions

View file

@ -84,6 +84,23 @@ public:
virtual void remark(int64_t* in, int64_t* out) = 0;
};
// A delta data source for SrsKbps, used in ephemeral case, for example, UDP server to increase stat when received or
// sent out each UDP packet.
class SrsEphemeralDelta : public ISrsKbpsDelta
{
private:
uint64_t in_;
uint64_t out_;
public:
SrsEphemeralDelta();
virtual ~SrsEphemeralDelta();
public:
virtual void add_delta(int64_t in, int64_t out);
// Interface ISrsKbpsDelta.
public:
virtual void remark(int64_t* in, int64_t* out);
};
/**
* to statistic the kbps of io.
* itself can be a statistic source, for example, used for SRS bytes stat.