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-11-08 14:06:40 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
555492282098c2ed7d66df5c6817123e9b43cb28
55549228
1 parent
cf5c24af
refine librtmp tools, use srs_trace macro instead printf.
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
19 行增加
和
18 行删除
trunk/research/librtmp/srs_bandwidth_check.c
trunk/research/librtmp/srs_detect_rtmp.c
trunk/research/librtmp/srs_bandwidth_check.c
查看文件 @
5554922
...
...
@@ -62,6 +62,10 @@ int main(int argc, char** argv)
srs_primary_authors
[
0
]
=
0
;
srs_version
[
0
]
=
0
;
printf
(
"RTMP bandwidth check/test with server.
\n
"
);
printf
(
"srs(simple-rtmp-server) client librtmp library.
\n
"
);
printf
(
"version: %d.%d.%d
\n
"
,
srs_version_major
(),
srs_version_minor
(),
srs_version_revision
());
if
(
argc
<=
1
)
{
printf
(
"RTMP bandwidth check/test with server.
\n
"
"Usage: %s <rtmp_url>
\n
"
...
...
@@ -71,45 +75,40 @@ int main(int argc, char** argv)
" %s rtmp://127.0.0.1:1935/app?key=35c9b402c12a7246868752e2878f7e0e,vhost=bandcheck.srs.com>/dev/null
\n
"
"@remark, output text to stdout, while json to stderr.
\n
"
,
argv
[
0
],
argv
[
0
],
argv
[
0
]);
ret
=
1
;
exit
(
ret
);
return
ret
;
exit
(
-
1
);
}
rtmp
=
srs_rtmp_create2
(
argv
[
1
]);
printf
(
"RTMP bandwidth check/test with server.
\n
"
);
printf
(
"srs(simple-rtmp-server) client librtmp library.
\n
"
);
printf
(
"version: %d.%d.%d
\n
"
,
srs_version_major
(),
srs_version_minor
(),
srs_version_revision
());
printf
(
"bandwidth check/test url: %s
\n
"
,
argv
[
1
]);
srs_trace
(
"bandwidth check/test url: %s"
,
argv
[
1
]);
if
((
ret
=
srs_simple_handshake
(
rtmp
))
!=
0
)
{
printf
(
"simple handshake failed.
\n
"
);
srs_trace
(
"simple handshake failed.
"
);
goto
rtmp_destroy
;
}
printf
(
"simple handshake success
\n
"
);
srs_trace
(
"simple handshake success
"
);
if
((
ret
=
srs_connect_app2
(
rtmp
,
srs_server_ip
,
srs_server
,
srs_primary_authors
,
srs_version
,
&
srs_id
,
&
srs_pid
))
!=
0
)
{
printf
(
"connect vhost/app failed.
\n
"
);
srs_trace
(
"connect vhost/app failed.
"
);
goto
rtmp_destroy
;
}
printf
(
"connect vhost/app success
\n
"
);
srs_trace
(
"connect vhost/app success
"
);
if
((
ret
=
srs_bandwidth_check
(
rtmp
,
&
start_time
,
&
end_time
,
&
play_kbps
,
&
publish_kbps
,
&
play_bytes
,
&
publish_bytes
,
&
play_duration
,
&
publish_duration
))
!=
0
)
{
printf
(
"bandwidth check/test failed.
\n
"
);
srs_trace
(
"bandwidth check/test failed.
"
);
goto
rtmp_destroy
;
}
printf
(
"bandwidth check/test success
\n
"
);
srs_trace
(
"bandwidth check/test success
"
);
printf
(
"
\n
%s, %s
\n
"
srs_trace
(
"
\n
%s, %s
\n
"
"%s, %s, srs_pid=%d, srs_id=%d
\n
"
"duration: %dms(%d+%d)
\n
"
"play: %dkbps
\n
"
"publish: %dkbps
\n\n
"
,
"publish: %dkbps"
,
(
char
*
)
srs_server
,
(
char
*
)
srs_primary_authors
,
(
char
*
)
srs_server_ip
,
(
char
*
)
srs_version
,
srs_pid
,
srs_id
,
(
int
)(
end_time
-
start_time
),
play_duration
,
publish_duration
,
...
...
@@ -119,8 +118,6 @@ int main(int argc, char** argv)
rtmp_destroy:
srs_rtmp_destroy
(
rtmp
);
printf
(
"terminate with ret=%d
\n\n
"
,
ret
);
fprintf
(
stderr
,
"{
\"
code
\"
:%d,"
"
\"
srs_server
\"
:
\"
%s
\"
, "
"
\"
srs_primary_authors
\"
:
\"
%s
\"
, "
...
...
@@ -138,5 +135,9 @@ rtmp_destroy:
(
char
*
)
srs_server_ip
,
(
char
*
)
srs_version
,
srs_pid
,
srs_id
,
(
int
)(
end_time
-
start_time
),
play_duration
,
publish_duration
,
play_kbps
,
publish_kbps
);
srs_trace
(
""
);
srs_trace
(
"completed"
);
return
ret
;
}
...
...
trunk/research/librtmp/srs_detect_rtmp.c
查看文件 @
5554922
...
...
@@ -84,7 +84,7 @@ int main(int argc, char** argv)
if
(
duration
<=
0
||
timeout
<=
0
)
{
srs_trace
(
"duration and timeout must be positive."
);
exit
(
-
1
);
exit
(
-
2
);
}
rtmp
=
srs_rtmp_create
(
rtmp_url
);
...
...
请
注册
或
登录
后发表评论