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

For #2136: API: Cleanup no active streams for statistics. v5.0.42

This commit is contained in:
winlin 2022-08-19 19:30:12 +08:00
parent 4edf33326d
commit e9d6601f7d
7 changed files with 82 additions and 43 deletions

View file

@ -100,6 +100,10 @@ public:
SrsRtmpConnType type;
std::string id;
srs_utime_t create;
public:
// The stream total kbps.
SrsKbps* kbps;
SrsWallClock* clk;
public:
SrsStatisticClient();
virtual ~SrsStatisticClient();
@ -169,6 +173,10 @@ public:
// only got the request object, so the client specified by id maybe not
// exists in stat.
virtual void on_disconnect(std::string id);
private:
// Cleanup the stream if stream is not active and for the last client.
void cleanup_stream(SrsStatisticStream* stream);
public:
// Sample the kbps, add delta bytes of conn.
// Use kbps_sample() to get all result of kbps stat.
virtual void kbps_add_delta(std::string id, ISrsKbpsDelta* delta);