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

Log: Change cid from int to string

This commit is contained in:
winlin 2020-06-18 11:45:43 +08:00
parent bca4ec1da1
commit 8a0c2e01f8
42 changed files with 301 additions and 307 deletions

View file

@ -43,7 +43,7 @@ class SrsJsonArray;
struct SrsStatisticVhost
{
public:
int64_t id;
std::string id;
std::string vhost;
int nb_streams;
int nb_clients;
@ -61,13 +61,13 @@ public:
struct SrsStatisticStream
{
public:
int64_t id;
std::string id;
SrsStatisticVhost* vhost;
std::string app;
std::string stream;
std::string url;
bool active;
int connection_cid;
std::string connection_cid;
int nb_clients;
uint64_t nb_frames;
public:
@ -101,7 +101,7 @@ public:
virtual srs_error_t dumps(SrsJsonObject* obj);
public:
// Publish the stream.
virtual void publish(int cid);
virtual void publish(std::string cid);
// Close the stream.
virtual void close();
};
@ -113,7 +113,7 @@ public:
SrsConnection* conn;
SrsRequest* req;
SrsRtmpConnType type;
int id;
std::string id;
srs_utime_t create;
public:
SrsStatisticClient();
@ -151,19 +151,19 @@ private:
int64_t _server_id;
private:
// The key: vhost id, value: vhost object.
std::map<int64_t, SrsStatisticVhost*> vhosts;
std::map<std::string, SrsStatisticVhost*> vhosts;
// The key: vhost url, value: vhost Object.
// @remark a fast index for vhosts.
std::map<std::string, SrsStatisticVhost*> rvhosts;
private:
// The key: stream id, value: stream Object.
std::map<int64_t, SrsStatisticStream*> streams;
std::map<std::string, SrsStatisticStream*> streams;
// The key: stream url, value: stream Object.
// @remark a fast index for streams.
std::map<std::string, SrsStatisticStream*> rstreams;
private:
// The key: client id, value: stream object.
std::map<int, SrsStatisticClient*> clients;
std::map<std::string, SrsStatisticClient*> clients;
// The server total kbps.
SrsKbps* kbps;
SrsWallClock* clk;
@ -179,10 +179,9 @@ private:
public:
static SrsStatistic* instance();
public:
virtual SrsStatisticVhost* find_vhost(int vid);
virtual SrsStatisticVhost* find_vhost(std::string name);
virtual SrsStatisticStream* find_stream(int sid);
virtual SrsStatisticClient* find_client(int cid);
virtual SrsStatisticVhost* find_vhost(std::string vid);
virtual SrsStatisticStream* find_stream(std::string sid);
virtual SrsStatisticClient* find_client(std::string cid);
public:
// When got video info for stream.
virtual srs_error_t on_video_info(SrsRequest* req, SrsVideoCodecId vcodec, SrsAvcProfile avc_profile,
@ -196,7 +195,7 @@ public:
// When publish stream.
// @param req the request object of publish connection.
// @param cid the cid of publish connection.
virtual void on_stream_publish(SrsRequest* req, int cid);
virtual void on_stream_publish(SrsRequest* req, std::string cid);
// When close stream.
virtual void on_stream_close(SrsRequest* req);
public:
@ -205,12 +204,12 @@ public:
// @param req, the client request object.
// @param conn, the physical absract connection object.
// @param type, the type of connection.
virtual srs_error_t on_client(int id, SrsRequest* req, SrsConnection* conn, SrsRtmpConnType type);
virtual srs_error_t on_client(std::string id, SrsRequest* req, SrsConnection* conn, SrsRtmpConnType type);
// Client disconnect
// @remark the on_disconnect always call, while the on_client is call when
// only got the request object, so the client specified by id maybe not
// exists in stat.
virtual void on_disconnect(int id);
virtual void on_disconnect(std::string id);
// Sample the kbps, add delta bytes of conn.
// Use kbps_sample() to get all result of kbps stat.
// TODO: FIXME: the add delta must use ISrsKbpsDelta interface instead.