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

Refine code for changing id of stat to string

This commit is contained in:
winlin 2021-01-07 17:27:30 +08:00
parent 1c41f5d796
commit d520679547
5 changed files with 7 additions and 7 deletions

View file

@ -606,7 +606,7 @@ srs_error_t SrsLiveStream::do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMess
// update the statistic when source disconveried. // update the statistic when source disconveried.
SrsStatistic* stat = SrsStatistic::instance(); SrsStatistic* stat = SrsStatistic::instance();
if ((err = stat->on_client(srs_int2str(_srs_context->get_id()), req, hc, SrsRtmpConnPlay)) != srs_success) { if ((err = stat->on_client(_srs_context->get_id(), req, hc, SrsRtmpConnPlay)) != srs_success) {
return srs_error_wrap(err, "stat on client"); return srs_error_wrap(err, "stat on client");
} }

View file

@ -205,7 +205,7 @@ srs_error_t SrsGoApiRtcPlay::do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMe
local_sdp_str = srs_string_replace(local_sdp_str.c_str(), "\r\n", "\\r\\n"); local_sdp_str = srs_string_replace(local_sdp_str.c_str(), "\r\n", "\\r\\n");
res->set("code", SrsJsonAny::integer(ERROR_SUCCESS)); res->set("code", SrsJsonAny::integer(ERROR_SUCCESS));
res->set("server", SrsJsonAny::integer(SrsStatistic::instance()->server_id())); res->set("server", SrsJsonAny::str(SrsStatistic::instance()->server_id().c_str()));
// TODO: add candidates in response json? // TODO: add candidates in response json?
@ -557,7 +557,7 @@ srs_error_t SrsGoApiRtcPublish::do_serve_http(ISrsHttpResponseWriter* w, ISrsHtt
local_sdp_str = srs_string_replace(local_sdp_str.c_str(), "\r\n", "\\r\\n"); local_sdp_str = srs_string_replace(local_sdp_str.c_str(), "\r\n", "\\r\\n");
res->set("code", SrsJsonAny::integer(ERROR_SUCCESS)); res->set("code", SrsJsonAny::integer(ERROR_SUCCESS));
res->set("server", SrsJsonAny::integer(SrsStatistic::instance()->server_id())); res->set("server", SrsJsonAny::str(SrsStatistic::instance()->server_id().c_str()));
// TODO: add candidates in response json? // TODO: add candidates in response json?

View file

@ -533,7 +533,7 @@ srs_error_t SrsRtmpConn::stream_service_cycle()
// update the statistic when source disconveried. // update the statistic when source disconveried.
SrsStatistic* stat = SrsStatistic::instance(); SrsStatistic* stat = SrsStatistic::instance();
if ((err = stat->on_client(srs_int2str(_srs_context->get_id()), req, this, info->type)) != srs_success) { if ((err = stat->on_client(_srs_context->get_id(), req, this, info->type)) != srs_success) {
return srs_error_wrap(err, "rtmp: stat client"); return srs_error_wrap(err, "rtmp: stat client");
} }

View file

@ -2527,7 +2527,7 @@ srs_error_t SrsSource::on_publish()
} }
SrsStatistic* stat = SrsStatistic::instance(); SrsStatistic* stat = SrsStatistic::instance();
stat->on_stream_publish(req, srs_int2str(_source_id)); stat->on_stream_publish(req, _source_id);
return err; return err;
} }

View file

@ -47,7 +47,7 @@ string srs_generate_id()
SrsStatisticVhost::SrsStatisticVhost() SrsStatisticVhost::SrsStatisticVhost()
{ {
id = srs_int2str(srs_generate_id()); id = srs_generate_id();
clk = new SrsWallClock(); clk = new SrsWallClock();
kbps = new SrsKbps(clk); kbps = new SrsKbps(clk);
@ -98,7 +98,7 @@ srs_error_t SrsStatisticVhost::dumps(SrsJsonObject* obj)
SrsStatisticStream::SrsStatisticStream() SrsStatisticStream::SrsStatisticStream()
{ {
id = srs_int2str(srs_generate_id()); id = srs_generate_id();
vhost = NULL; vhost = NULL;
active = false; active = false;