winlin

add nb_streams for vhost

@@ -49,6 +49,7 @@ SrsStatisticVhost::SrsStatisticVhost() @@ -49,6 +49,7 @@ SrsStatisticVhost::SrsStatisticVhost()
49 kbps->set_io(NULL, NULL); 49 kbps->set_io(NULL, NULL);
50 50
51 nb_clients = 0; 51 nb_clients = 0;
  52 + nb_streams = 0;
52 } 53 }
53 54
54 SrsStatisticVhost::~SrsStatisticVhost() 55 SrsStatisticVhost::~SrsStatisticVhost()
@@ -69,6 +70,7 @@ int SrsStatisticVhost::dumps(stringstream& ss) @@ -69,6 +70,7 @@ int SrsStatisticVhost::dumps(stringstream& ss)
69 << SRS_JFIELD_STR("name", vhost) << SRS_JFIELD_CONT 70 << SRS_JFIELD_STR("name", vhost) << SRS_JFIELD_CONT
70 << SRS_JFIELD_BOOL("enabled", enabled) << SRS_JFIELD_CONT 71 << SRS_JFIELD_BOOL("enabled", enabled) << SRS_JFIELD_CONT
71 << SRS_JFIELD_ORG("clients", nb_clients) << SRS_JFIELD_CONT 72 << SRS_JFIELD_ORG("clients", nb_clients) << SRS_JFIELD_CONT
  73 + << SRS_JFIELD_ORG("streams", nb_streams) << SRS_JFIELD_CONT
72 << SRS_JFIELD_ORG("send_bytes", kbps->get_send_bytes()) << SRS_JFIELD_CONT 74 << SRS_JFIELD_ORG("send_bytes", kbps->get_send_bytes()) << SRS_JFIELD_CONT
73 << SRS_JFIELD_ORG("recv_bytes", kbps->get_recv_bytes()) << SRS_JFIELD_CONT 75 << SRS_JFIELD_ORG("recv_bytes", kbps->get_recv_bytes()) << SRS_JFIELD_CONT
74 << SRS_JFIELD_OBJ("kbps") 76 << SRS_JFIELD_OBJ("kbps")
@@ -169,6 +171,8 @@ void SrsStatisticStream::publish(int cid) @@ -169,6 +171,8 @@ void SrsStatisticStream::publish(int cid)
169 { 171 {
170 connection_cid = cid; 172 connection_cid = cid;
171 active = true; 173 active = true;
  174 +
  175 + vhost->nb_streams++;
172 } 176 }
173 177
174 void SrsStatisticStream::close() 178 void SrsStatisticStream::close()
@@ -176,6 +180,8 @@ void SrsStatisticStream::close() @@ -176,6 +180,8 @@ void SrsStatisticStream::close()
176 has_video = false; 180 has_video = false;
177 has_audio = false; 181 has_audio = false;
178 active = false; 182 active = false;
  183 +
  184 + vhost->nb_streams--;
179 } 185 }
180 186
181 SrsStatisticClient::SrsStatisticClient() 187 SrsStatisticClient::SrsStatisticClient()
@@ -45,6 +45,7 @@ struct SrsStatisticVhost @@ -45,6 +45,7 @@ struct SrsStatisticVhost
45 public: 45 public:
46 int64_t id; 46 int64_t id;
47 std::string vhost; 47 std::string vhost;
  48 + int nb_streams;
48 int nb_clients; 49 int nb_clients;
49 public: 50 public:
50 /** 51 /**