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
2014-06-10 17:39:12 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
cccc483ab32899c0fe11fb2ec49cff715d739cfc
cccc483a
1 parent
a639eb05
add bytes statistic for librtmp
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
29 行增加
和
1 行删除
trunk/research/librtmp/srs_detect_rtmp.c
trunk/src/libs/srs_librtmp.cpp
trunk/src/libs/srs_librtmp.hpp
trunk/research/librtmp/srs_detect_rtmp.c
查看文件 @
cccc483
...
...
@@ -43,6 +43,10 @@ int main(int argc, char** argv)
int64_t
time_cleanup
=
0
;
// delay = actual - expect time when quit.
int
delay
=
0
;
// bytes
int64_t
bytes_nsend
=
0
;
int
time_duration
=
0
;
int64_t
bytes_nrecv
=
0
;
// packet data
int
type
,
size
;
...
...
@@ -145,8 +149,12 @@ int main(int argc, char** argv)
}
rtmp_destroy:
bytes_nsend
=
srs_get_nsend_bytes
(
rtmp
);
bytes_nrecv
=
srs_get_nrecv_bytes
(
rtmp
);
srs_rtmp_destroy
(
rtmp
);
time_cleanup
=
srs_get_time_ms
();
time_duration
=
(
int
)(
time_cleanup
-
time_startup
);
// print result to stderr.
fprintf
(
stderr
,
"{"
...
...
@@ -159,10 +167,12 @@ rtmp_destroy:
"
\"
%s
\"
:%d, "
// #6
"
\"
%s
\"
:%d, "
// #7
"
\"
%s
\"
:%d, "
// #8
"
\"
%s
\"
:%d, "
// #9
"
\"
%s
\"
:%d, "
// #10
"%s,%s,%s,%s}"
,
"code"
,
ret
,
//#0
// total = dns + tcp_connect + start_play + first_packet + last_packet
"total"
,
(
int
)(
time_cleanup
-
time_startup
)
,
//#1
"total"
,
time_duration
,
//#1
"dns"
,
(
int
)(
time_dns_resolve
-
time_startup
),
//#2
"tcp_connect"
,
(
int
)(
time_socket_connect
-
time_dns_resolve
),
//#3
"start_play"
,
(
int
)(
time_play_stream
-
time_socket_connect
),
//#4
...
...
@@ -173,6 +183,8 @@ rtmp_destroy:
// actual = stream
// delay = actual - expect
"delay"
,
(
int
)(
timestamp
-
(
time_cleanup
-
time_first_packet
)),
//#8
"publish_kbps"
,
(
int
)((
time_duration
<=
0
)
?
0
:
(
bytes_nsend
*
8
/
time_duration
)),
//#9
"play_kbps"
,
(
int
)((
time_duration
<=
0
)
?
0
:
(
bytes_nrecv
*
8
/
time_duration
)),
//#10
// unit in ms.
"
\"
unit
\"
:
\"
ms
\"
"
,
"
\"
remark0
\"
:
\"
total = dns + tcp_connect + start_play + first_packet + last_packet
\"
"
,
...
...
trunk/src/libs/srs_librtmp.cpp
查看文件 @
cccc483
...
...
@@ -451,6 +451,20 @@ int64_t srs_get_time_ms()
return
srs_get_system_time_ms
();
}
int64_t
srs_get_nsend_bytes
(
srs_rtmp_t
rtmp
)
{
srs_assert
(
rtmp
!=
NULL
);
Context
*
context
=
(
Context
*
)
rtmp
;
return
context
->
rtmp
->
get_send_bytes
();
}
int64_t
srs_get_nrecv_bytes
(
srs_rtmp_t
rtmp
)
{
srs_assert
(
rtmp
!=
NULL
);
Context
*
context
=
(
Context
*
)
rtmp
;
return
context
->
rtmp
->
get_recv_bytes
();
}
struct
FlvContext
{
SrsFileStream
fs
;
...
...
trunk/src/libs/srs_librtmp.hpp
查看文件 @
cccc483
...
...
@@ -157,6 +157,8 @@ int srs_version_revision();
* utilities
*/
int64_t
srs_get_time_ms
();
int64_t
srs_get_nsend_bytes
(
srs_rtmp_t
rtmp
);
int64_t
srs_get_nrecv_bytes
(
srs_rtmp_t
rtmp
);
/**
* flv codec
...
...
请
注册
或
登录
后发表评论