winlin

remove src/main/srs_main_bandcheck.cpp, and --with-bwtc(use librtmp instead). 0.9.159

@@ -24,8 +24,6 @@ SRS_HTTP_CALLBACK=RESERVED @@ -24,8 +24,6 @@ SRS_HTTP_CALLBACK=RESERVED
24 SRS_HTTP_SERVER=RESERVED 24 SRS_HTTP_SERVER=RESERVED
25 SRS_HTTP_API=RESERVED 25 SRS_HTTP_API=RESERVED
26 SRS_LIBRTMP=RESERVED 26 SRS_LIBRTMP=RESERVED
27 -# srs-bandwidth-test client  
28 -SRS_BWTC=RESERVED  
29 SRS_RESEARCH=RESERVED 27 SRS_RESEARCH=RESERVED
30 SRS_UTEST=RESERVED 28 SRS_UTEST=RESERVED
31 # tcmalloc 29 # tcmalloc
@@ -195,7 +193,6 @@ function parse_user_option() { @@ -195,7 +193,6 @@ function parse_user_option() {
195 --with-http-server) SRS_HTTP_SERVER=YES ;; 193 --with-http-server) SRS_HTTP_SERVER=YES ;;
196 --with-http-api) SRS_HTTP_API=YES ;; 194 --with-http-api) SRS_HTTP_API=YES ;;
197 --with-librtmp) SRS_LIBRTMP=YES ;; 195 --with-librtmp) SRS_LIBRTMP=YES ;;
198 - --with-bwtc) SRS_BWTC=YES ;;  
199 --with-research) SRS_RESEARCH=YES ;; 196 --with-research) SRS_RESEARCH=YES ;;
200 --with-utest) SRS_UTEST=YES ;; 197 --with-utest) SRS_UTEST=YES ;;
201 --with-gperf) SRS_GPERF=YES ;; 198 --with-gperf) SRS_GPERF=YES ;;
@@ -217,7 +214,6 @@ function parse_user_option() { @@ -217,7 +214,6 @@ function parse_user_option() {
217 --without-http-server) SRS_HTTP_SERVER=NO ;; 214 --without-http-server) SRS_HTTP_SERVER=NO ;;
218 --without-http-api) SRS_HTTP_API=NO ;; 215 --without-http-api) SRS_HTTP_API=NO ;;
219 --without-librtmp) SRS_LIBRTMP=NO ;; 216 --without-librtmp) SRS_LIBRTMP=NO ;;
220 - --without-bwtc) SRS_BWTC=NO ;;  
221 --without-research) SRS_RESEARCH=NO ;; 217 --without-research) SRS_RESEARCH=NO ;;
222 --without-utest) SRS_UTEST=NO ;; 218 --without-utest) SRS_UTEST=NO ;;
223 --without-gperf) SRS_GPERF=NO ;; 219 --without-gperf) SRS_GPERF=NO ;;
@@ -334,7 +330,6 @@ function apply_user_presets() { @@ -334,7 +330,6 @@ function apply_user_presets() {
334 SRS_HTTP_SERVER=NO 330 SRS_HTTP_SERVER=NO
335 SRS_HTTP_API=NO 331 SRS_HTTP_API=NO
336 SRS_LIBRTMP=NO 332 SRS_LIBRTMP=NO
337 - SRS_BWTC=NO  
338 SRS_RESEARCH=NO 333 SRS_RESEARCH=NO
339 SRS_UTEST=NO 334 SRS_UTEST=NO
340 SRS_GPERF=NO 335 SRS_GPERF=NO
@@ -359,7 +354,6 @@ function apply_user_presets() { @@ -359,7 +354,6 @@ function apply_user_presets() {
359 SRS_HTTP_SERVER=YES 354 SRS_HTTP_SERVER=YES
360 SRS_HTTP_API=YES 355 SRS_HTTP_API=YES
361 SRS_LIBRTMP=YES 356 SRS_LIBRTMP=YES
362 - SRS_BWTC=YES  
363 SRS_RESEARCH=YES 357 SRS_RESEARCH=YES
364 SRS_UTEST=YES 358 SRS_UTEST=YES
365 SRS_GPERF=NO 359 SRS_GPERF=NO
@@ -384,7 +378,6 @@ function apply_user_presets() { @@ -384,7 +378,6 @@ function apply_user_presets() {
384 SRS_HTTP_SERVER=NO 378 SRS_HTTP_SERVER=NO
385 SRS_HTTP_API=NO 379 SRS_HTTP_API=NO
386 SRS_LIBRTMP=NO 380 SRS_LIBRTMP=NO
387 - SRS_BWTC=NO  
388 SRS_RESEARCH=NO 381 SRS_RESEARCH=NO
389 SRS_UTEST=NO 382 SRS_UTEST=NO
390 SRS_GPERF=NO 383 SRS_GPERF=NO
@@ -409,7 +402,6 @@ function apply_user_presets() { @@ -409,7 +402,6 @@ function apply_user_presets() {
409 SRS_HTTP_SERVER=NO 402 SRS_HTTP_SERVER=NO
410 SRS_HTTP_API=NO 403 SRS_HTTP_API=NO
411 SRS_LIBRTMP=NO 404 SRS_LIBRTMP=NO
412 - SRS_BWTC=NO  
413 SRS_RESEARCH=NO 405 SRS_RESEARCH=NO
414 SRS_UTEST=NO 406 SRS_UTEST=NO
415 SRS_GPERF=NO 407 SRS_GPERF=NO
@@ -434,7 +426,6 @@ function apply_user_presets() { @@ -434,7 +426,6 @@ function apply_user_presets() {
434 SRS_HTTP_SERVER=NO 426 SRS_HTTP_SERVER=NO
435 SRS_HTTP_API=NO 427 SRS_HTTP_API=NO
436 SRS_LIBRTMP=NO 428 SRS_LIBRTMP=NO
437 - SRS_BWTC=NO  
438 SRS_RESEARCH=NO 429 SRS_RESEARCH=NO
439 SRS_UTEST=NO 430 SRS_UTEST=NO
440 SRS_GPERF=NO 431 SRS_GPERF=NO
@@ -459,7 +450,6 @@ function apply_user_presets() { @@ -459,7 +450,6 @@ function apply_user_presets() {
459 SRS_HTTP_SERVER=YES 450 SRS_HTTP_SERVER=YES
460 SRS_HTTP_API=YES 451 SRS_HTTP_API=YES
461 SRS_LIBRTMP=YES 452 SRS_LIBRTMP=YES
462 - SRS_BWTC=NO  
463 SRS_RESEARCH=NO 453 SRS_RESEARCH=NO
464 SRS_UTEST=NO 454 SRS_UTEST=NO
465 SRS_GPERF=NO 455 SRS_GPERF=NO
@@ -485,7 +475,6 @@ function apply_user_presets() { @@ -485,7 +475,6 @@ function apply_user_presets() {
485 SRS_HTTP_SERVER=YES 475 SRS_HTTP_SERVER=YES
486 SRS_HTTP_API=YES 476 SRS_HTTP_API=YES
487 SRS_LIBRTMP=YES 477 SRS_LIBRTMP=YES
488 - SRS_BWTC=NO  
489 SRS_RESEARCH=NO 478 SRS_RESEARCH=NO
490 SRS_UTEST=NO 479 SRS_UTEST=NO
491 SRS_GPERF=NO 480 SRS_GPERF=NO
@@ -510,7 +499,6 @@ function apply_user_presets() { @@ -510,7 +499,6 @@ function apply_user_presets() {
510 SRS_HTTP_SERVER=YES 499 SRS_HTTP_SERVER=YES
511 SRS_HTTP_API=YES 500 SRS_HTTP_API=YES
512 SRS_LIBRTMP=YES 501 SRS_LIBRTMP=YES
513 - SRS_BWTC=YES  
514 SRS_RESEARCH=NO 502 SRS_RESEARCH=NO
515 SRS_UTEST=YES 503 SRS_UTEST=YES
516 SRS_GPERF=NO 504 SRS_GPERF=NO
@@ -535,7 +523,6 @@ function apply_user_presets() { @@ -535,7 +523,6 @@ function apply_user_presets() {
535 SRS_HTTP_SERVER=YES 523 SRS_HTTP_SERVER=YES
536 SRS_HTTP_API=YES 524 SRS_HTTP_API=YES
537 SRS_LIBRTMP=YES 525 SRS_LIBRTMP=YES
538 - SRS_BWTC=YES  
539 SRS_RESEARCH=YES 526 SRS_RESEARCH=YES
540 SRS_UTEST=YES 527 SRS_UTEST=YES
541 SRS_GPERF=NO 528 SRS_GPERF=NO
@@ -560,7 +547,6 @@ function apply_user_presets() { @@ -560,7 +547,6 @@ function apply_user_presets() {
560 SRS_HTTP_SERVER=YES 547 SRS_HTTP_SERVER=YES
561 SRS_HTTP_API=YES 548 SRS_HTTP_API=YES
562 SRS_LIBRTMP=NO 549 SRS_LIBRTMP=NO
563 - SRS_BWTC=NO  
564 SRS_RESEARCH=NO 550 SRS_RESEARCH=NO
565 SRS_UTEST=NO 551 SRS_UTEST=NO
566 SRS_GPERF=NO 552 SRS_GPERF=NO
@@ -585,7 +571,6 @@ function apply_user_presets() { @@ -585,7 +571,6 @@ function apply_user_presets() {
585 SRS_HTTP_SERVER=YES 571 SRS_HTTP_SERVER=YES
586 SRS_HTTP_API=YES 572 SRS_HTTP_API=YES
587 SRS_LIBRTMP=YES 573 SRS_LIBRTMP=YES
588 - SRS_BWTC=YES  
589 SRS_RESEARCH=NO 574 SRS_RESEARCH=NO
590 SRS_UTEST=YES 575 SRS_UTEST=YES
591 SRS_GPERF=NO 576 SRS_GPERF=NO
@@ -610,7 +595,6 @@ function apply_user_presets() { @@ -610,7 +595,6 @@ function apply_user_presets() {
610 SRS_HTTP_SERVER=YES 595 SRS_HTTP_SERVER=YES
611 SRS_HTTP_API=YES 596 SRS_HTTP_API=YES
612 SRS_LIBRTMP=YES 597 SRS_LIBRTMP=YES
613 - SRS_BWTC=NO  
614 SRS_RESEARCH=NO 598 SRS_RESEARCH=NO
615 SRS_UTEST=NO 599 SRS_UTEST=NO
616 SRS_GPERF=NO 600 SRS_GPERF=NO
@@ -635,7 +619,6 @@ function apply_user_presets() { @@ -635,7 +619,6 @@ function apply_user_presets() {
635 SRS_HTTP_SERVER=YES 619 SRS_HTTP_SERVER=YES
636 SRS_HTTP_API=YES 620 SRS_HTTP_API=YES
637 SRS_LIBRTMP=YES 621 SRS_LIBRTMP=YES
638 - SRS_BWTC=NO  
639 SRS_RESEARCH=NO 622 SRS_RESEARCH=NO
640 SRS_UTEST=NO 623 SRS_UTEST=NO
641 SRS_GPERF=NO 624 SRS_GPERF=NO
@@ -694,7 +677,6 @@ function regenerate_options() { @@ -694,7 +677,6 @@ function regenerate_options() {
694 if [ $SRS_HTTP_SERVER = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-http-server"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-http-server"; fi 677 if [ $SRS_HTTP_SERVER = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-http-server"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-http-server"; fi
695 if [ $SRS_HTTP_API = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-http-api"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-http-api"; fi 678 if [ $SRS_HTTP_API = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-http-api"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-http-api"; fi
696 if [ $SRS_LIBRTMP = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-librtmp"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-librtmp"; fi 679 if [ $SRS_LIBRTMP = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-librtmp"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-librtmp"; fi
697 - if [ $SRS_BWTC = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-bwtc"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-bwtc"; fi  
698 if [ $SRS_RESEARCH = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-research"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-research"; fi 680 if [ $SRS_RESEARCH = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-research"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-research"; fi
699 if [ $SRS_UTEST = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-utest"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-utest"; fi 681 if [ $SRS_UTEST = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-utest"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-utest"; fi
700 if [ $SRS_GPERF = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gperf"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gperf"; fi 682 if [ $SRS_GPERF = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gperf"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gperf"; fi
@@ -741,7 +723,6 @@ function check_option_conflicts() { @@ -741,7 +723,6 @@ function check_option_conflicts() {
741 # user should disable all other features 723 # user should disable all other features
742 if [ $SRS_EMBEDED_CPU = YES ]; then 724 if [ $SRS_EMBEDED_CPU = YES ]; then
743 if [ $SRS_FFMPEG_TOOL = YES ]; then echo "ffmpeg for arm is not available, see: ./configure --help"; __check_ok=NO; fi 725 if [ $SRS_FFMPEG_TOOL = YES ]; then echo "ffmpeg for arm is not available, see: ./configure --help"; __check_ok=NO; fi
744 - if [ $SRS_BWTC = YES ]; then echo "bwtc for arm is not available, see: ./configure --help"; __check_ok=NO; fi  
745 if [ $SRS_RESEARCH = YES ]; then echo "research for arm is not available, see: ./configure --help"; __check_ok=NO; fi 726 if [ $SRS_RESEARCH = YES ]; then echo "research for arm is not available, see: ./configure --help"; __check_ok=NO; fi
746 if [ $SRS_GPERF = YES ]; then echo "gperf for arm is not available, see: ./configure --help"; __check_ok=NO; fi 727 if [ $SRS_GPERF = YES ]; then echo "gperf for arm is not available, see: ./configure --help"; __check_ok=NO; fi
747 if [ $SRS_GPERF_MC = YES ]; then echo "gmc for arm is not available, see: ./configure --help"; __check_ok=NO; fi 728 if [ $SRS_GPERF_MC = YES ]; then echo "gmc for arm is not available, see: ./configure --help"; __check_ok=NO; fi
@@ -767,7 +748,6 @@ function check_option_conflicts() { @@ -767,7 +748,6 @@ function check_option_conflicts() {
767 if [ $SRS_HTTP_SERVER = RESERVED ]; then echo "you must specifies the http-server, see: ./configure --help"; __check_ok=NO; fi 748 if [ $SRS_HTTP_SERVER = RESERVED ]; then echo "you must specifies the http-server, see: ./configure --help"; __check_ok=NO; fi
768 if [ $SRS_HTTP_API = RESERVED ]; then echo "you must specifies the http-api, see: ./configure --help"; __check_ok=NO; fi 749 if [ $SRS_HTTP_API = RESERVED ]; then echo "you must specifies the http-api, see: ./configure --help"; __check_ok=NO; fi
769 if [ $SRS_LIBRTMP = RESERVED ]; then echo "you must specifies the librtmp, see: ./configure --help"; __check_ok=NO; fi 750 if [ $SRS_LIBRTMP = RESERVED ]; then echo "you must specifies the librtmp, see: ./configure --help"; __check_ok=NO; fi
770 - if [ $SRS_BWTC = RESERVED ]; then echo "you must specifies the bwtc, see: ./configure --help"; __check_ok=NO; fi  
771 if [ $SRS_RESEARCH = RESERVED ]; then echo "you must specifies the research, see: ./configure --help"; __check_ok=NO; fi 751 if [ $SRS_RESEARCH = RESERVED ]; then echo "you must specifies the research, see: ./configure --help"; __check_ok=NO; fi
772 if [ $SRS_UTEST = RESERVED ]; then echo "you must specifies the utest, see: ./configure --help"; __check_ok=NO; fi 752 if [ $SRS_UTEST = RESERVED ]; then echo "you must specifies the utest, see: ./configure --help"; __check_ok=NO; fi
773 if [ $SRS_GPERF = RESERVED ]; then echo "you must specifies the gperf, see: ./configure --help"; __check_ok=NO; fi 753 if [ $SRS_GPERF = RESERVED ]; then echo "you must specifies the gperf, see: ./configure --help"; __check_ok=NO; fi
@@ -115,7 +115,6 @@ SrsHttpServerSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_SERVER = YES ] @@ -115,7 +115,6 @@ SrsHttpServerSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_SERVER = YES ]
115 SrsHttpApiSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_API = YES ]; then SrsHttpApiSummaryColor="\${GREEN}"; fi 115 SrsHttpApiSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_API = YES ]; then SrsHttpApiSummaryColor="\${GREEN}"; fi
116 SrsLibrtmpSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_LIBRTMP = YES ]; then SrsLibrtmpSummaryColor="\${GREEN}"; fi 116 SrsLibrtmpSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_LIBRTMP = YES ]; then SrsLibrtmpSummaryColor="\${GREEN}"; fi
117 SrsLibrtmpSSLSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_LIBRTMP = YES ]; then if [ $SRS_SSL = YES ]; then SrsLibrtmpSSLSummaryColor="\${GREEN}"; fi fi 117 SrsLibrtmpSSLSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_LIBRTMP = YES ]; then if [ $SRS_SSL = YES ]; then SrsLibrtmpSSLSummaryColor="\${GREEN}"; fi fi
118 -SrsBWTCSummaryColor="\${GREEN}{disabled} "; if [ $SRS_BWTC = YES ]; then SrsBWTCSummaryColor="\${GREEN}"; fi  
119 SrsResearchSummaryColor="\${GREEN}{disabled} "; if [ $SRS_RESEARCH = YES ]; then SrsResearchSummaryColor="\${GREEN}"; fi 118 SrsResearchSummaryColor="\${GREEN}{disabled} "; if [ $SRS_RESEARCH = YES ]; then SrsResearchSummaryColor="\${GREEN}"; fi
120 SrsUtestSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_UTEST = YES ]; then SrsUtestSummaryColor="\${GREEN}"; fi 119 SrsUtestSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_UTEST = YES ]; then SrsUtestSummaryColor="\${GREEN}"; fi
121 SrsGperfSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPERF = YES ]; then SrsGperfSummaryColor="\${GREEN}"; fi 120 SrsGperfSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPERF = YES ]; then SrsGperfSummaryColor="\${GREEN}"; fi
@@ -159,8 +158,6 @@ echo -e " | ${SrsGprofSummaryColor}gprof -b ./objs/srs gmon.out > gprof. @@ -159,8 +158,6 @@ echo -e " | ${SrsGprofSummaryColor}gprof -b ./objs/srs gmon.out > gprof.
159 echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}" 158 echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
160 echo -e " |${SrsResearchSummaryColor}research: ./objs/research, api server, players, ts info, librtmp.\${BLACK}" 159 echo -e " |${SrsResearchSummaryColor}research: ./objs/research, api server, players, ts info, librtmp.\${BLACK}"
161 echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}" 160 echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
162 -echo -e " |${SrsBWTCSummaryColor}bandwidth: ./objs/bandwidth, the bandwidth test client\${BLACK}"  
163 -echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"  
164 echo -e " |${SrsUtestSummaryColor}utest: ./objs/srs_utest, the utest for srs\${BLACK}" 161 echo -e " |${SrsUtestSummaryColor}utest: ./objs/srs_utest, the utest for srs\${BLACK}"
165 echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}" 162 echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
166 echo -e " |${SrsLibrtmpSummaryColor}librtmp @see: https://github.com/winlinvip/simple-rtmp-server/wiki/SrsLibrtmp\${BLACK}" 163 echo -e " |${SrsLibrtmpSummaryColor}librtmp @see: https://github.com/winlinvip/simple-rtmp-server/wiki/SrsLibrtmp\${BLACK}"
@@ -168,6 +165,10 @@ echo -e " |${SrsLibrtmpSummaryColor}librtmp: ./objs/include, ./objs/lib, the @@ -168,6 +165,10 @@ echo -e " |${SrsLibrtmpSummaryColor}librtmp: ./objs/include, ./objs/lib, the
168 echo -e " | ${SrsLibrtmpSummaryColor}simple handshake: publish/play stream with simple handshake to server\${BLACK}" 165 echo -e " | ${SrsLibrtmpSummaryColor}simple handshake: publish/play stream with simple handshake to server\${BLACK}"
169 echo -e " | ${SrsLibrtmpSSLSummaryColor}complex handshake: it's not required for client, recommend disable it\${BLACK}" 166 echo -e " | ${SrsLibrtmpSSLSummaryColor}complex handshake: it's not required for client, recommend disable it\${BLACK}"
170 echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp, the srs-librtmp client sample\${BLACK}" 167 echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp, the srs-librtmp client sample\${BLACK}"
  168 +echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/objs/srs_ingest_flv\${BLACK}"
  169 +echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/objs/srs_ingest_rtmp\${BLACK}"
  170 +echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/objs/srs_detect_rtmp\${BLACK}"
  171 +echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/objs/srs_bandwidth_check\${BLACK}"
171 echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}" 172 echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
172 echo -e " |\${GREEN}server: ./objs/srs -c conf/srs.conf, start the srs server\${BLACK}" 173 echo -e " |\${GREEN}server: ./objs/srs -c conf/srs.conf, start the srs server\${BLACK}"
173 echo -e " | ${SrsHlsSummaryColor}hls @see: https://github.com/winlinvip/simple-rtmp-server/wiki/DeliveryHLS\${BLACK}" 174 echo -e " | ${SrsHlsSummaryColor}hls @see: https://github.com/winlinvip/simple-rtmp-server/wiki/DeliveryHLS\${BLACK}"
@@ -204,7 +205,7 @@ END @@ -204,7 +205,7 @@ END
204 # makefile 205 # makefile
205 echo "generate Makefile" 206 echo "generate Makefile"
206 cat << END > ${SRS_MAKEFILE} 207 cat << END > ${SRS_MAKEFILE}
207 -.PHONY: default _default install install-api help clean server bandwidth librtmp librtmp-sample utest _prepare_dir 208 +.PHONY: default _default install install-api help clean server librtmp utest _prepare_dir
208 209
209 # install prefix. 210 # install prefix.
210 SRS_PREFIX=${SRS_PREFIX} 211 SRS_PREFIX=${SRS_PREFIX}
@@ -230,24 +231,22 @@ fi @@ -230,24 +231,22 @@ fi
230 231
231 # the real entry for all platform. 232 # the real entry for all platform.
232 cat << END >> ${SRS_MAKEFILE} 233 cat << END >> ${SRS_MAKEFILE}
233 -_default: bandwidth librtmp-sample utest 234 +_default: server librtmp utest
234 @bash objs/_srs_build_summary.sh 235 @bash objs/_srs_build_summary.sh
235 236
236 help: 237 help:
237 - @echo "Usage: make <help>|<clean>|<server>|<bandwidth>|<librtmp>|<librtmp-sample>|<utest>|<install>|<install-api>|<uninstall>" 238 + @echo "Usage: make <help>|<clean>|<server>|<librtmp>|<utest>|<install>|<install-api>|<uninstall>"
238 @echo " help display this help menu" 239 @echo " help display this help menu"
239 @echo " clean cleanup project" 240 @echo " clean cleanup project"
240 @echo " server build the srs(simple rtmp server) over st(state-threads)" 241 @echo " server build the srs(simple rtmp server) over st(state-threads)"
241 - @echo " bandwidth build the bandwidth test client tool."  
242 - @echo " librtmp build the client publish/play library."  
243 - @echo " librtmp-sample build the srs-librtmp sample" 242 + @echo " librtmp build the client publish/play library, and samples"
244 @echo " utest build the utest for srs" 243 @echo " utest build the utest for srs"
245 @echo " install install srs to the prefix path" 244 @echo " install install srs to the prefix path"
246 - @echo " install-api install srs api to the prefix path" 245 + @echo " install-api install srs and api-server to the prefix path"
247 @echo " uninstall uninstall srs from prefix path" 246 @echo " uninstall uninstall srs from prefix path"
248 247
249 clean: 248 clean:
250 - (cd ${SRS_OBJS}; rm -rf srs bandwidth srs_utest) 249 + (cd ${SRS_OBJS}; rm -rf srs srs_utest)
251 (cd ${SRS_OBJS}; rm -rf src research include lib) 250 (cd ${SRS_OBJS}; rm -rf src research include lib)
252 (cd ${SRS_OBJS}/utest; rm -rf *.o *.a) 251 (cd ${SRS_OBJS}/utest; rm -rf *.o *.a)
253 (cd research/librtmp; make clean) 252 (cd research/librtmp; make clean)
@@ -313,49 +312,19 @@ install: @@ -313,49 +312,19 @@ install:
313 312
314 END 313 END
315 314
316 -if [ $SRS_BWTC = YES ]; then  
317 - cat << END >> ${SRS_MAKEFILE}  
318 -bandwidth: server  
319 - @echo "build the bandwidth test client tool"  
320 - \$(MAKE) -f ${SRS_OBJS}/${SRS_MAKEFILE} bandwidth  
321 -  
322 -END  
323 -else  
324 - cat << END >> ${SRS_MAKEFILE}  
325 -bandwidth: server  
326 - @echo "bandwidth test client tool is disabled, ignore."  
327 -  
328 -END  
329 -fi  
330 -  
331 if [ $SRS_LIBRTMP = YES ]; then 315 if [ $SRS_LIBRTMP = YES ]; then
332 cat << END >> ${SRS_MAKEFILE} 316 cat << END >> ${SRS_MAKEFILE}
333 librtmp: server 317 librtmp: server
334 @echo "build the client publish/play library." 318 @echo "build the client publish/play library."
335 \$(MAKE) -f ${SRS_OBJS}/${SRS_MAKEFILE} librtmp 319 \$(MAKE) -f ${SRS_OBJS}/${SRS_MAKEFILE} librtmp
336 -  
337 -END  
338 -else  
339 - cat << END >> ${SRS_MAKEFILE}  
340 -librtmp: server  
341 - @echo "srs-librtmp is disabled, ignore."  
342 -  
343 -END  
344 -fi  
345 -if [ $SRS_LIBRTMP = YES ]; then  
346 - cat << END >> ${SRS_MAKEFILE}  
347 -  
348 -librtmp-sample: librtmp  
349 @echo "build the srs-librtmp sample" 320 @echo "build the srs-librtmp sample"
350 (cd research/librtmp; \$(MAKE) ${SrsLibrtmpSampleEntry}) 321 (cd research/librtmp; \$(MAKE) ${SrsLibrtmpSampleEntry})
351 - @echo "srs-librtmp sample build success"  
352 322
353 END 323 END
354 else 324 else
355 cat << END >> ${SRS_MAKEFILE} 325 cat << END >> ${SRS_MAKEFILE}
356 -  
357 -librtmp-sample: librtmp  
358 - @echo "srs-librtmp sample is disabled, ignore." 326 +librtmp: server
  327 + @echo "srs-librtmp is disabled, ignore."
359 328
360 END 329 END
361 fi 330 fi
@@ -406,7 +375,7 @@ AR = ar @@ -406,7 +375,7 @@ AR = ar
406 LINK = g++ 375 LINK = g++
407 CXXFLAGS = ${CXXFLAGS} 376 CXXFLAGS = ${CXXFLAGS}
408 377
409 -.PHONY: default srs bandwidth librtmp 378 +.PHONY: default srs librtmp
410 379
411 default: 380 default:
412 381
@@ -491,7 +460,7 @@ LIBS_OBJS="${MODULE_OBJS[@]}" @@ -491,7 +460,7 @@ LIBS_OBJS="${MODULE_OBJS[@]}"
491 MODULE_ID="MAIN" 460 MODULE_ID="MAIN"
492 MODULE_DEPENDS=("CORE" "KERNEL" "RTMP" "APP") 461 MODULE_DEPENDS=("CORE" "KERNEL" "RTMP" "APP")
493 ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS} ${LibGperfRoot}) 462 ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS} ${LibGperfRoot})
494 -MODULE_FILES=("srs_main_server" "srs_main_bandcheck") 463 +MODULE_FILES=("srs_main_server")
495 MAIN_INCS="src/main"; MODULE_DIR=${MAIN_INCS} . auto/modules.sh 464 MAIN_INCS="src/main"; MODULE_DIR=${MAIN_INCS} . auto/modules.sh
496 MAIN_OBJS="${MODULE_OBJS[@]}" 465 MAIN_OBJS="${MODULE_OBJS[@]}"
497 466
@@ -500,7 +469,7 @@ MAIN_OBJS="${MODULE_OBJS[@]}" @@ -500,7 +469,7 @@ MAIN_OBJS="${MODULE_OBJS[@]}"
500 # then link to a binary, for example, objs/srs 469 # then link to a binary, for example, objs/srs
501 # 470 #
502 # all main entrances 471 # all main entrances
503 -MAIN_ENTRANCES=("srs_main_server" "srs_main_bandcheck") 472 +MAIN_ENTRANCES=("srs_main_server")
504 # 473 #
505 # all depends libraries 474 # all depends libraries
506 ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile} ${LibSSLfile} ${LibGperfFile}) 475 ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile} ${LibSSLfile} ${LibGperfFile})
@@ -511,10 +480,6 @@ LINK_OPTIONS="${SrsLinkOptions}${SrsGprofLink}${SrsGperfLink}" @@ -511,10 +480,6 @@ LINK_OPTIONS="${SrsLinkOptions}${SrsGprofLink}${SrsGperfLink}"
511 # srs: 480 # srs:
512 # srs(simple rtmp server) over st(state-threads) 481 # srs(simple rtmp server) over st(state-threads)
513 BUILD_KEY="srs" APP_MAIN="srs_main_server" APP_NAME="srs" . auto/apps.sh 482 BUILD_KEY="srs" APP_MAIN="srs_main_server" APP_NAME="srs" . auto/apps.sh
514 -# bandwidth test tool, to test the bandwidth to server  
515 -if [ $SRS_BWTC = YES ]; then  
516 - BUILD_KEY="bandwidth" APP_MAIN="srs_main_bandcheck" APP_NAME="bandwidth" . auto/apps.sh  
517 -fi  
518 # srs librtmp 483 # srs librtmp
519 if [ $SRS_LIBRTMP = YES ]; then 484 if [ $SRS_LIBRTMP = YES ]; then
520 MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${RTMP_OBJS[@]} ${LIBS_OBJS[@]}" 485 MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${RTMP_OBJS[@]} ${LIBS_OBJS[@]}"
@@ -601,11 +566,6 @@ if [ $SRS_LIBRTMP = YES ]; then @@ -601,11 +566,6 @@ if [ $SRS_LIBRTMP = YES ]; then
601 else 566 else
602 echo -e "${YELLOW}note: srs-librtmp for client is disabled${BLACK}" 567 echo -e "${YELLOW}note: srs-librtmp for client is disabled${BLACK}"
603 fi 568 fi
604 -if [ $SRS_BWTC = YES ]; then  
605 - echo -e "${GREEN}srs bandwidth test client is enabled${BLACK}"  
606 -else  
607 - echo -e "${GREEN}note: srs bandwidth test client is disabled${BLACK}"  
608 -fi  
609 if [ $SRS_RESEARCH = YES ]; then 569 if [ $SRS_RESEARCH = YES ]; then
610 echo -e "${GREEN}research tools are builded${BLACK}" 570 echo -e "${GREEN}research tools are builded${BLACK}"
611 else 571 else
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 // current release version 31 // current release version
32 #define VERSION_MAJOR "0" 32 #define VERSION_MAJOR "0"
33 #define VERSION_MINOR "9" 33 #define VERSION_MINOR "9"
34 -#define VERSION_REVISION "158" 34 +#define VERSION_REVISION "159"
35 #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION 35 #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
36 // server info. 36 // server info.
37 #define RTMP_SIG_SRS_KEY "SRS" 37 #define RTMP_SIG_SRS_KEY "SRS"
1 -/*  
2 -The MIT License (MIT)  
3 -  
4 -Copyright (c) 2013-2014 wenjiegit  
5 -  
6 -Permission is hereby granted, free of charge, to any person obtaining a copy of  
7 -this software and associated documentation files (the "Software"), to deal in  
8 -the Software without restriction, including without limitation the rights to  
9 -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of  
10 -the Software, and to permit persons to whom the Software is furnished to do so,  
11 -subject to the following conditions:  
12 -  
13 -The above copyright notice and this permission notice shall be included in all  
14 -copies or substantial portions of the Software.  
15 -  
16 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  
17 -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS  
18 -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR  
19 -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER  
20 -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN  
21 -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  
22 -*/  
23 -  
24 -#include <sys/socket.h>  
25 -#include <netinet/in.h>  
26 -#include <arpa/inet.h>  
27 -#include <sstream>  
28 -#include <getopt.h>  
29 -#include <stdlib.h>  
30 -  
31 -#include <srs_protocol_rtmp.hpp>  
32 -#include <srs_protocol_stack.hpp>  
33 -#include <srs_kernel_error.hpp>  
34 -#include <srs_protocol_amf0.hpp>  
35 -#include <srs_core_autofree.hpp>  
36 -#include <srs_kernel_stream.hpp>  
37 -#include <srs_app_socket.hpp>  
38 -#include <srs_app_config.hpp>  
39 -#include <srs_app_log.hpp>  
40 -#include <srs_app_server.hpp>  
41 -#include <srs_kernel_utility.hpp>  
42 -  
43 -// kernel module.  
44 -ISrsLog* _srs_log = new SrsFastLog();  
45 -ISrsThreadContext* _srs_context = new ISrsThreadContext();  
46 -// app module.  
47 -SrsConfig* _srs_config = NULL;  
48 -SrsServer* _srs_server = NULL;  
49 -  
50 -#include <st.h>  
51 -  
52 -// server play control  
53 -#define SRS_BW_CHECK_START_PLAY "onSrsBandCheckStartPlayBytes"  
54 -#define SRS_BW_CHECK_STARTING_PLAY "onSrsBandCheckStartingPlayBytes"  
55 -#define SRS_BW_CHECK_STOP_PLAY "onSrsBandCheckStopPlayBytes"  
56 -#define SRS_BW_CHECK_STOPPED_PLAY "onSrsBandCheckStoppedPlayBytes"  
57 -  
58 -// server publish control  
59 -#define SRS_BW_CHECK_START_PUBLISH "onSrsBandCheckStartPublishBytes"  
60 -#define SRS_BW_CHECK_STARTING_PUBLISH "onSrsBandCheckStartingPublishBytes"  
61 -#define SRS_BW_CHECK_STOP_PUBLISH "onSrsBandCheckStopPublishBytes"  
62 -#define SRS_BW_CHECK_STOPPED_PUBLISH "onSrsBandCheckStoppedPublishBytes"  
63 -  
64 -// EOF control.  
65 -#define SRS_BW_CHECK_FINISHED "onSrsBandCheckFinished"  
66 -#define SRS_BW_CHECK_FLASH_FINAL "finalClientPacket"  
67 -  
68 -// client only  
69 -#define SRS_BW_CHECK_PLAYING "onSrsBandCheckPlaying"  
70 -#define SRS_BW_CHECK_PUBLISHING "onSrsBandCheckPublishing"  
71 -  
72 -class ISrsProtocolReaderWriter;  
73 -  
74 -/**  
75 -* @brief class of Linux version band check client  
76 -* check play and publish speed.  
77 -*/  
78 -class SrsBandCheckClient : public SrsRtmpClient  
79 -{  
80 -public:  
81 - SrsBandCheckClient(ISrsProtocolReaderWriter* io);  
82 - ~SrsBandCheckClient();  
83 -  
84 -public:  
85 - /**  
86 - * @brief test play  
87 - *  
88 - */  
89 - int check_play();  
90 - /**  
91 - * @brief test publish  
92 - *  
93 - */  
94 - int check_publish();  
95 -  
96 -private:  
97 - /**  
98 - * @brief just return success.  
99 - */  
100 - int create_stream(int& stream_id);  
101 - /**  
102 - * @brief just return success.  
103 - */  
104 - int play(std::string stream, int stream_id);  
105 - /**  
106 - * @brief just return success.  
107 - */  
108 - int publish(std::string stream, int stream_id);  
109 -  
110 -private:  
111 - int expect_start_play();  
112 - int send_starting_play();  
113 - int expect_stop_play();  
114 - int send_stopped_play();  
115 - int expect_start_pub();  
116 - int send_starting_pub();  
117 - int send_pub_data();  
118 - int expect_stop_pub();  
119 - /**  
120 - * @brief expect result.  
121 - * because the core module has no method to decode this packet  
122 - * so we must get the internal data and decode it here.  
123 - */  
124 - int expect_finished();  
125 - int send_stopped_pub();  
126 - /**  
127 - * @brief notify server the check procedure is over.  
128 - */  
129 - int send_final();  
130 -};  
131 -  
132 -/**  
133 -* @brief class of band check  
134 -* used to check band width with a client @param bandCheck_Client  
135 -*/  
136 -class SrsBandCheck  
137 -{  
138 -public:  
139 - SrsBandCheck();  
140 - ~SrsBandCheck();  
141 -  
142 -public:  
143 - /**  
144 - * @brief band check method  
145 - *  
146 - * connect to server------>rtmp handshake------>rtmp connect------>play------>publish  
147 - * @retval ERROR_SUCCESS when success.  
148 - */  
149 - int check(const std::string& app, const std::string& tcUrl);  
150 -  
151 - /**  
152 - * @brief set the address and port of test server  
153 - *  
154 - * @param server server address, domain or ip  
155 - * @param server listened port ,default is 1935  
156 - */  
157 - void set_server(const std::string& server, int port = 1935);  
158 -  
159 -private:  
160 - int connect_server();  
161 -private:  
162 - st_netfd_t stfd;  
163 - ISrsProtocolReaderWriter* skt;  
164 - SrsBandCheckClient* bandCheck_Client;  
165 - std::string server_address;  
166 - int server_port;  
167 -};  
168 -  
169 -/**  
170 -* @brief init st lib  
171 -*/  
172 -static int init_st();  
173 -static void print_help(char** argv);  
174 -static void print_version();  
175 -  
176 -/**  
177 -* @brief get user option  
178 -* @internal ip Mandatory arguments  
179 -* @internal key Mandatory arguments  
180 -* @internal port default 1935  
181 -* @internal vhost default bandcheck.srs.com  
182 -*/  
183 -static int get_opt(int argc ,char* argv[]);  
184 -  
185 -/**  
186 -* global var.  
187 -*/  
188 -static struct option long_options[] =  
189 -{  
190 - {"ip", required_argument, 0, 'i'},  
191 - {"port", optional_argument, 0, 'p'},  
192 - {"key", required_argument, 0, 'k'},  
193 - {"vhost", optional_argument, 0, 'v'},  
194 - {"help", no_argument, 0, 'h'},  
195 - {"version", no_argument, 0, 'V'},  
196 -};  
197 -  
198 -static const char* short_options = "i:p::k:v::hV";  
199 -  
200 -static std::string g_ip;  
201 -static int g_port = 1935;  
202 -static std::string g_key;  
203 -static std::string g_vhost = "bandcheck.srs.com";  
204 -  
205 -#define BUILD_VERSION "srs band check 0.1"  
206 -  
207 -// TODO: FIXME: by winlin, the bandwidth test tool has logic bug.  
208 -int main(int argc ,char* argv[])  
209 -{  
210 - int ret = ERROR_SUCCESS;  
211 -  
212 - if (argc <= 1) {  
213 - print_help(argv);  
214 - exit(1);  
215 - }  
216 -  
217 - if ((ret = get_opt(argc, argv)) != ERROR_SUCCESS) {  
218 - return -1;  
219 - }  
220 -  
221 - // check param  
222 - if (g_ip.empty()) {  
223 - printf("ip address should not be empty.\n");  
224 - return -1;  
225 - }  
226 -  
227 - if (g_key.empty()) {  
228 - printf("test key should not be empty.\n");  
229 - return -1;  
230 - }  
231 -  
232 - if ((ret = init_st()) != ERROR_SUCCESS) {  
233 - srs_error("band check init failed. ret=%d", ret);  
234 - return ret;  
235 - }  
236 -  
237 - std::string app = "app?key=" + g_key + "&vhost=" + g_vhost;  
238 -  
239 - char tcUrl_buffer[1024] = {0};  
240 - sprintf(tcUrl_buffer, "rtmp://%s:%d/%s", g_ip.c_str(), g_port, app.c_str());  
241 - std::string tcUrl = tcUrl_buffer;  
242 -  
243 - SrsBandCheck band_check;  
244 - band_check.set_server(g_ip, g_port);  
245 - if ((ret = band_check.check(app, tcUrl)) != ERROR_SUCCESS) {  
246 - srs_error("band check failed. address=%s ret=%d", "xx.com", ret);  
247 - return -1;  
248 - }  
249 -  
250 - return 0;  
251 -}  
252 -  
253 -SrsBandCheckClient::SrsBandCheckClient(ISrsProtocolReaderWriter* io)  
254 - : SrsRtmpClient(io)  
255 -{  
256 -}  
257 -  
258 -SrsBandCheckClient::~SrsBandCheckClient()  
259 -{  
260 -}  
261 -  
262 -int SrsBandCheckClient::check_play()  
263 -{  
264 - int ret = ERROR_SUCCESS;  
265 -  
266 - if ((ret = expect_start_play()) != ERROR_SUCCESS) {  
267 - srs_error("expect_start_play failed. ret=%d", ret);  
268 - return ret;  
269 - }  
270 -  
271 - if ((ret = send_starting_play()) != ERROR_SUCCESS) {  
272 - srs_error("send starting play failed. ret=%d", ret);  
273 - return ret;  
274 - }  
275 -  
276 - if ((ret = expect_stop_play()) != ERROR_SUCCESS) {  
277 - srs_error("expect stop play failed. ret=%d", ret);  
278 - return ret;  
279 - }  
280 -  
281 - if ((ret = send_stopped_play()) != ERROR_SUCCESS) {  
282 - srs_error("send stopped play failed. ret=%d", ret);  
283 - return ret;  
284 - }  
285 -  
286 - return ret;  
287 -}  
288 -  
289 -int SrsBandCheckClient::check_publish()  
290 -{  
291 - int ret = ERROR_SUCCESS;  
292 -  
293 - if ((ret = expect_start_pub()) != ERROR_SUCCESS) {  
294 - srs_error("expect start pub failed. ret=%d", ret);  
295 - return ret;  
296 - }  
297 -  
298 - if ((ret = send_starting_pub())!= ERROR_SUCCESS) {  
299 - srs_error("send starting pub failed. ret=%d", ret);  
300 - return ret;  
301 - }  
302 -  
303 - if ((ret = send_pub_data()) != ERROR_SUCCESS) {  
304 - srs_error("publish data failed. ret=%d", ret);  
305 - return ret;  
306 - }  
307 -  
308 - if ((ret = send_stopped_pub()) != ERROR_SUCCESS) {  
309 - srs_error("send stopped pub failed. ret=%d", ret);  
310 - return ret;  
311 - }  
312 -  
313 - if ((ret = expect_finished()) != ERROR_SUCCESS) {  
314 - srs_error("expect finished msg failed. ret=%d", ret);  
315 - return ret;  
316 - }  
317 -  
318 - if ((ret = send_final()) != ERROR_SUCCESS) {  
319 - srs_error("send final msg failed. ret=%d", ret);  
320 - return ret;  
321 - }  
322 -  
323 - return ret;  
324 -}  
325 -  
326 -int SrsBandCheckClient::create_stream(int &stream_id)  
327 -{  
328 - return ERROR_SUCCESS;  
329 -}  
330 -  
331 -int SrsBandCheckClient::play(std::string stream, int stream_id)  
332 -{  
333 - return ERROR_SUCCESS;  
334 -}  
335 -  
336 -int SrsBandCheckClient::publish(std::string stream, int stream_id)  
337 -{  
338 - return ERROR_SUCCESS;  
339 -}  
340 -  
341 -int SrsBandCheckClient::expect_start_play()  
342 -{  
343 - int ret = ERROR_SUCCESS;  
344 -  
345 - // expect connect _result  
346 - SrsMessage* msg = NULL;  
347 - SrsBandwidthPacket* pkt = NULL;  
348 - if ((ret = expect_message<SrsBandwidthPacket>(&msg, &pkt)) != ERROR_SUCCESS) {  
349 - srs_error("expect bandcheck start play message failed. ret=%d", ret);  
350 - return ret;  
351 - }  
352 - SrsAutoFree(SrsMessage, msg);  
353 - SrsAutoFree(SrsBandwidthPacket, pkt);  
354 - srs_info("get bandcheck start play message");  
355 -  
356 - if (pkt->command_name != SRS_BW_CHECK_START_PLAY) {  
357 - srs_error("pkt error. expect=%s, actual=%s", SRS_BW_CHECK_START_PLAY, pkt->command_name.c_str());  
358 - return -1;  
359 - }  
360 -  
361 - return ret;  
362 -}  
363 -  
364 -int SrsBandCheckClient::send_starting_play()  
365 -{  
366 - int ret = ERROR_SUCCESS;  
367 -  
368 - SrsBandwidthPacket* pkt = new SrsBandwidthPacket;  
369 - pkt->command_name = SRS_BW_CHECK_STARTING_PLAY;  
370 - if ((ret = send_and_free_packet(pkt, 0)) != ERROR_SUCCESS) {  
371 - srs_error("send starting play msg failed. ret=%d", ret);  
372 - return ret;  
373 - }  
374 -  
375 - return ret;  
376 -}  
377 -  
378 -int SrsBandCheckClient::expect_stop_play()  
379 -{  
380 - int ret = ERROR_SUCCESS;  
381 -  
382 - while (true) {  
383 - SrsMessage* msg = NULL;  
384 - SrsBandwidthPacket* pkt = NULL;  
385 - if ((ret = expect_message<SrsBandwidthPacket>(&msg, &pkt)) != ERROR_SUCCESS) {  
386 - srs_error("expect stop play message failed. ret=%d", ret);  
387 - return ret;  
388 - }  
389 - SrsAutoFree(SrsMessage, msg);  
390 - SrsAutoFree(SrsBandwidthPacket, pkt);  
391 - srs_info("get bandcheck stop play message");  
392 -  
393 - if (pkt->command_name == SRS_BW_CHECK_STOP_PLAY) {  
394 - break;  
395 - }  
396 - }  
397 -  
398 - return ret;  
399 -}  
400 -  
401 -int SrsBandCheckClient::send_stopped_play()  
402 -{  
403 - int ret = ERROR_SUCCESS;  
404 -  
405 - SrsBandwidthPacket* pkt = new SrsBandwidthPacket;  
406 - pkt->command_name = SRS_BW_CHECK_STOPPED_PLAY;  
407 - if ((ret = send_and_free_packet(pkt, 0)) != ERROR_SUCCESS) {  
408 - srs_error("send stopped play msg failed. ret=%d", ret);  
409 - return ret;  
410 - }  
411 -  
412 - return ret;  
413 -}  
414 -  
415 -int SrsBandCheckClient::expect_start_pub()  
416 -{  
417 - int ret = ERROR_SUCCESS;  
418 -  
419 - while (true) {  
420 - SrsMessage* msg = NULL;  
421 - SrsBandwidthPacket* pkt = NULL;  
422 - if ((ret = expect_message<SrsBandwidthPacket>(&msg, &pkt)) != ERROR_SUCCESS) {  
423 - srs_error("expect start pub message failed. ret=%d", ret);  
424 - return ret;  
425 - }  
426 - SrsAutoFree(SrsMessage, msg);  
427 - SrsAutoFree(SrsBandwidthPacket, pkt);  
428 - srs_info("get bandcheck start pub message");  
429 -  
430 - if (pkt->command_name == SRS_BW_CHECK_START_PUBLISH) {  
431 - break;  
432 - }  
433 - }  
434 -  
435 - return ret;  
436 -}  
437 -  
438 -int SrsBandCheckClient::send_starting_pub()  
439 -{  
440 - int ret = ERROR_SUCCESS;  
441 -  
442 - SrsBandwidthPacket* pkt = new SrsBandwidthPacket;  
443 - pkt->command_name = SRS_BW_CHECK_STARTING_PUBLISH;  
444 - if ((ret = send_and_free_packet(pkt, 0)) != ERROR_SUCCESS) {  
445 - srs_error("send starting play msg failed. ret=%d", ret);  
446 - return ret;  
447 - }  
448 - srs_info("send starting play msg success.");  
449 -  
450 - return ret;  
451 -}  
452 -  
453 -int SrsBandCheckClient::send_pub_data()  
454 -{  
455 - int ret = ERROR_SUCCESS;  
456 -  
457 - int data_count = 100;  
458 - while (true) {  
459 - SrsBandwidthPacket* pkt = new SrsBandwidthPacket;  
460 - pkt->command_name = SRS_BW_CHECK_PUBLISHING;  
461 -  
462 - for (int i = 0; i < data_count; ++i) {  
463 - std::stringstream seq;  
464 - seq << i;  
465 - std::string play_data = "SrS band check data from client's publishing......";  
466 - pkt->data->set(seq.str(), SrsAmf0Any::str(play_data.c_str()));  
467 - }  
468 - data_count += 100;  
469 -  
470 - if ((ret = send_and_free_packet(pkt, 0)) != ERROR_SUCCESS) {  
471 - srs_error("send publish message failed.ret=%d", ret);  
472 - return ret;  
473 - }  
474 -  
475 - if ((ret = expect_stop_pub()) == ERROR_SUCCESS) {  
476 - break;  
477 - }  
478 - }  
479 -  
480 - return ret;  
481 -}  
482 -  
483 -int SrsBandCheckClient::expect_stop_pub()  
484 -{  
485 - int ret = ERROR_SUCCESS;  
486 -  
487 - this->set_recv_timeout(1000 * 1000);  
488 - this->set_send_timeout(1000 * 1000);  
489 -  
490 - SrsMessage* msg;  
491 - SrsBandwidthPacket* pkt;  
492 - if ((ret = expect_message<SrsBandwidthPacket>(&msg, &pkt)) != ERROR_SUCCESS) {  
493 - return ret;  
494 - }  
495 - SrsAutoFree(SrsMessage, msg);  
496 - SrsAutoFree(SrsBandwidthPacket, pkt);  
497 - if (pkt->command_name == SRS_BW_CHECK_STOP_PUBLISH) {  
498 - return ret;  
499 - }  
500 -  
501 - return ret;  
502 -}  
503 -  
504 -int SrsBandCheckClient::expect_finished()  
505 -{  
506 - int ret = ERROR_SUCCESS;  
507 -  
508 - while (true) {  
509 - SrsMessage* msg = NULL;  
510 - SrsBandwidthPacket* pkt = NULL;  
511 - if ((ret = expect_message<SrsBandwidthPacket>(&msg, &pkt)) != ERROR_SUCCESS) {  
512 - srs_error("expect finished message failed. ret=%d", ret);  
513 - return ret;  
514 - }  
515 - SrsAutoFree(SrsMessage, msg);  
516 - SrsAutoFree(SrsBandwidthPacket, pkt);  
517 - srs_info("get bandcheck finished message");  
518 -  
519 - if (pkt->command_name == SRS_BW_CHECK_FINISHED) {  
520 - SrsStream *stream = new SrsStream;  
521 - SrsAutoFree(SrsStream, stream);  
522 -  
523 - if ((ret = stream->initialize((char*)msg->payload, msg->size)) != ERROR_SUCCESS) {  
524 - srs_error("initialize stream error. ret=%d", ret);  
525 - return ret;  
526 - }  
527 -  
528 - std::string command_name;  
529 - if ((ret = srs_amf0_read_string(stream, command_name)) != ERROR_SUCCESS) {  
530 - srs_error("amfo read string error. ret=%d", ret);  
531 - return ret;  
532 - }  
533 -  
534 - double action_id;  
535 - if ((ret = srs_amf0_read_number(stream, action_id)) != ERROR_SUCCESS) {  
536 - srs_error("amfo read number error. ret=%d", ret);  
537 - return ret;  
538 - }  
539 -  
540 - if ((ret = srs_amf0_read_null(stream)) != ERROR_SUCCESS) {  
541 - srs_error("amfo read number error. ret=%d", ret);  
542 - return ret;  
543 - }  
544 -  
545 - SrsAmf0Object* object = SrsAmf0Any::object();  
546 - if ((ret = object->read(stream)) != ERROR_SUCCESS) {  
547 - srs_freep(object);  
548 - srs_error("amfo read object error. ret=%d", ret);  
549 - return ret;  
550 - }  
551 -  
552 - int64_t start_time = 0;  
553 - int64_t end_time = 0;  
554 -  
555 - SrsAmf0Any* start_time_any = object->get_property("start_time");  
556 - if (start_time_any && start_time_any->is_number()) {  
557 - start_time = start_time_any->to_number();  
558 - }  
559 -  
560 - SrsAmf0Any* end_time_any = object->get_property("end_time");  
561 - if (end_time_any && end_time_any->is_number()) {  
562 - end_time = end_time_any->to_number();  
563 - }  
564 -  
565 - int play_kbps = 0;  
566 - int pub_kbps = 0;  
567 - SrsAmf0Any* play_kbp_any = object->get_property("play_kbps");  
568 - if (play_kbp_any && play_kbp_any->is_number()) {  
569 - play_kbps = play_kbp_any->to_number();  
570 - }  
571 -  
572 - SrsAmf0Any* pub_kbp_any = object->get_property("publish_kbps");  
573 - if (pub_kbp_any && pub_kbp_any->is_number()) {  
574 - pub_kbps = pub_kbp_any->to_number();  
575 - }  
576 -  
577 - float time_elapsed;  
578 - if (end_time - start_time > 0) {  
579 - time_elapsed = (end_time - start_time) / 1000.00;  
580 - }  
581 -  
582 - srs_trace("result: play %d kbps, publish %d kbps, check time %.4f S\n"  
583 - , play_kbps, pub_kbps, time_elapsed);  
584 -  
585 - break;  
586 - }  
587 - }  
588 -  
589 - return ret;  
590 -}  
591 -  
592 -int SrsBandCheckClient::send_stopped_pub()  
593 -{  
594 - int ret = ERROR_SUCCESS;  
595 -  
596 - SrsBandwidthPacket* pkt = new SrsBandwidthPacket;  
597 - pkt->command_name = SRS_BW_CHECK_STOPPED_PUBLISH;  
598 - if ((ret = send_and_free_packet(pkt, 0)) != ERROR_SUCCESS) {  
599 - srs_error("send stopped pub msg failed. ret=%d", ret);  
600 - return ret;  
601 - }  
602 - srs_info("send stopped pub msg success.");  
603 -  
604 - return ret;  
605 -}  
606 -  
607 -int SrsBandCheckClient::send_final()  
608 -{  
609 - int ret = ERROR_SUCCESS;  
610 -  
611 - SrsBandwidthPacket* pkt = new SrsBandwidthPacket;  
612 - pkt->command_name = SRS_BW_CHECK_FLASH_FINAL;  
613 - if ((ret = send_and_free_packet(pkt, 0)) != ERROR_SUCCESS) {  
614 - srs_error("send final msg failed. ret=%d", ret);  
615 - return ret;  
616 - }  
617 - srs_info("send final msg success.");  
618 -  
619 - return ret;  
620 -}  
621 -  
622 -SrsBandCheck::SrsBandCheck()  
623 -{  
624 - skt = NULL;  
625 - bandCheck_Client = NULL;  
626 - stfd = NULL;  
627 -}  
628 -  
629 -SrsBandCheck::~SrsBandCheck()  
630 -{  
631 - srs_freep(bandCheck_Client);  
632 - srs_freep(skt);  
633 - srs_close_stfd(stfd);  
634 -}  
635 -  
636 -int SrsBandCheck::check(const std::string &app, const std::string &tcUrl)  
637 -{  
638 - int ret = ERROR_SUCCESS;  
639 -  
640 - if ((ret = connect_server()) != ERROR_SUCCESS) {  
641 - srs_error("connect to server failed. ret = %d", ret);  
642 - return ret;  
643 - }  
644 -  
645 - if ((ret = bandCheck_Client->handshake()) != ERROR_SUCCESS) {  
646 - srs_error("handshake failed. ret = %d", ret);  
647 - return ret;  
648 - }  
649 -  
650 - if ((ret = bandCheck_Client->connect_app(app, tcUrl)) != ERROR_SUCCESS) {  
651 - srs_error("handshake failed. ret = %d", ret);  
652 - return ret;  
653 - }  
654 -  
655 - if ((ret = bandCheck_Client->check_play()) != ERROR_SUCCESS) {  
656 - srs_error("band check play failed.");  
657 - return ret;  
658 - }  
659 -  
660 - if ((ret = bandCheck_Client->check_publish()) != ERROR_SUCCESS) {  
661 - srs_error("band check publish failed.");  
662 - return ret;  
663 - }  
664 -  
665 - return ret;  
666 -}  
667 -  
668 -void SrsBandCheck::set_server(const std::string &server, int port)  
669 -{  
670 - server_address = server;  
671 - server_port = port;  
672 -}  
673 -  
674 -int SrsBandCheck::connect_server()  
675 -{  
676 - int ret = ERROR_SUCCESS;  
677 -  
678 - int sock = socket(AF_INET, SOCK_STREAM, 0);  
679 - if(sock == -1){  
680 - ret = ERROR_SOCKET_CREATE;  
681 - srs_error("create socket error. ret=%d", ret);  
682 - return ret;  
683 - }  
684 -  
685 - stfd = st_netfd_open_socket(sock);  
686 - if(stfd == NULL){  
687 - ret = ERROR_ST_OPEN_SOCKET;  
688 - srs_error("st_netfd_open_socket failed. ret=%d", ret);  
689 - return ret;  
690 - }  
691 -  
692 - skt = new SrsSocket(stfd);  
693 - bandCheck_Client = new SrsBandCheckClient(skt);  
694 -  
695 - // connect to server.  
696 - std::string ip = srs_dns_resolve(server_address);  
697 - if (ip.empty()) {  
698 - ret = ERROR_SYSTEM_IP_INVALID;  
699 - srs_error("dns resolve server error, ip empty. ret=%d", ret);  
700 - return ret;  
701 - }  
702 -  
703 - sockaddr_in addr;  
704 - addr.sin_family = AF_INET;  
705 - addr.sin_port = htons(server_port);  
706 - addr.sin_addr.s_addr = inet_addr(ip.c_str());  
707 -  
708 - if (st_connect(stfd, (const struct sockaddr*)&addr, sizeof(sockaddr_in), ST_UTIME_NO_TIMEOUT) == -1){  
709 - ret = ERROR_ST_CONNECT;  
710 - srs_error("connect to server error. ip=%s, port=%d, ret=%d", ip.c_str(), server_port, ret);  
711 - return ret;  
712 - }  
713 - srs_trace("connect to server success. server=%s, ip=%s, port=%d", server_address.c_str(), ip.c_str(), server_port);  
714 -  
715 - return ret;  
716 -}  
717 -  
718 -int init_st()  
719 -{  
720 - int ret = ERROR_SUCCESS;  
721 -  
722 - if (st_set_eventsys(ST_EVENTSYS_ALT) == -1) {  
723 - ret = ERROR_ST_SET_EPOLL;  
724 - srs_error("st_set_eventsys use linux epoll failed. ret=%d", ret);  
725 - return ret;  
726 - }  
727 -  
728 - if(st_init() != 0){  
729 - ret = ERROR_ST_INITIALIZE;  
730 - srs_error("st_init failed. ret=%d", ret);  
731 - return ret;  
732 - }  
733 -  
734 - return ret;  
735 -}  
736 -  
737 -void print_help(char** argv)  
738 -{  
739 - printf(  
740 - "Usage: %s [OPTION]...\n"  
741 - "test band width from client to rtmp server.\n"  
742 - "Mandatory arguments to long options are mandatory for short options too.\n"  
743 - " -i, --ip the ip or domain that to test\n"  
744 - " -p, --port the port that server listen \n"  
745 - " -k, --key the key used to test \n"  
746 - " -v, --vhost the vhost used to test \n"  
747 - " -V, --version output version information and exit \n"  
748 - " -h, --help display this help and exit \n"  
749 - "\n"  
750 - "For example:\n"  
751 - " %s -i 127.0.0.1 -p 1935 -v bandcheck.srs.com -k 35c9b402c12a7246868752e2878f7e0e"  
752 - "\n\n"  
753 - "Exit status:\n"  
754 - "0 if OK,\n"  
755 - "other if error occured, and the detail should be printed.\n"  
756 - "\n\n"  
757 - "srs home page: <http://blog.chinaunix.net/uid/25006789.html>\n",  
758 - argv[0], argv[0]);  
759 -}  
760 -  
761 -void print_version()  
762 -{  
763 - const char *version = ""  
764 - "srs_bandcheck "BUILD_VERSION"\n"  
765 - "Copyright (c) 2013-2014 wenjiegit.\n"  
766 - "License MIT\n"  
767 - "This is free software: you are free to change and redistribute it.\n"  
768 - "There is NO WARRANTY, to the extent permitted by law.\n"  
769 - "\n"  
770 - "Written by wenjie.\n";  
771 -  
772 - printf("%s", version);  
773 -}  
774 -  
775 -int get_opt(int argc, char *argv[])  
776 -{  
777 - int ret = ERROR_SUCCESS;  
778 -  
779 - int c;  
780 - while ((c = getopt_long (argc, argv, short_options, long_options, NULL)) != -1) {  
781 - switch (c) {  
782 - case 'i':  
783 - if (optarg) {  
784 - g_ip = optarg;  
785 - }  
786 - break;  
787 - case 'p':  
788 - if (optarg) {  
789 - g_port = atoi(optarg);  
790 - }  
791 - break;  
792 - case 'k':  
793 - if (optarg) {  
794 - g_key = optarg;  
795 - }  
796 - break;  
797 - case 'v':  
798 - if (optarg) {  
799 - g_vhost = optarg;  
800 - }  
801 - break;  
802 - case 'V':  
803 - print_version();  
804 - exit(0);  
805 - break;  
806 - case 'h':  
807 - print_help(argv);  
808 - exit(0);  
809 - break;  
810 - default:  
811 - printf("see --help or -h\n");  
812 - ret = -1;  
813 - }  
814 - }  
815 -  
816 - return ret;  
817 -}  
@@ -436,8 +436,6 @@ int SrsRtmpClient::complex_handshake() @@ -436,8 +436,6 @@ int SrsRtmpClient::complex_handshake()
436 436
437 int SrsRtmpClient::connect_app(string app, string tc_url, SrsRequest* req) 437 int SrsRtmpClient::connect_app(string app, string tc_url, SrsRequest* req)
438 { 438 {
439 - int ret = ERROR_SUCCESS;  
440 -  
441 std::string srs_server_ip; 439 std::string srs_server_ip;
442 std::string srs_server; 440 std::string srs_server;
443 std::string srs_primary_authors; 441 std::string srs_primary_authors;
1 file 1 file
2 main readonly separator, 2 main readonly separator,
3 ..\main\srs_main_server.cpp, 3 ..\main\srs_main_server.cpp,
4 - ..\main\srs_main_bandcheck.cpp,  
5 auto readonly separator, 4 auto readonly separator,
6 ..\..\objs\srs_auto_headers.hpp, 5 ..\..\objs\srs_auto_headers.hpp,
7 libs readonly separator, 6 libs readonly separator,