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

fix #316, http api provides stream/vhost/srs/server bytes, codec and count. 2.0.136

This commit is contained in:
winlin 2015-03-08 19:59:10 +08:00
parent 2e9f2753c9
commit 5143e3a58d
17 changed files with 191 additions and 57 deletions

View file

@ -35,13 +35,20 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_kernel_codec.hpp>
class SrsKbps;
class SrsRequest;
class SrsConnection;
struct SrsStatisticVhost
{
public:
int64_t id;
std::string vhost;
public:
/**
* vhost total kbps.
*/
SrsKbps* kbps;
public:
SrsStatisticVhost();
virtual ~SrsStatisticVhost();
@ -55,6 +62,11 @@ public:
std::string app;
std::string stream;
std::string url;
public:
/**
* stream total kbps.
*/
SrsKbps* kbps;
public:
bool has_video;
SrsCodecVideo vcodec;
@ -103,6 +115,8 @@ private:
std::map<std::string, SrsStatisticStream*> streams;
// key: client id, value: stream object.
std::map<int, SrsStatisticClient*> clients;
// server total kbps.
SrsKbps* kbps;
private:
SrsStatistic();
virtual ~SrsStatistic();
@ -137,6 +151,16 @@ public:
* client disconnect
*/
virtual void on_disconnect(int id);
/**
* sample the kbps, add delta bytes of conn.
* use kbps_sample() to get all result of kbps stat.
*/
virtual void kbps_add_delta(SrsConnection* conn);
/**
* calc the result for all kbps.
* @return the server kbps.
*/
virtual SrsKbps* kbps_sample();
public:
/**
* get the server id, used to identify the server.