mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
For #299, refine code.
This commit is contained in:
parent
62b7204514
commit
f32aab3d92
175 changed files with 15529 additions and 15935 deletions
|
@ -56,32 +56,32 @@ int main(int argc, char** argv)
|
|||
int duration = 0;
|
||||
int timeout = 0;
|
||||
enum srs_url_schema sus;
|
||||
|
||||
|
||||
printf("detect rtmp stream\n");
|
||||
printf("srs(ossrs) client librtmp library.\n");
|
||||
printf("version: %d.%d.%d\n", srs_version_major(), srs_version_minor(), srs_version_revision());
|
||||
|
||||
if (argc <= 3) {
|
||||
printf("detect stream on RTMP server, print result to stderr.\n"
|
||||
"Usage: %s <rtmp_url> <duration> <timeout> [url_schema]\n"
|
||||
" rtmp_url RTMP stream url to play\n"
|
||||
" duration how long to play, in seconds, stream time.\n"
|
||||
" timeout how long to timeout, in seconds, system time.\n"
|
||||
" url_schema the schema of url, default to vis, can be:\n"
|
||||
" normal: rtmp://vhost:port/app/stream\n"
|
||||
" via : rtmp://ip:port/vhost/app/stream\n"
|
||||
" vis : rtmp://ip:port/app/stream?vhost=xxx\n"
|
||||
" vis2 : rtmp://ip:port/app/stream?domain=xxx\n"
|
||||
"For example:\n"
|
||||
" %s rtmp://127.0.0.1:1935/bravo.chnvideo.com/live/livestream 3 10\n",
|
||||
argv[0], argv[0]);
|
||||
"Usage: %s <rtmp_url> <duration> <timeout> [url_schema]\n"
|
||||
" rtmp_url RTMP stream url to play\n"
|
||||
" duration how long to play, in seconds, stream time.\n"
|
||||
" timeout how long to timeout, in seconds, system time.\n"
|
||||
" url_schema the schema of url, default to vis, can be:\n"
|
||||
" normal: rtmp://vhost:port/app/stream\n"
|
||||
" via : rtmp://ip:port/vhost/app/stream\n"
|
||||
" vis : rtmp://ip:port/app/stream?vhost=xxx\n"
|
||||
" vis2 : rtmp://ip:port/app/stream?domain=xxx\n"
|
||||
"For example:\n"
|
||||
" %s rtmp://127.0.0.1:1935/bravo.chnvideo.com/live/livestream 3 10\n",
|
||||
argv[0], argv[0]);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
rtmp_url = argv[1];
|
||||
duration = atoi(argv[2]);
|
||||
timeout = atoi(argv[3]);
|
||||
|
||||
|
||||
if (1) {
|
||||
char *p = "vis";
|
||||
if (argc > 4) {
|
||||
|
@ -102,7 +102,7 @@ int main(int argc, char** argv)
|
|||
}
|
||||
srs_human_trace("url schema: %s", p);
|
||||
}
|
||||
|
||||
|
||||
srs_human_trace("rtmp url: %s", rtmp_url);
|
||||
srs_human_trace("duration: %ds, timeout:%ds", duration, timeout);
|
||||
|
||||
|
@ -145,7 +145,7 @@ int main(int argc, char** argv)
|
|||
srs_human_trace("set url schema=%d failed, ret=%d", sus, ret);
|
||||
goto rtmp_destroy;
|
||||
}
|
||||
|
||||
|
||||
if ((ret = srs_rtmp_connect_app(rtmp)) != 0) {
|
||||
srs_human_trace("connect vhost/app failed. ret=%d", ret);
|
||||
goto rtmp_destroy;
|
||||
|
@ -164,8 +164,7 @@ int main(int argc, char** argv)
|
|||
srs_human_trace("read packet failed. ret=%d", ret);
|
||||
goto rtmp_destroy;
|
||||
}
|
||||
srs_human_trace("got packet: type=%s, time=%d, size=%d",
|
||||
srs_human_flv_tag_type2string(type), timestamp, size);
|
||||
srs_human_trace("got packet: type=%s, time=%d, size=%d", srs_human_flv_tag_type2string(type), timestamp, size);
|
||||
|
||||
if (SRS_RTMP_TYPE_VIDEO == type || SRS_RTMP_TYPE_AUDIO == type) {
|
||||
if (time_first_packet <= 0) {
|
||||
|
@ -231,7 +230,7 @@ rtmp_destroy:
|
|||
"\"remark0\": \"total = dns + tcp_connect + start_play + first_packet + last_packet\"",
|
||||
"\"remark1\": \"delay = stream - (time_cleanup - time_first_packet)\"",
|
||||
"\"remark2\": \"if code is not 0, user must ignore all data\""
|
||||
);
|
||||
);
|
||||
|
||||
srs_human_trace(" ");
|
||||
srs_human_trace("completed");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue