1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-15 04:42:04 +00:00

STAT: Only stat media streaming clients.

This commit is contained in:
winlin 2022-08-27 18:06:26 +08:00
parent ccf83a3f68
commit 2944fe430f
2 changed files with 8 additions and 5 deletions

View file

@ -20,6 +20,7 @@ using namespace std;
#include <srs_protocol_utility.hpp>
#include <srs_app_tencentcloud.hpp>
#include <srs_kernel_kbps.hpp>
#include <srs_app_utility.hpp>
string srs_generate_stat_vid()
{
@ -496,7 +497,7 @@ void SrsStatistic::kbps_add_delta(std::string id, ISrsKbpsDelta* delta)
client->stream->vhost->kbps->add_delta(in, out);
}
SrsKbps* SrsStatistic::kbps_sample()
void SrsStatistic::kbps_sample()
{
kbps->sample();
if (true) {
@ -521,8 +522,9 @@ SrsKbps* SrsStatistic::kbps_sample()
client->kbps->sample();
}
}
return kbps;
// Update server level data.
srs_update_rtmp_server((int)clients.size(), kbps);
}
std::string SrsStatistic::server_id()

View file

@ -99,7 +99,9 @@ public:
struct SrsStatisticClient
{
public:
// For HTTP-API to kickoff this connection by expiring it.
ISrsExpire* conn;
public:
SrsStatisticStream* stream;
SrsRequest* req;
SrsRtmpConnType type;
@ -186,8 +188,7 @@ public:
// Use kbps_sample() to get all result of kbps stat.
virtual void kbps_add_delta(std::string id, ISrsKbpsDelta* delta);
// Calc the result for all kbps.
// @return the server kbps.
virtual SrsKbps* kbps_sample();
virtual void kbps_sample();
public:
// Get the server id, used to identify the server.
// For example, when restart, the server id must changed.