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 13:03:10 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b37797b13ac05eef0658cbb019b50b15f194ff8a
b37797b1
1 parent
529803ed
for #442, add publish connection in stream.publish api
显示空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
20 行增加
和
15 行删除
trunk/src/app/srs_app_source.cpp
trunk/src/app/srs_app_statistic.cpp
trunk/src/app/srs_app_statistic.hpp
trunk/src/app/srs_app_source.cpp
查看文件 @
b37797b
...
...
@@ -2066,7 +2066,7 @@ int SrsSource::on_publish()
return
ret
;
}
SrsStatistic
*
stat
=
SrsStatistic
::
instance
();
stat
->
on_stream_publish
(
_req
);
stat
->
on_stream_publish
(
_req
,
_source_id
);
return
ret
;
}
...
...
trunk/src/app/srs_app_statistic.cpp
查看文件 @
b37797b
...
...
@@ -91,7 +91,8 @@ SrsStatisticStream::SrsStatisticStream()
{
id
=
srs_generate_id
();
vhost
=
NULL
;
status
=
STATISTIC_STREAM_STATUS_IDLING
;
active
=
false
;
connection_cid
=
-
1
;
has_video
=
false
;
vcodec
=
SrsCodecVideoReserved
;
...
...
@@ -124,6 +125,7 @@ int SrsStatisticStream::dumps(stringstream& ss)
<<
SRS_JFIELD_STR
(
"name"
,
stream
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"vhost"
,
vhost
->
id
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_STR
(
"app"
,
app
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"live_ms"
,
srs_get_system_time_ms
())
<<
SRS_JFIELD_CONT
<<
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
...
...
@@ -131,8 +133,10 @@ int SrsStatisticStream::dumps(stringstream& ss)
<<
SRS_JFIELD_ORG
(
"recv_30s"
,
kbps
->
get_recv_kbps_30s
())
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"send_30s"
,
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
;
<<
SRS_JFIELD_OBJ
(
"publish"
)
<<
SRS_JFIELD_BOOL
(
"active"
,
active
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"cid"
,
connection_cid
)
<<
SRS_JOBJECT_END
<<
SRS_JFIELD_CONT
;
if
(
!
has_video
)
{
ss
<<
SRS_JFIELD_NULL
(
"video"
)
<<
SRS_JFIELD_CONT
;
...
...
@@ -161,16 +165,17 @@ int SrsStatisticStream::dumps(stringstream& ss)
return
ret
;
}
void
SrsStatisticStream
::
publish
()
void
SrsStatisticStream
::
publish
(
int
cid
)
{
status
=
STATISTIC_STREAM_STATUS_PUBLISHING
;
connection_cid
=
cid
;
active
=
true
;
}
void
SrsStatisticStream
::
close
()
{
has_video
=
false
;
has_audio
=
false
;
status
=
STATISTIC_STREAM_STATUS_IDLING
;
active
=
false
;
}
SrsStatisticClient
::
SrsStatisticClient
()
...
...
@@ -301,12 +306,12 @@ int SrsStatistic::on_audio_info(SrsRequest* req,
return
ret
;
}
void
SrsStatistic
::
on_stream_publish
(
SrsRequest
*
req
)
void
SrsStatistic
::
on_stream_publish
(
SrsRequest
*
req
,
int
cid
)
{
SrsStatisticVhost
*
vhost
=
create_vhost
(
req
);
SrsStatisticStream
*
stream
=
create_stream
(
vhost
,
req
);
stream
->
publish
();
stream
->
publish
(
cid
);
}
void
SrsStatistic
::
on_stream_close
(
SrsRequest
*
req
)
...
...
trunk/src/app/srs_app_statistic.hpp
查看文件 @
b37797b
...
...
@@ -35,9 +35,6 @@ 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
;
...
...
@@ -68,7 +65,8 @@ public:
std
::
string
app
;
std
::
string
stream
;
std
::
string
url
;
std
::
string
status
;
bool
active
;
int
connection_cid
;
int
nb_clients
;
public
:
/**
...
...
@@ -103,7 +101,7 @@ public:
/**
* publish the stream.
*/
virtual
void
publish
();
virtual
void
publish
(
int
cid
);
/**
* close the stream.
*/
...
...
@@ -170,8 +168,10 @@ public:
);
/**
* when publish stream.
* @param req the request object of publish connection.
* @param cid the cid of publish connection.
*/
virtual
void
on_stream_publish
(
SrsRequest
*
req
);
virtual
void
on_stream_publish
(
SrsRequest
*
req
,
int
cid
);
/**
* when close stream.
*/
...
...
请
注册
或
登录
后发表评论