Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2015-08-22 11:09:11 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
1962449770f379b7b903325dc3592305e827850f
19624497
2 parents
0a4d7838
6b6d9512
Merge branch '2.0release' into develop
隐藏空白字符变更
内嵌
并排对比
正在显示
6 个修改的文件
包含
186 行增加
和
16 行删除
trunk/src/app/srs_app_http_api.cpp
trunk/src/app/srs_app_http_api.hpp
trunk/src/app/srs_app_server.cpp
trunk/src/app/srs_app_statistic.cpp
trunk/src/main/srs_main_server.cpp
trunk/src/protocol/srs_protocol_json.hpp
trunk/src/app/srs_app_http_api.cpp
查看文件 @
1962449
...
...
@@ -53,10 +53,12 @@ SrsGoApiRoot::~SrsGoApiRoot()
int
SrsGoApiRoot
::
serve_http
(
ISrsHttpResponseWriter
*
w
,
ISrsHttpMessage
*
r
)
{
SrsStatistic
*
stat
=
SrsStatistic
::
instance
();
std
::
stringstream
ss
;
ss
<<
SRS_JOBJECT_START
<<
SRS_JFIELD_ERROR
(
ERROR_SUCCESS
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"server"
,
stat
->
server_id
())
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"urls"
,
SRS_JOBJECT_START
)
<<
SRS_JFIELD_STR
(
"api"
,
"the api root"
)
<<
SRS_JOBJECT_END
...
...
@@ -75,10 +77,12 @@ SrsGoApiApi::~SrsGoApiApi()
int
SrsGoApiApi
::
serve_http
(
ISrsHttpResponseWriter
*
w
,
ISrsHttpMessage
*
r
)
{
SrsStatistic
*
stat
=
SrsStatistic
::
instance
();
std
::
stringstream
ss
;
ss
<<
SRS_JOBJECT_START
<<
SRS_JFIELD_ERROR
(
ERROR_SUCCESS
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"server"
,
stat
->
server_id
())
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"urls"
,
SRS_JOBJECT_START
)
<<
SRS_JFIELD_STR
(
"v1"
,
"the api version 1.0"
)
<<
SRS_JOBJECT_END
...
...
@@ -97,10 +101,12 @@ SrsGoApiV1::~SrsGoApiV1()
int
SrsGoApiV1
::
serve_http
(
ISrsHttpResponseWriter
*
w
,
ISrsHttpMessage
*
r
)
{
SrsStatistic
*
stat
=
SrsStatistic
::
instance
();
std
::
stringstream
ss
;
ss
<<
SRS_JOBJECT_START
<<
SRS_JFIELD_ERROR
(
ERROR_SUCCESS
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"server"
,
stat
->
server_id
())
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"urls"
,
SRS_JOBJECT_START
)
<<
SRS_JFIELD_STR
(
"versions"
,
"the version of SRS"
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_STR
(
"summaries"
,
"the summary(pid, argv, pwd, cpu, mem) of SRS"
)
<<
SRS_JFIELD_CONT
...
...
@@ -108,16 +114,17 @@ int SrsGoApiV1::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
<<
SRS_JFIELD_STR
(
"self_proc_stats"
,
"the self process stats"
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_STR
(
"system_proc_stats"
,
"the system process stats"
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_STR
(
"meminfos"
,
"the meminfo of system"
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_STR
(
"authors"
,
"the primary authors and contributors"
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_STR
(
"authors"
,
"the license, copyright, authors and contributors"
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_STR
(
"features"
,
"the supported features of SRS"
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_STR
(
"requests"
,
"the request itself, for http debug"
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_STR
(
"vhosts"
,
"dumps vhost to json"
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_STR
(
"streams"
,
"dumps streams to json"
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_STR
(
"clients"
,
"dumps clients to json"
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"test"
,
SRS_JOBJECT_START
)
<<
SRS_JFIELD_STR
(
"vhosts"
,
"manage all vhosts or specified vhost"
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_STR
(
"streams"
,
"manage all streams or specified stream"
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_STR
(
"clients"
,
"manage all clients or specified client, default query top 10 clients"
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"tests"
,
SRS_JOBJECT_START
)
<<
SRS_JFIELD_STR
(
"requests"
,
"show the request info"
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_STR
(
"errors"
,
"always return an error 100"
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_STR
(
"redirects"
,
"always redirect to /api/v1/test/errors"
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_STR
(
"
.vhost."
,
"http vhost for error.srs.com/api/v1/test
/errors"
)
<<
SRS_JFIELD_STR
(
"
[vhost]"
,
"http vhost for http://error.srs.com:1985/api/v1/tests
/errors"
)
<<
SRS_JOBJECT_END
<<
SRS_JOBJECT_END
<<
SRS_JOBJECT_END
;
...
...
@@ -135,10 +142,12 @@ SrsGoApiVersion::~SrsGoApiVersion()
int
SrsGoApiVersion
::
serve_http
(
ISrsHttpResponseWriter
*
w
,
ISrsHttpMessage
*
r
)
{
SrsStatistic
*
stat
=
SrsStatistic
::
instance
();
std
::
stringstream
ss
;
ss
<<
SRS_JOBJECT_START
<<
SRS_JFIELD_ERROR
(
ERROR_SUCCESS
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"server"
,
stat
->
server_id
())
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"data"
,
SRS_JOBJECT_START
)
<<
SRS_JFIELD_ORG
(
"major"
,
VERSION_MAJOR
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"minor"
,
VERSION_MINOR
)
<<
SRS_JFIELD_CONT
...
...
@@ -175,12 +184,14 @@ SrsGoApiRusages::~SrsGoApiRusages()
int
SrsGoApiRusages
::
serve_http
(
ISrsHttpResponseWriter
*
w
,
ISrsHttpMessage
*
req
)
{
SrsStatistic
*
stat
=
SrsStatistic
::
instance
();
std
::
stringstream
ss
;
SrsRusage
*
r
=
srs_get_system_rusage
();
ss
<<
SRS_JOBJECT_START
<<
SRS_JFIELD_ERROR
(
ERROR_SUCCESS
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"server"
,
stat
->
server_id
())
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"data"
,
SRS_JOBJECT_START
)
<<
SRS_JFIELD_ORG
(
"ok"
,
(
r
->
ok
?
"true"
:
"false"
))
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"sample_time"
,
r
->
sample_time
)
<<
SRS_JFIELD_CONT
...
...
@@ -216,12 +227,14 @@ SrsGoApiSelfProcStats::~SrsGoApiSelfProcStats()
int
SrsGoApiSelfProcStats
::
serve_http
(
ISrsHttpResponseWriter
*
w
,
ISrsHttpMessage
*
r
)
{
SrsStatistic
*
stat
=
SrsStatistic
::
instance
();
std
::
stringstream
ss
;
SrsProcSelfStat
*
u
=
srs_get_self_proc_stat
();
ss
<<
SRS_JOBJECT_START
<<
SRS_JFIELD_ERROR
(
ERROR_SUCCESS
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"server"
,
stat
->
server_id
())
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"data"
,
SRS_JOBJECT_START
)
<<
SRS_JFIELD_ORG
(
"ok"
,
(
u
->
ok
?
"true"
:
"false"
))
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"sample_time"
,
u
->
sample_time
)
<<
SRS_JFIELD_CONT
...
...
@@ -286,12 +299,14 @@ SrsGoApiSystemProcStats::~SrsGoApiSystemProcStats()
int
SrsGoApiSystemProcStats
::
serve_http
(
ISrsHttpResponseWriter
*
w
,
ISrsHttpMessage
*
r
)
{
SrsStatistic
*
stat
=
SrsStatistic
::
instance
();
std
::
stringstream
ss
;
SrsProcSystemStat
*
s
=
srs_get_system_proc_stat
();
ss
<<
SRS_JOBJECT_START
<<
SRS_JFIELD_ERROR
(
ERROR_SUCCESS
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"server"
,
stat
->
server_id
())
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"data"
,
SRS_JOBJECT_START
)
<<
SRS_JFIELD_ORG
(
"ok"
,
(
s
->
ok
?
"true"
:
"false"
))
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"sample_time"
,
s
->
sample_time
)
<<
SRS_JFIELD_CONT
...
...
@@ -321,12 +336,14 @@ SrsGoApiMemInfos::~SrsGoApiMemInfos()
int
SrsGoApiMemInfos
::
serve_http
(
ISrsHttpResponseWriter
*
w
,
ISrsHttpMessage
*
r
)
{
SrsStatistic
*
stat
=
SrsStatistic
::
instance
();
std
::
stringstream
ss
;
SrsMemInfo
*
m
=
srs_get_meminfo
();
ss
<<
SRS_JOBJECT_START
<<
SRS_JFIELD_ERROR
(
ERROR_SUCCESS
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"server"
,
stat
->
server_id
())
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"data"
,
SRS_JOBJECT_START
)
<<
SRS_JFIELD_ORG
(
"ok"
,
(
m
->
ok
?
"true"
:
"false"
))
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"sample_time"
,
m
->
sample_time
)
<<
SRS_JFIELD_CONT
...
...
@@ -357,12 +374,16 @@ SrsGoApiAuthors::~SrsGoApiAuthors()
int
SrsGoApiAuthors
::
serve_http
(
ISrsHttpResponseWriter
*
w
,
ISrsHttpMessage
*
r
)
{
SrsStatistic
*
stat
=
SrsStatistic
::
instance
();
std
::
stringstream
ss
;
ss
<<
SRS_JOBJECT_START
<<
SRS_JFIELD_ERROR
(
ERROR_SUCCESS
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"server"
,
stat
->
server_id
())
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"data"
,
SRS_JOBJECT_START
)
<<
SRS_JFIELD_STR
(
"primary"
,
RTMP_SIG_SRS_PRIMARY
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_STR
(
"license"
,
RTMP_SIG_SRS_LICENSE
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_STR
(
"copyright"
,
RTMP_SIG_SRS_COPYRIGHT
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_STR
(
"authors"
,
RTMP_SIG_SRS_AUTHROS
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_STR
(
"contributors_link"
,
RTMP_SIG_SRS_CONTRIBUTORS_URL
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_STR
(
"contributors"
,
SRS_AUTO_CONSTRIBUTORS
)
...
...
@@ -372,6 +393,132 @@ int SrsGoApiAuthors::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
return
srs_http_response_json
(
w
,
ss
.
str
());
}
SrsGoApiFeatures
::
SrsGoApiFeatures
()
{
}
SrsGoApiFeatures
::~
SrsGoApiFeatures
()
{
}
int
SrsGoApiFeatures
::
serve_http
(
ISrsHttpResponseWriter
*
w
,
ISrsHttpMessage
*
r
)
{
SrsStatistic
*
stat
=
SrsStatistic
::
instance
();
std
::
stringstream
ss
;
#ifdef SRS_AUTO_SSL
bool
ssl
=
true
;
#else
bool
ssl
=
false
;
#endif
#ifdef SRS_AUTO_HLS
bool
hls
=
true
;
#else
bool
hls
=
false
;
#endif
#ifdef SRS_AUTO_HDS
bool
hds
=
true
;
#else
bool
hds
=
false
;
#endif
#ifdef SRS_AUTO_HTTP_CALLBACK
bool
callback
=
true
;
#else
bool
callback
=
false
;
#endif
#ifdef SRS_AUTO_HTTP_API
bool
api
=
true
;
#else
bool
api
=
false
;
#endif
#ifdef SRS_AUTO_HTTP_SERVER
bool
httpd
=
true
;
#else
bool
httpd
=
false
;
#endif
#ifdef SRS_AUTO_DVR
bool
dvr
=
true
;
#else
bool
dvr
=
false
;
#endif
#ifdef SRS_AUTO_TRANSCODE
bool
transcode
=
true
;
#else
bool
transcode
=
false
;
#endif
#ifdef SRS_AUTO_INGEST
bool
ingest
=
true
;
#else
bool
ingest
=
false
;
#endif
#ifdef SRS_AUTO_STAT
bool
_stat
=
true
;
#else
bool
_stat
=
false
;
#endif
#ifdef SRS_AUTO_NGINX
bool
nginx
=
true
;
#else
bool
nginx
=
false
;
#endif
#ifdef SRS_AUTO_FFMPEG_TOOL
bool
ffmpeg
=
true
;
#else
bool
ffmpeg
=
false
;
#endif
#ifdef SRS_AUTO_STREAM_CASTER
bool
caster
=
true
;
#else
bool
caster
=
false
;
#endif
#ifdef SRS_PERF_COMPLEX_SEND
bool
complex_send
=
true
;
#else
bool
complex_send
=
false
;
#endif
#ifdef SRS_PERF_TCP_NODELAY
bool
tcp_nodelay
=
true
;
#else
bool
tcp_nodelay
=
false
;
#endif
#ifdef SRS_PERF_SO_SNDBUF_SIZE
bool
so_sendbuf
=
true
;
#else
bool
so_sendbuf
=
false
;
#endif
#ifdef SRS_PERF_MERGED_READ
bool
mr
=
true
;
#else
bool
mr
=
false
;
#endif
ss
<<
SRS_JOBJECT_START
<<
SRS_JFIELD_ERROR
(
ERROR_SUCCESS
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"server"
,
stat
->
server_id
())
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"data"
,
SRS_JOBJECT_START
)
<<
SRS_JFIELD_BOOL
(
"ssl"
,
ssl
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_BOOL
(
"hls"
,
hls
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_BOOL
(
"hds"
,
hds
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_BOOL
(
"callback"
,
callback
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_BOOL
(
"api"
,
api
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_BOOL
(
"httpd"
,
httpd
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_BOOL
(
"dvr"
,
dvr
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_BOOL
(
"transcode"
,
transcode
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_BOOL
(
"ingest"
,
ingest
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_BOOL
(
"stat"
,
_stat
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_BOOL
(
"nginx"
,
nginx
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_BOOL
(
"ffmpeg"
,
ffmpeg
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_BOOL
(
"stream_caster"
,
caster
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_BOOL
(
"complex_send"
,
complex_send
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_BOOL
(
"tcp_nodelay"
,
tcp_nodelay
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_BOOL
(
"so_sendbuf"
,
so_sendbuf
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_BOOL
(
"mr"
,
mr
)
<<
SRS_JOBJECT_END
<<
SRS_JOBJECT_END
;
return
srs_http_response_json
(
w
,
ss
.
str
());
}
SrsGoApiRequests
::
SrsGoApiRequests
()
{
}
...
...
@@ -384,10 +531,12 @@ int SrsGoApiRequests::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
{
ISrsHttpMessage
*
req
=
r
;
SrsStatistic
*
stat
=
SrsStatistic
::
instance
();
std
::
stringstream
ss
;
ss
<<
SRS_JOBJECT_START
<<
SRS_JFIELD_ERROR
(
ERROR_SUCCESS
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"server"
,
stat
->
server_id
())
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"data"
,
SRS_JOBJECT_START
)
<<
SRS_JFIELD_STR
(
"uri"
,
req
->
uri
())
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_STR
(
"path"
,
req
->
path
())
<<
SRS_JFIELD_CONT
;
...
...
trunk/src/app/srs_app_http_api.hpp
查看文件 @
1962449
...
...
@@ -132,6 +132,15 @@ public:
virtual
int
serve_http
(
ISrsHttpResponseWriter
*
w
,
ISrsHttpMessage
*
r
);
};
class
SrsGoApiFeatures
:
public
ISrsHttpHandler
{
public
:
SrsGoApiFeatures
();
virtual
~
SrsGoApiFeatures
();
public
:
virtual
int
serve_http
(
ISrsHttpResponseWriter
*
w
,
ISrsHttpMessage
*
r
);
};
class
SrsGoApiRequests
:
public
ISrsHttpHandler
{
public
:
...
...
trunk/src/app/srs_app_server.cpp
查看文件 @
1962449
...
...
@@ -800,6 +800,9 @@ int SrsServer::http_handle()
if
((
ret
=
http_api_mux
->
handle
(
"/api/v1/authors"
,
new
SrsGoApiAuthors
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
http_api_mux
->
handle
(
"/api/v1/features"
,
new
SrsGoApiFeatures
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
http_api_mux
->
handle
(
"/api/v1/vhosts/"
,
new
SrsGoApiVhosts
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
...
...
@@ -811,19 +814,19 @@ int SrsServer::http_handle()
}
// test the request info.
if
((
ret
=
http_api_mux
->
handle
(
"/api/v1/test/requests"
,
new
SrsGoApiRequests
()))
!=
ERROR_SUCCESS
)
{
if
((
ret
=
http_api_mux
->
handle
(
"/api/v1/test
s
/requests"
,
new
SrsGoApiRequests
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
// test the error code response.
if
((
ret
=
http_api_mux
->
handle
(
"/api/v1/test/errors"
,
new
SrsGoApiError
()))
!=
ERROR_SUCCESS
)
{
if
((
ret
=
http_api_mux
->
handle
(
"/api/v1/test
s
/errors"
,
new
SrsGoApiError
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
// test the redirect mechenism.
if
((
ret
=
http_api_mux
->
handle
(
"/api/v1/test
/redirects"
,
new
SrsHttpRedirectHandler
(
"/api/v1/test
/errors"
,
SRS_CONSTS_HTTP_MovedPermanently
)))
!=
ERROR_SUCCESS
)
{
if
((
ret
=
http_api_mux
->
handle
(
"/api/v1/test
s/redirects"
,
new
SrsHttpRedirectHandler
(
"/api/v1/tests
/errors"
,
SRS_CONSTS_HTTP_MovedPermanently
)))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
// test the http vhost.
if
((
ret
=
http_api_mux
->
handle
(
"error.srs.com/api/v1/test/errors"
,
new
SrsGoApiError
()))
!=
ERROR_SUCCESS
)
{
if
((
ret
=
http_api_mux
->
handle
(
"error.srs.com/api/v1/test
s
/errors"
,
new
SrsGoApiError
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
...
...
trunk/src/app/srs_app_statistic.cpp
查看文件 @
1962449
...
...
@@ -71,6 +71,10 @@ int SrsStatisticVhost::dumps(stringstream& ss)
<<
SRS_JFIELD_ORG
(
"clients"
,
nb_clients
)
<<
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"
)
<<
SRS_JFIELD_ORG
(
"r30s"
,
kbps
->
get_recv_kbps_30s
())
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"s30s"
,
kbps
->
get_send_kbps_30s
())
<<
SRS_JOBJECT_END
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_NAME
(
"hls"
)
<<
SRS_JOBJECT_START
<<
SRS_JFIELD_BOOL
(
"enabled"
,
hls_enabled
);
if
(
hls_enabled
)
{
...
...
@@ -123,6 +127,10 @@ int SrsStatisticStream::dumps(stringstream& ss)
<<
SRS_JFIELD_ORG
(
"clients"
,
nb_clients
)
<<
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"
)
<<
SRS_JFIELD_ORG
(
"r30s"
,
kbps
->
get_recv_kbps_30s
())
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"s30s"
,
kbps
->
get_send_kbps_30s
())
<<
SRS_JOBJECT_END
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"live_ms"
,
srs_get_system_time_ms
())
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_STR
(
"status"
,
status
)
<<
SRS_JFIELD_CONT
;
...
...
trunk/src/main/srs_main_server.cpp
查看文件 @
1962449
...
...
@@ -162,7 +162,7 @@ void show_macro_features()
#endif
#ifdef SRS_PERF_TCP_NODELAY
srs_warn
(
"TCP_NODELAY enabled, hurts performance."
);
srs_warn
(
"TCP_NODELAY enabled,
may
hurts performance."
);
#else
srs_trace
(
"TCP_NODELAY disabled."
);
#endif
...
...
@@ -276,8 +276,8 @@ int main(int argc, char** argv)
}
srs_trace
(
"srs(simple-rtmp-server) "
RTMP_SIG_SRS_VERSION
);
srs_trace
(
"license: "
RTMP_SIG_SRS_LICENSE
);
srs_trace
(
"primary: "
RTMP_SIG_SRS_PRIMARY
);
srs_trace
(
"license: "
RTMP_SIG_SRS_LICENSE
", "
RTMP_SIG_SRS_COPYRIGHT
);
srs_trace
(
"primary/master: "
RTMP_SIG_SRS_PRIMARY
);
srs_trace
(
"authors: "
RTMP_SIG_SRS_AUTHROS
);
srs_trace
(
"contributors: "
SRS_AUTO_CONSTRIBUTORS
);
srs_trace
(
"uname: "
SRS_AUTO_UNAME
);
...
...
trunk/src/protocol/srs_protocol_json.hpp
查看文件 @
1962449
...
...
@@ -215,10 +215,11 @@ that is:
////////////////////////////////////////////////////////////////////////
#define SRS_JOBJECT_START "{"
#define SRS_JFIELD_NAME(k) "\"" << k << "\":"
#define SRS_JFIELD_STR(k, v) "\"" << k << "\":\"" << v << "\""
#define SRS_JFIELD_ORG(k, v) "\"" << k << "\":" << std::dec << v
#define SRS_JFIELD_OBJ(k) SRS_JFIELD_NAME(k) << SRS_JOBJECT_START
#define SRS_JFIELD_STR(k, v) SRS_JFIELD_NAME(k) << "\"" << v << "\""
#define SRS_JFIELD_ORG(k, v) SRS_JFIELD_NAME(k) << std::dec << v
#define SRS_JFIELD_BOOL(k, v) SRS_JFIELD_ORG(k, (v? "true":"false"))
#define SRS_JFIELD_NULL(k)
"\"" << k << "\":
null"
#define SRS_JFIELD_NULL(k)
SRS_JFIELD_NAME(k) << "
null"
#define SRS_JFIELD_ERROR(ret) "\"" << "code" << "\":" << ret
#define SRS_JFIELD_CONT ","
#define SRS_JOBJECT_END "}"
...
...
请
注册
或
登录
后发表评论