From baa70d4ddd610943fe47a8bb390b7b28fbb980e2 Mon Sep 17 00:00:00 2001 From: winlin Date: Sat, 22 Aug 2015 22:51:59 +0800 Subject: [PATCH] add nb_streams for vhost --- trunk/src/app/srs_app_statistic.cpp | 6 ++++++ trunk/src/app/srs_app_statistic.hpp | 1 + 2 files changed, 7 insertions(+) mode change 100755 => 100644 trunk/src/app/srs_app_statistic.cpp mode change 100755 => 100644 trunk/src/app/srs_app_statistic.hpp diff --git a/trunk/src/app/srs_app_statistic.cpp b/trunk/src/app/srs_app_statistic.cpp old mode 100755 new mode 100644 index 2d375b067..583a85d09 --- a/trunk/src/app/srs_app_statistic.cpp +++ b/trunk/src/app/srs_app_statistic.cpp @@ -49,6 +49,7 @@ SrsStatisticVhost::SrsStatisticVhost() kbps->set_io(NULL, NULL); nb_clients = 0; + nb_streams = 0; } SrsStatisticVhost::~SrsStatisticVhost() @@ -69,6 +70,7 @@ int SrsStatisticVhost::dumps(stringstream& ss) << SRS_JFIELD_STR("name", vhost) << SRS_JFIELD_CONT << SRS_JFIELD_BOOL("enabled", enabled) << SRS_JFIELD_CONT << SRS_JFIELD_ORG("clients", nb_clients) << SRS_JFIELD_CONT + << SRS_JFIELD_ORG("streams", nb_streams) << SRS_JFIELD_CONT << SRS_JFIELD_ORG("send_bytes", kbps->get_send_bytes()) << SRS_JFIELD_CONT << SRS_JFIELD_ORG("recv_bytes", kbps->get_recv_bytes()) << SRS_JFIELD_CONT << SRS_JFIELD_OBJ("kbps") @@ -169,6 +171,8 @@ void SrsStatisticStream::publish(int cid) { connection_cid = cid; active = true; + + vhost->nb_streams++; } void SrsStatisticStream::close() @@ -176,6 +180,8 @@ void SrsStatisticStream::close() has_video = false; has_audio = false; active = false; + + vhost->nb_streams--; } SrsStatisticClient::SrsStatisticClient() diff --git a/trunk/src/app/srs_app_statistic.hpp b/trunk/src/app/srs_app_statistic.hpp old mode 100755 new mode 100644 index 9505ed497..175aceb10 --- a/trunk/src/app/srs_app_statistic.hpp +++ b/trunk/src/app/srs_app_statistic.hpp @@ -45,6 +45,7 @@ struct SrsStatisticVhost public: int64_t id; std::string vhost; + int nb_streams; int nb_clients; public: /**