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-05-08 16:45:25 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7fc1cda39291de99de110482155be68459f230d4
7fc1cda3
1 parent
ac13817a
add stream status to api.
显示空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
35 行增加
和
4 行删除
trunk/auto/depends.sh
trunk/src/app/srs_app_config.cpp
trunk/src/app/srs_app_source.cpp
trunk/src/app/srs_app_statistic.cpp
trunk/src/app/srs_app_statistic.hpp
trunk/auto/depends.sh
100755 → 100644
查看文件 @
7fc1cda
...
...
@@ -572,7 +572,7 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
rm -rf research/api-server/static-dir/forward
&&
mkdir -p
`
pwd
`
/
${
SRS_OBJS
}
/nginx/html/forward
&&
ln -sf
`
pwd
`
/
${
SRS_OBJS
}
/nginx/html/forward research/api-server/static-dir/forward
ret
=
$?
;
if
[[
$ret
-ne 0
]]
;
then
echo
"
link players to cherrypy static-dir failed, ret=
$ret
"
;
exit
$ret
;
fi
ret
=
$?
;
if
[[
$ret
-ne 0
]]
;
then
echo
"
[warn] link players to cherrypy static-dir failed"
;
fi
fi
#####################################################################################
...
...
trunk/src/app/srs_app_config.cpp
查看文件 @
7fc1cda
...
...
@@ -2570,7 +2570,7 @@ bool SrsConfig::get_vhost_is_edge(SrsConfDirective* vhost)
return
SRS_CONF_DEFAULT_EDGE_MODE
;
}
return
conf
->
arg0
()
==
"remote"
;
return
"remote"
==
conf
->
arg0
()
;
}
SrsConfDirective
*
SrsConfig
::
get_vhost_edge_origin
(
string
vhost
)
...
...
trunk/src/app/srs_app_source.cpp
查看文件 @
7fc1cda
...
...
@@ -1917,7 +1917,8 @@ int SrsSource::on_publish()
srs_error
(
"handle on publish failed. ret=%d"
,
ret
);
return
ret
;
}
SrsStatistic
*
stat
=
SrsStatistic
::
instance
();
stat
->
on_stream_publish
(
_req
);
return
ret
;
}
...
...
@@ -1958,6 +1959,8 @@ void SrsSource::on_unpublish()
// notify the handler.
srs_assert
(
handler
);
SrsStatistic
*
stat
=
SrsStatistic
::
instance
();
stat
->
on_stream_close
(
_req
);
handler
->
on_unpublish
(
this
,
_req
);
}
...
...
trunk/src/app/srs_app_statistic.cpp
查看文件 @
7fc1cda
...
...
@@ -58,6 +58,7 @@ SrsStatisticStream::SrsStatisticStream()
{
id
=
srs_generate_id
();
vhost
=
NULL
;
status
=
STATISTIC_STREAM_STATUS_IDLING
;
has_video
=
false
;
vcodec
=
SrsCodecVideoReserved
;
...
...
@@ -79,10 +80,16 @@ SrsStatisticStream::~SrsStatisticStream()
srs_freep
(
kbps
);
}
void
SrsStatisticStream
::
publish
()
{
status
=
STATISTIC_STREAM_STATUS_PUBLISHING
;
}
void
SrsStatisticStream
::
close
()
{
has_video
=
false
;
has_audio
=
false
;
status
=
STATISTIC_STREAM_STATUS_IDLING
;
}
SrsStatistic
*
SrsStatistic
::
_instance
=
new
SrsStatistic
();
...
...
@@ -161,6 +168,14 @@ int SrsStatistic::on_audio_info(SrsRequest* req,
return
ret
;
}
void
SrsStatistic
::
on_stream_publish
(
SrsRequest
*
req
)
{
SrsStatisticVhost
*
vhost
=
create_vhost
(
req
);
SrsStatisticStream
*
stream
=
create_stream
(
vhost
,
req
);
stream
->
publish
();
}
void
SrsStatistic
::
on_stream_close
(
SrsRequest
*
req
)
{
SrsStatisticVhost
*
vhost
=
create_vhost
(
req
);
...
...
@@ -308,7 +323,8 @@ int SrsStatistic::dumps_streams(stringstream& ss)
<<
SRS_JFIELD_ORG
(
"clients"
,
client_num
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"send_bytes"
,
stream
->
kbps
->
get_send_bytes
())
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"recv_bytes"
,
stream
->
kbps
->
get_recv_bytes
())
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"live_ms"
,
srs_get_system_time_ms
())
<<
SRS_JFIELD_CONT
;
<<
SRS_JFIELD_ORG
(
"live_ms"
,
srs_get_system_time_ms
())
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_STR
(
"status"
,
stream
->
status
)
<<
SRS_JFIELD_CONT
;
if
(
!
stream
->
has_video
)
{
ss
<<
SRS_JFIELD_NULL
(
"video"
)
<<
SRS_JFIELD_CONT
;
...
...
trunk/src/app/srs_app_statistic.hpp
查看文件 @
7fc1cda
...
...
@@ -35,6 +35,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_kernel_codec.hpp>
#define STATISTIC_STREAM_STATUS_PUBLISHING "publishing"
#define STATISTIC_STREAM_STATUS_IDLING "idling"
class
SrsKbps
;
class
SrsRequest
;
class
SrsConnection
;
...
...
@@ -62,6 +65,7 @@ public:
std
::
string
app
;
std
::
string
stream
;
std
::
string
url
;
std
::
string
status
;
public
:
/**
* stream total kbps.
...
...
@@ -91,6 +95,10 @@ public:
virtual
~
SrsStatisticStream
();
public
:
/**
* publish the stream.
*/
virtual
void
publish
();
/**
* close the stream.
*/
virtual
void
close
();
...
...
@@ -137,6 +145,10 @@ public:
SrsAacObjectType
aac_object
);
/**
* when publish stream.
*/
virtual
void
on_stream_publish
(
SrsRequest
*
req
);
/**
* when close stream.
*/
virtual
void
on_stream_close
(
SrsRequest
*
req
);
...
...
请
注册
或
登录
后发表评论