mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
for #319, support render HTTP RAW API in console.
This commit is contained in:
parent
8e635d9749
commit
555a3fbf5f
3 changed files with 15 additions and 0 deletions
|
@ -48,6 +48,7 @@ using namespace std;
|
||||||
#include <srs_core_performance.hpp>
|
#include <srs_core_performance.hpp>
|
||||||
#include <srs_kernel_file.hpp>
|
#include <srs_kernel_file.hpp>
|
||||||
#include <srs_rtmp_amf0.hpp>
|
#include <srs_rtmp_amf0.hpp>
|
||||||
|
#include <srs_app_statistic.hpp>
|
||||||
|
|
||||||
using namespace _srs_internal;
|
using namespace _srs_internal;
|
||||||
|
|
||||||
|
@ -1688,6 +1689,7 @@ int SrsConfig::global_to_json(SrsAmf0Object* obj)
|
||||||
SrsAmf0Object* sobjs = SrsAmf0Any::object();
|
SrsAmf0Object* sobjs = SrsAmf0Any::object();
|
||||||
int nb_vhosts = 0;
|
int nb_vhosts = 0;
|
||||||
|
|
||||||
|
SrsStatistic* stat = SrsStatistic::instance();
|
||||||
for (int i = 0; i < (int)root->directives.size(); i++) {
|
for (int i = 0; i < (int)root->directives.size(); i++) {
|
||||||
SrsConfDirective* dir = root->directives.at(i);
|
SrsConfDirective* dir = root->directives.at(i);
|
||||||
if (!dir->is_vhost()) {
|
if (!dir->is_vhost()) {
|
||||||
|
@ -1698,6 +1700,9 @@ int SrsConfig::global_to_json(SrsAmf0Object* obj)
|
||||||
SrsAmf0Object* sobj = SrsAmf0Any::object();
|
SrsAmf0Object* sobj = SrsAmf0Any::object();
|
||||||
sobjs->set(dir->arg0(), sobj);
|
sobjs->set(dir->arg0(), sobj);
|
||||||
|
|
||||||
|
SrsStatisticVhost* svhost = stat->find_vhost(dir->arg0());
|
||||||
|
sobj->set("id", SrsAmf0Any::number(svhost? (double)svhost->id : 0));
|
||||||
|
|
||||||
sobj->set("enabled", SrsAmf0Any::boolean(get_vhost_enabled(dir->name)));
|
sobj->set("enabled", SrsAmf0Any::boolean(get_vhost_enabled(dir->name)));
|
||||||
sobj->set("dvr", SrsAmf0Any::boolean(get_dvr_enabled(dir->name)));
|
sobj->set("dvr", SrsAmf0Any::boolean(get_dvr_enabled(dir->name)));
|
||||||
sobj->set("http_static", SrsAmf0Any::boolean(get_vhost_http_enabled(dir->name)));
|
sobj->set("http_static", SrsAmf0Any::boolean(get_vhost_http_enabled(dir->name)));
|
||||||
|
|
|
@ -275,6 +275,15 @@ SrsStatisticVhost* SrsStatistic::find_vhost(int vid)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SrsStatisticVhost* SrsStatistic::find_vhost(string name)
|
||||||
|
{
|
||||||
|
std::map<string, SrsStatisticVhost*>::iterator it;
|
||||||
|
if ((it = rvhosts.find(name)) != rvhosts.end()) {
|
||||||
|
return it->second;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
SrsStatisticStream* SrsStatistic::find_stream(int sid)
|
SrsStatisticStream* SrsStatistic::find_stream(int sid)
|
||||||
{
|
{
|
||||||
std::map<int64_t, SrsStatisticStream*>::iterator it;
|
std::map<int64_t, SrsStatisticStream*>::iterator it;
|
||||||
|
|
|
@ -156,6 +156,7 @@ public:
|
||||||
static SrsStatistic* instance();
|
static SrsStatistic* instance();
|
||||||
public:
|
public:
|
||||||
virtual SrsStatisticVhost* find_vhost(int vid);
|
virtual SrsStatisticVhost* find_vhost(int vid);
|
||||||
|
virtual SrsStatisticVhost* find_vhost(std::string name);
|
||||||
virtual SrsStatisticStream* find_stream(int sid);
|
virtual SrsStatisticStream* find_stream(int sid);
|
||||||
virtual SrsStatisticClient* find_client(int cid);
|
virtual SrsStatisticClient* find_client(int cid);
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue