正在显示
32 个修改的文件
包含
297 行增加
和
157 行删除
| @@ -127,7 +127,7 @@ cd simple-rtmp-server/trunk | @@ -127,7 +127,7 @@ cd simple-rtmp-server/trunk | ||
| 127 | * Usage: How to deploy SRS on ARM?([CN][v1_CN_SampleARM], [EN][v1_EN_SampleARM]) | 127 | * Usage: How to deploy SRS on ARM?([CN][v1_CN_SampleARM], [EN][v1_EN_SampleARM]) |
| 128 | * Usage: How to ingest file/stream/device to SRS?([CN][v1_CN_SampleIngest], [EN][v1_EN_SampleIngest]) | 128 | * Usage: How to ingest file/stream/device to SRS?([CN][v1_CN_SampleIngest], [EN][v1_EN_SampleIngest]) |
| 129 | * Usage: How to use SRS-HTTP-server to delivery HTTP/HLS stream?([CN][v2_CN_SampleHTTP], [EN][v2_EN_SampleHTTP]) | 129 | * Usage: How to use SRS-HTTP-server to delivery HTTP/HLS stream?([CN][v2_CN_SampleHTTP], [EN][v2_EN_SampleHTTP]) |
| 130 | -* Usage: How to show the demo of [CN][v1_CN_SampleDemo], [EN][v1_EN_SampleDemo]) | 130 | +* Usage: How to show the demo of ([CN][v1_CN_SampleDemo], [EN][v1_EN_SampleDemo]) |
| 131 | * Usage: How to publish h.264 raw stream to [CN][v2_CN_SrsLibrtmp2], [EN][v2_EN_SrsLibrtmp2]) | 131 | * Usage: How to publish h.264 raw stream to [CN][v2_CN_SrsLibrtmp2], [EN][v2_EN_SrsLibrtmp2]) |
| 132 | * Usage: Solution using SRS?([CN][v1_CN_Sample], [EN][v1_EN_Sample]) | 132 | * Usage: Solution using SRS?([CN][v1_CN_Sample], [EN][v1_EN_Sample]) |
| 133 | * Usage: Why SRS?([CN][v1_CN_Product], [EN][v1_EN_Product]) | 133 | * Usage: Why SRS?([CN][v1_CN_Product], [EN][v1_EN_Product]) |
| @@ -76,10 +76,10 @@ fi | @@ -76,10 +76,10 @@ fi | ||
| 76 | echo "" >> $SRS_AUTO_HEADERS_H | 76 | echo "" >> $SRS_AUTO_HEADERS_H |
| 77 | 77 | ||
| 78 | # auto headers in depends. | 78 | # auto headers in depends. |
| 79 | -if [ $SRS_HTTP_PARSER = YES ]; then | ||
| 80 | - echo "#define SRS_AUTO_HTTP_PARSER" >> $SRS_AUTO_HEADERS_H | 79 | +if [ $SRS_HTTP_CORE = YES ]; then |
| 80 | + echo "#define SRS_AUTO_HTTP_CORE" >> $SRS_AUTO_HEADERS_H | ||
| 81 | else | 81 | else |
| 82 | - echo "#undef SRS_AUTO_HTTP_PARSER" >> $SRS_AUTO_HEADERS_H | 82 | + echo "#undef SRS_AUTO_HTTP_CORE" >> $SRS_AUTO_HEADERS_H |
| 83 | fi | 83 | fi |
| 84 | 84 | ||
| 85 | if [ $SRS_HTTP_SERVER = YES ]; then | 85 | if [ $SRS_HTTP_SERVER = YES ]; then |
| @@ -426,7 +426,7 @@ fi | @@ -426,7 +426,7 @@ fi | ||
| 426 | # http-parser-2.1 | 426 | # http-parser-2.1 |
| 427 | ##################################################################################### | 427 | ##################################################################################### |
| 428 | # check the arm flag file, if flag changed, need to rebuild the st. | 428 | # check the arm flag file, if flag changed, need to rebuild the st. |
| 429 | -if [ $SRS_HTTP_PARSER = YES ]; then | 429 | +if [ $SRS_HTTP_CORE = YES ]; then |
| 430 | # ok, arm specified, if the flag filed does not exists, need to rebuild. | 430 | # ok, arm specified, if the flag filed does not exists, need to rebuild. |
| 431 | if [ $SRS_EMBEDED_CPU = YES ]; then | 431 | if [ $SRS_EMBEDED_CPU = YES ]; then |
| 432 | if [[ -f ${SRS_OBJS}/_flag.st.hp.tmp && -f ${SRS_OBJS}/hp/http_parser.h && -f ${SRS_OBJS}/hp/libhttp_parser.a ]]; then | 432 | if [[ -f ${SRS_OBJS}/_flag.st.hp.tmp && -f ${SRS_OBJS}/hp/http_parser.h && -f ${SRS_OBJS}/hp/libhttp_parser.a ]]; then |
| @@ -45,7 +45,7 @@ SRS_GPROF=RESERVED | @@ -45,7 +45,7 @@ SRS_GPROF=RESERVED | ||
| 45 | ################################################################ | 45 | ################################################################ |
| 46 | # libraries | 46 | # libraries |
| 47 | SRS_FFMPEG_STUB=RESERVED | 47 | SRS_FFMPEG_STUB=RESERVED |
| 48 | -SRS_HTTP_PARSER=RESERVED | 48 | +SRS_HTTP_CORE=RESERVED |
| 49 | # arguments | 49 | # arguments |
| 50 | SRS_PREFIX=/usr/local/srs | 50 | SRS_PREFIX=/usr/local/srs |
| 51 | SRS_JOBS=1 | 51 | SRS_JOBS=1 |
| @@ -376,7 +376,7 @@ function apply_user_presets() { | @@ -376,7 +376,7 @@ function apply_user_presets() { | ||
| 376 | SRS_TRANSCODE=NO | 376 | SRS_TRANSCODE=NO |
| 377 | SRS_INGEST=NO | 377 | SRS_INGEST=NO |
| 378 | SRS_STAT=NO | 378 | SRS_STAT=NO |
| 379 | - SRS_HTTP_PARSER=NO | 379 | + SRS_HTTP_CORE=NO |
| 380 | SRS_HTTP_CALLBACK=NO | 380 | SRS_HTTP_CALLBACK=NO |
| 381 | SRS_HTTP_SERVER=NO | 381 | SRS_HTTP_SERVER=NO |
| 382 | SRS_STREAM_CASTER=NO | 382 | SRS_STREAM_CASTER=NO |
| @@ -403,7 +403,7 @@ function apply_user_presets() { | @@ -403,7 +403,7 @@ function apply_user_presets() { | ||
| 403 | SRS_TRANSCODE=YES | 403 | SRS_TRANSCODE=YES |
| 404 | SRS_INGEST=YES | 404 | SRS_INGEST=YES |
| 405 | SRS_STAT=YES | 405 | SRS_STAT=YES |
| 406 | - SRS_HTTP_PARSER=YES | 406 | + SRS_HTTP_CORE=YES |
| 407 | SRS_HTTP_CALLBACK=YES | 407 | SRS_HTTP_CALLBACK=YES |
| 408 | SRS_HTTP_SERVER=YES | 408 | SRS_HTTP_SERVER=YES |
| 409 | SRS_STREAM_CASTER=YES | 409 | SRS_STREAM_CASTER=YES |
| @@ -430,7 +430,7 @@ function apply_user_presets() { | @@ -430,7 +430,7 @@ function apply_user_presets() { | ||
| 430 | SRS_TRANSCODE=NO | 430 | SRS_TRANSCODE=NO |
| 431 | SRS_INGEST=NO | 431 | SRS_INGEST=NO |
| 432 | SRS_STAT=NO | 432 | SRS_STAT=NO |
| 433 | - SRS_HTTP_PARSER=NO | 433 | + SRS_HTTP_CORE=NO |
| 434 | SRS_HTTP_CALLBACK=NO | 434 | SRS_HTTP_CALLBACK=NO |
| 435 | SRS_HTTP_SERVER=NO | 435 | SRS_HTTP_SERVER=NO |
| 436 | SRS_STREAM_CASTER=NO | 436 | SRS_STREAM_CASTER=NO |
| @@ -457,7 +457,7 @@ function apply_user_presets() { | @@ -457,7 +457,7 @@ function apply_user_presets() { | ||
| 457 | SRS_TRANSCODE=NO | 457 | SRS_TRANSCODE=NO |
| 458 | SRS_INGEST=NO | 458 | SRS_INGEST=NO |
| 459 | SRS_STAT=NO | 459 | SRS_STAT=NO |
| 460 | - SRS_HTTP_PARSER=NO | 460 | + SRS_HTTP_CORE=NO |
| 461 | SRS_HTTP_CALLBACK=NO | 461 | SRS_HTTP_CALLBACK=NO |
| 462 | SRS_HTTP_SERVER=NO | 462 | SRS_HTTP_SERVER=NO |
| 463 | SRS_STREAM_CASTER=NO | 463 | SRS_STREAM_CASTER=NO |
| @@ -484,7 +484,7 @@ function apply_user_presets() { | @@ -484,7 +484,7 @@ function apply_user_presets() { | ||
| 484 | SRS_TRANSCODE=NO | 484 | SRS_TRANSCODE=NO |
| 485 | SRS_INGEST=NO | 485 | SRS_INGEST=NO |
| 486 | SRS_STAT=NO | 486 | SRS_STAT=NO |
| 487 | - SRS_HTTP_PARSER=NO | 487 | + SRS_HTTP_CORE=NO |
| 488 | SRS_HTTP_CALLBACK=NO | 488 | SRS_HTTP_CALLBACK=NO |
| 489 | SRS_HTTP_SERVER=NO | 489 | SRS_HTTP_SERVER=NO |
| 490 | SRS_STREAM_CASTER=NO | 490 | SRS_STREAM_CASTER=NO |
| @@ -511,7 +511,7 @@ function apply_user_presets() { | @@ -511,7 +511,7 @@ function apply_user_presets() { | ||
| 511 | SRS_TRANSCODE=YES | 511 | SRS_TRANSCODE=YES |
| 512 | SRS_INGEST=YES | 512 | SRS_INGEST=YES |
| 513 | SRS_STAT=YES | 513 | SRS_STAT=YES |
| 514 | - SRS_HTTP_PARSER=YES | 514 | + SRS_HTTP_CORE=YES |
| 515 | SRS_HTTP_CALLBACK=YES | 515 | SRS_HTTP_CALLBACK=YES |
| 516 | SRS_HTTP_SERVER=YES | 516 | SRS_HTTP_SERVER=YES |
| 517 | SRS_STREAM_CASTER=NO | 517 | SRS_STREAM_CASTER=NO |
| @@ -539,7 +539,7 @@ function apply_user_presets() { | @@ -539,7 +539,7 @@ function apply_user_presets() { | ||
| 539 | SRS_TRANSCODE=YES | 539 | SRS_TRANSCODE=YES |
| 540 | SRS_INGEST=YES | 540 | SRS_INGEST=YES |
| 541 | SRS_STAT=YES | 541 | SRS_STAT=YES |
| 542 | - SRS_HTTP_PARSER=YES | 542 | + SRS_HTTP_CORE=YES |
| 543 | SRS_HTTP_CALLBACK=YES | 543 | SRS_HTTP_CALLBACK=YES |
| 544 | SRS_HTTP_SERVER=YES | 544 | SRS_HTTP_SERVER=YES |
| 545 | SRS_STREAM_CASTER=NO | 545 | SRS_STREAM_CASTER=NO |
| @@ -566,7 +566,7 @@ function apply_user_presets() { | @@ -566,7 +566,7 @@ function apply_user_presets() { | ||
| 566 | SRS_TRANSCODE=YES | 566 | SRS_TRANSCODE=YES |
| 567 | SRS_INGEST=YES | 567 | SRS_INGEST=YES |
| 568 | SRS_STAT=YES | 568 | SRS_STAT=YES |
| 569 | - SRS_HTTP_PARSER=YES | 569 | + SRS_HTTP_CORE=YES |
| 570 | SRS_HTTP_CALLBACK=YES | 570 | SRS_HTTP_CALLBACK=YES |
| 571 | SRS_HTTP_SERVER=YES | 571 | SRS_HTTP_SERVER=YES |
| 572 | SRS_STREAM_CASTER=NO | 572 | SRS_STREAM_CASTER=NO |
| @@ -593,7 +593,7 @@ function apply_user_presets() { | @@ -593,7 +593,7 @@ function apply_user_presets() { | ||
| 593 | SRS_TRANSCODE=YES | 593 | SRS_TRANSCODE=YES |
| 594 | SRS_INGEST=YES | 594 | SRS_INGEST=YES |
| 595 | SRS_STAT=YES | 595 | SRS_STAT=YES |
| 596 | - SRS_HTTP_PARSER=YES | 596 | + SRS_HTTP_CORE=YES |
| 597 | SRS_HTTP_CALLBACK=YES | 597 | SRS_HTTP_CALLBACK=YES |
| 598 | SRS_HTTP_SERVER=YES | 598 | SRS_HTTP_SERVER=YES |
| 599 | SRS_STREAM_CASTER=NO | 599 | SRS_STREAM_CASTER=NO |
| @@ -620,7 +620,7 @@ function apply_user_presets() { | @@ -620,7 +620,7 @@ function apply_user_presets() { | ||
| 620 | SRS_TRANSCODE=YES | 620 | SRS_TRANSCODE=YES |
| 621 | SRS_INGEST=YES | 621 | SRS_INGEST=YES |
| 622 | SRS_STAT=YES | 622 | SRS_STAT=YES |
| 623 | - SRS_HTTP_PARSER=YES | 623 | + SRS_HTTP_CORE=YES |
| 624 | SRS_HTTP_CALLBACK=YES | 624 | SRS_HTTP_CALLBACK=YES |
| 625 | SRS_HTTP_SERVER=YES | 625 | SRS_HTTP_SERVER=YES |
| 626 | SRS_STREAM_CASTER=NO | 626 | SRS_STREAM_CASTER=NO |
| @@ -647,7 +647,7 @@ function apply_user_presets() { | @@ -647,7 +647,7 @@ function apply_user_presets() { | ||
| 647 | SRS_TRANSCODE=YES | 647 | SRS_TRANSCODE=YES |
| 648 | SRS_INGEST=YES | 648 | SRS_INGEST=YES |
| 649 | SRS_STAT=YES | 649 | SRS_STAT=YES |
| 650 | - SRS_HTTP_PARSER=YES | 650 | + SRS_HTTP_CORE=YES |
| 651 | SRS_HTTP_CALLBACK=YES | 651 | SRS_HTTP_CALLBACK=YES |
| 652 | SRS_HTTP_SERVER=YES | 652 | SRS_HTTP_SERVER=YES |
| 653 | SRS_STREAM_CASTER=NO | 653 | SRS_STREAM_CASTER=NO |
| @@ -674,7 +674,7 @@ function apply_user_presets() { | @@ -674,7 +674,7 @@ function apply_user_presets() { | ||
| 674 | SRS_TRANSCODE=YES | 674 | SRS_TRANSCODE=YES |
| 675 | SRS_INGEST=YES | 675 | SRS_INGEST=YES |
| 676 | SRS_STAT=YES | 676 | SRS_STAT=YES |
| 677 | - SRS_HTTP_PARSER=YES | 677 | + SRS_HTTP_CORE=YES |
| 678 | SRS_HTTP_CALLBACK=YES | 678 | SRS_HTTP_CALLBACK=YES |
| 679 | SRS_HTTP_SERVER=YES | 679 | SRS_HTTP_SERVER=YES |
| 680 | SRS_STREAM_CASTER=NO | 680 | SRS_STREAM_CASTER=NO |
| @@ -701,7 +701,7 @@ function apply_user_presets() { | @@ -701,7 +701,7 @@ function apply_user_presets() { | ||
| 701 | SRS_TRANSCODE=YES | 701 | SRS_TRANSCODE=YES |
| 702 | SRS_INGEST=YES | 702 | SRS_INGEST=YES |
| 703 | SRS_STAT=YES | 703 | SRS_STAT=YES |
| 704 | - SRS_HTTP_PARSER=YES | 704 | + SRS_HTTP_CORE=YES |
| 705 | SRS_HTTP_CALLBACK=YES | 705 | SRS_HTTP_CALLBACK=YES |
| 706 | SRS_HTTP_SERVER=YES | 706 | SRS_HTTP_SERVER=YES |
| 707 | SRS_STREAM_CASTER=NO | 707 | SRS_STREAM_CASTER=NO |
| @@ -728,7 +728,7 @@ function apply_user_presets() { | @@ -728,7 +728,7 @@ function apply_user_presets() { | ||
| 728 | SRS_TRANSCODE=YES | 728 | SRS_TRANSCODE=YES |
| 729 | SRS_INGEST=YES | 729 | SRS_INGEST=YES |
| 730 | SRS_STAT=YES | 730 | SRS_STAT=YES |
| 731 | - SRS_HTTP_PARSER=YES | 731 | + SRS_HTTP_CORE=YES |
| 732 | SRS_HTTP_CALLBACK=YES | 732 | SRS_HTTP_CALLBACK=YES |
| 733 | SRS_HTTP_SERVER=YES | 733 | SRS_HTTP_SERVER=YES |
| 734 | SRS_STREAM_CASTER=NO | 734 | SRS_STREAM_CASTER=NO |
| @@ -761,11 +761,11 @@ function apply_user_detail_options() { | @@ -761,11 +761,11 @@ function apply_user_detail_options() { | ||
| 761 | if [ $SRS_TRANSCODE = YES ]; then SRS_FFMPEG_STUB=YES; fi | 761 | if [ $SRS_TRANSCODE = YES ]; then SRS_FFMPEG_STUB=YES; fi |
| 762 | if [ $SRS_INGEST = YES ]; then SRS_FFMPEG_STUB=YES; fi | 762 | if [ $SRS_INGEST = YES ]; then SRS_FFMPEG_STUB=YES; fi |
| 763 | 763 | ||
| 764 | - # if http-xxxx specified, open the SRS_HTTP_PARSER | ||
| 765 | - SRS_HTTP_PARSER=NO | ||
| 766 | - if [ $SRS_HTTP_CALLBACK = YES ]; then SRS_HTTP_PARSER=YES; fi | ||
| 767 | - if [ $SRS_HTTP_SERVER = YES ]; then SRS_HTTP_PARSER=YES; fi | ||
| 768 | - if [ $SRS_HTTP_API = YES ]; then SRS_HTTP_PARSER=YES; fi | 764 | + # if http-xxxx specified, open the SRS_HTTP_CORE |
| 765 | + SRS_HTTP_CORE=NO | ||
| 766 | + if [ $SRS_HTTP_CALLBACK = YES ]; then SRS_HTTP_CORE=YES; fi | ||
| 767 | + if [ $SRS_HTTP_SERVER = YES ]; then SRS_HTTP_CORE=YES; fi | ||
| 768 | + if [ $SRS_HTTP_API = YES ]; then SRS_HTTP_CORE=YES; fi | ||
| 769 | 769 | ||
| 770 | # parse the jobs for make | 770 | # parse the jobs for make |
| 771 | if [[ "" -eq SRS_JOBS ]]; then | 771 | if [[ "" -eq SRS_JOBS ]]; then |
| @@ -790,7 +790,7 @@ function apply_user_detail_options() { | @@ -790,7 +790,7 @@ function apply_user_detail_options() { | ||
| 790 | SRS_TRANSCODE=NO | 790 | SRS_TRANSCODE=NO |
| 791 | SRS_INGEST=NO | 791 | SRS_INGEST=NO |
| 792 | SRS_STAT=NO | 792 | SRS_STAT=NO |
| 793 | - SRS_HTTP_PARSER=NO | 793 | + SRS_HTTP_CORE=NO |
| 794 | SRS_HTTP_CALLBACK=NO | 794 | SRS_HTTP_CALLBACK=NO |
| 795 | SRS_HTTP_SERVER=NO | 795 | SRS_HTTP_SERVER=NO |
| 796 | SRS_STREAM_CASTER=NO | 796 | SRS_STREAM_CASTER=NO |
| @@ -855,13 +855,14 @@ function check_option_conflicts() { | @@ -855,13 +855,14 @@ function check_option_conflicts() { | ||
| 855 | if [ $SRS_GPERF_MP = YES ]; then echo "gperf-mp depends on gperf, see: ./configure --help"; __check_ok=NO; fi | 855 | if [ $SRS_GPERF_MP = YES ]; then echo "gperf-mp depends on gperf, see: ./configure --help"; __check_ok=NO; fi |
| 856 | if [ $SRS_GPERF_CP = YES ]; then echo "gperf-cp depends on gperf, see: ./configure --help"; __check_ok=NO; fi | 856 | if [ $SRS_GPERF_CP = YES ]; then echo "gperf-cp depends on gperf, see: ./configure --help"; __check_ok=NO; fi |
| 857 | fi | 857 | fi |
| 858 | - if [ $SRS_GPERF_MC = YES ]; then | ||
| 859 | - if [ $SRS_GPERF_MP = YES ]; then | 858 | + if [[ $SRS_GPERF_MC = YES && $SRS_GPERF_MP = YES ]]; then |
| 860 | echo "gperf-mc not compatible with gperf-mp, see: ./configure --help"; | 859 | echo "gperf-mc not compatible with gperf-mp, see: ./configure --help"; |
| 861 | echo "@see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html"; | 860 | echo "@see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html"; |
| 862 | echo "Note that since the heap-checker uses the heap-profiling framework internally, it is not possible to run both the heap-checker and heap profiler at the same time"; | 861 | echo "Note that since the heap-checker uses the heap-profiling framework internally, it is not possible to run both the heap-checker and heap profiler at the same time"; |
| 863 | __check_ok=NO | 862 | __check_ok=NO |
| 864 | fi | 863 | fi |
| 864 | + if [[ $SRS_HTTP_CORE = NO && $SRS_STREAM_CASTER = YES ]]; then | ||
| 865 | + echo "stream-caster depends on http-api or http-server, see: ./configure --help"; __check_ok=NO; | ||
| 865 | fi | 866 | fi |
| 866 | # generate the group option: SRS_GPERF | 867 | # generate the group option: SRS_GPERF |
| 867 | __gperf_slow=NO | 868 | __gperf_slow=NO |
| @@ -885,11 +886,9 @@ function check_option_conflicts() { | @@ -885,11 +886,9 @@ function check_option_conflicts() { | ||
| 885 | fi | 886 | fi |
| 886 | 887 | ||
| 887 | # if x86/x64 or directly build, never use static | 888 | # if x86/x64 or directly build, never use static |
| 888 | - if [ $SRS_X86_X64 = YES ]; then | ||
| 889 | - if [ $SRS_STATIC = YES ]; then | 889 | + if [[ $SRS_X86_X64 = YES && $SRS_STATIC = YES ]]; then |
| 890 | echo "x86/x64 should never use static, see: ./configure --help"; __check_ok=NO; | 890 | echo "x86/x64 should never use static, see: ./configure --help"; __check_ok=NO; |
| 891 | fi | 891 | fi |
| 892 | - fi | ||
| 893 | 892 | ||
| 894 | # TODO: FIXME: check more os. | 893 | # TODO: FIXME: check more os. |
| 895 | 894 |
| @@ -115,7 +115,7 @@ END | @@ -115,7 +115,7 @@ END | ||
| 115 | LibSTRoot="${SRS_OBJS_DIR}/st"; LibSTfile="${LibSTRoot}/libst.a" | 115 | LibSTRoot="${SRS_OBJS_DIR}/st"; LibSTfile="${LibSTRoot}/libst.a" |
| 116 | # hp(http-parser) the http request/url parser, for SRS to support HTTP callback. | 116 | # hp(http-parser) the http request/url parser, for SRS to support HTTP callback. |
| 117 | LibHttpParserRoot=""; LibHttpParserfile="" | 117 | LibHttpParserRoot=""; LibHttpParserfile="" |
| 118 | -if [ $SRS_HTTP_PARSER = YES ]; then LibHttpParserRoot="${SRS_OBJS_DIR}/hp"; LibHttpParserfile="${LibHttpParserRoot}/libhttp_parser.a"; fi | 118 | +if [ $SRS_HTTP_CORE = YES ]; then LibHttpParserRoot="${SRS_OBJS_DIR}/hp"; LibHttpParserfile="${LibHttpParserRoot}/libhttp_parser.a"; fi |
| 119 | # openssl-1.0.1f, for the RTMP complex handshake. | 119 | # openssl-1.0.1f, for the RTMP complex handshake. |
| 120 | LibSSLRoot="";LibSSLfile="" | 120 | LibSSLRoot="";LibSSLfile="" |
| 121 | if [ $SRS_SSL = YES ]; then if [ $SRS_USE_SYS_SSL = NO ]; then LibSSLRoot="${SRS_OBJS_DIR}/openssl/include"; LibSSLfile="${SRS_OBJS_DIR}/openssl/lib/libssl.a ${SRS_OBJS_DIR}/openssl/lib/libcrypto.a"; fi fi | 121 | if [ $SRS_SSL = YES ]; then if [ $SRS_USE_SYS_SSL = NO ]; then LibSSLRoot="${SRS_OBJS_DIR}/openssl/include"; LibSSLfile="${SRS_OBJS_DIR}/openssl/lib/libssl.a ${SRS_OBJS_DIR}/openssl/lib/libcrypto.a"; fi fi |
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | 2 | ||
| 3 | -bash scripts/test_configure.sh && ./objs/srs_utest | 3 | +echo "Usage: $0 [-jN]" |
| 4 | +echo " -jN The make jobs, for example, -j8 to use 8cpu to make" | ||
| 5 | + | ||
| 6 | +params="$@" | ||
| 7 | +echo "params is: $params" | ||
| 8 | + | ||
| 9 | +bash scripts/test_configure.sh $params && ./objs/srs_utest | ||
| 4 | ret=$?; if [[ 0 -ne $ret ]]; then echo "configure test and utest failed."; exit $ret; fi | 10 | ret=$?; if [[ 0 -ne $ret ]]; then echo "configure test and utest failed."; exit $ret; fi |
| 5 | echo "configure test and utest success"; | 11 | echo "configure test and utest success"; |
| 12 | + |
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | 2 | ||
| 3 | +params="$@" | ||
| 4 | +echo "params is: $params" | ||
| 5 | + | ||
| 3 | # discover the current work dir, the log and access. | 6 | # discover the current work dir, the log and access. |
| 4 | echo "argv[0]=$0" | 7 | echo "argv[0]=$0" |
| 5 | if [[ ! -f $0 ]]; then | 8 | if [[ ! -f $0 ]]; then |
| @@ -19,175 +22,181 @@ ret=$?; if [[ $ret -ne 0 ]]; then exit $ret; fi | @@ -19,175 +22,181 @@ ret=$?; if [[ $ret -ne 0 ]]; then exit $ret; fi | ||
| 19 | 22 | ||
| 20 | item="./configure" | 23 | item="./configure" |
| 21 | ok_msg "test \" ${item} \"" | 24 | ok_msg "test \" ${item} \"" |
| 22 | -(./configure && make) >>$log 2>&1 | 25 | +($item && make $params) >>$log 2>&1 |
| 23 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 26 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 24 | ok_msg "test \" ${item} \" success" | 27 | ok_msg "test \" ${item} \" success" |
| 25 | 28 | ||
| 26 | item="./configure --x86-x64" | 29 | item="./configure --x86-x64" |
| 27 | ok_msg "test \" ${item} \"" | 30 | ok_msg "test \" ${item} \"" |
| 28 | -(./configure --x86-x64 && make) >>$log 2>&1 | 31 | +($item && make $params) >>$log 2>&1 |
| 29 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 32 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 30 | ok_msg "test \" ${item} \" success" | 33 | ok_msg "test \" ${item} \" success" |
| 31 | 34 | ||
| 32 | item="./configure --disable-all" | 35 | item="./configure --disable-all" |
| 33 | ok_msg "test \" ${item} \"" | 36 | ok_msg "test \" ${item} \"" |
| 34 | -(./configure --disable-all && make) >>$log 2>&1 | 37 | +($item && make $params) >>$log 2>&1 |
| 35 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 38 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 36 | ok_msg "test \" ${item} \" success" | 39 | ok_msg "test \" ${item} \" success" |
| 37 | 40 | ||
| 38 | item="./configure --fast" | 41 | item="./configure --fast" |
| 39 | ok_msg "test \" ${item} \"" | 42 | ok_msg "test \" ${item} \"" |
| 40 | -(./configure --fast && make) >>$log 2>&1 | 43 | +($item && make $params) >>$log 2>&1 |
| 41 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 44 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 42 | ok_msg "test \" ${item} \" success" | 45 | ok_msg "test \" ${item} \" success" |
| 43 | 46 | ||
| 44 | item="./configure --pure-rtmp" | 47 | item="./configure --pure-rtmp" |
| 45 | ok_msg "test \" ${item} \"" | 48 | ok_msg "test \" ${item} \"" |
| 46 | -(./configure --pure-rtmp && make) >>$log 2>&1 | 49 | +($item && make $params) >>$log 2>&1 |
| 47 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 50 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 48 | ok_msg "test \" ${item} \" success" | 51 | ok_msg "test \" ${item} \" success" |
| 49 | 52 | ||
| 50 | item="./configure --rtmp-hls" | 53 | item="./configure --rtmp-hls" |
| 51 | ok_msg "test \" ${item} \"" | 54 | ok_msg "test \" ${item} \"" |
| 52 | -(./configure --rtmp-hls && make) >>$log 2>&1 | 55 | +($item && make $params) >>$log 2>&1 |
| 53 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 56 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 54 | ok_msg "test \" ${item} \" success" | 57 | ok_msg "test \" ${item} \" success" |
| 55 | 58 | ||
| 56 | item="./configure --fast --with-ssl" | 59 | item="./configure --fast --with-ssl" |
| 57 | ok_msg "test \" ${item} \"" | 60 | ok_msg "test \" ${item} \"" |
| 58 | -(./configure --fast --with-ssl && make) >>$log 2>&1 | 61 | +($item && make $params) >>$log 2>&1 |
| 59 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 62 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 60 | ok_msg "test \" ${item} \" success" | 63 | ok_msg "test \" ${item} \" success" |
| 61 | 64 | ||
| 62 | item="./configure --fast --with-hls" | 65 | item="./configure --fast --with-hls" |
| 63 | ok_msg "test \" ${item} \"" | 66 | ok_msg "test \" ${item} \"" |
| 64 | -(./configure --fast --with-hls && make) >>$log 2>&1 | 67 | +($item && make $params) >>$log 2>&1 |
| 65 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 68 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 66 | ok_msg "test \" ${item} \" success" | 69 | ok_msg "test \" ${item} \" success" |
| 67 | 70 | ||
| 68 | item="./configure --fast --with-dvr" | 71 | item="./configure --fast --with-dvr" |
| 69 | ok_msg "test \" ${item} \"" | 72 | ok_msg "test \" ${item} \"" |
| 70 | -(./configure --fast --with-dvr && make) >>$log 2>&1 | 73 | +($item && make $params) >>$log 2>&1 |
| 71 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 74 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 72 | ok_msg "test \" ${item} \" success" | 75 | ok_msg "test \" ${item} \" success" |
| 73 | 76 | ||
| 74 | item="./configure --fast --with-nginx" | 77 | item="./configure --fast --with-nginx" |
| 75 | ok_msg "test \" ${item} \"" | 78 | ok_msg "test \" ${item} \"" |
| 76 | -(./configure --fast --with-nginx && make) >>$log 2>&1 | 79 | +($item && make $params) >>$log 2>&1 |
| 77 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 80 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 78 | ok_msg "test \" ${item} \" success" | 81 | ok_msg "test \" ${item} \" success" |
| 79 | 82 | ||
| 80 | item="./configure --fast --with-http-callback" | 83 | item="./configure --fast --with-http-callback" |
| 81 | ok_msg "test \" ${item} \"" | 84 | ok_msg "test \" ${item} \"" |
| 82 | -(./configure --fast --with-http-callback && make) >>$log 2>&1 | 85 | +($item && make $params) >>$log 2>&1 |
| 83 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 86 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 84 | ok_msg "test \" ${item} \" success" | 87 | ok_msg "test \" ${item} \" success" |
| 85 | 88 | ||
| 86 | item="./configure --fast --with-http-server" | 89 | item="./configure --fast --with-http-server" |
| 87 | ok_msg "test \" ${item} \"" | 90 | ok_msg "test \" ${item} \"" |
| 88 | -(./configure --fast --with-http-server && make) >>$log 2>&1 | 91 | +($item && make $params) >>$log 2>&1 |
| 89 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 92 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 90 | ok_msg "test \" ${item} \" success" | 93 | ok_msg "test \" ${item} \" success" |
| 91 | 94 | ||
| 92 | item="./configure --fast --with-http-api" | 95 | item="./configure --fast --with-http-api" |
| 93 | ok_msg "test \" ${item} \"" | 96 | ok_msg "test \" ${item} \"" |
| 94 | -(./configure --fast --with-http-api && make) >>$log 2>&1 | 97 | +($item && make $params) >>$log 2>&1 |
| 95 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 98 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 96 | ok_msg "test \" ${item} \" success" | 99 | ok_msg "test \" ${item} \" success" |
| 97 | 100 | ||
| 98 | item="./configure --fast --with-ffmpeg" | 101 | item="./configure --fast --with-ffmpeg" |
| 99 | ok_msg "test \" ${item} \"" | 102 | ok_msg "test \" ${item} \"" |
| 100 | -(./configure --fast --with-ffmpeg && make) >>$log 2>&1 | 103 | +($item && make $params) >>$log 2>&1 |
| 101 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 104 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 102 | ok_msg "test \" ${item} \" success" | 105 | ok_msg "test \" ${item} \" success" |
| 103 | 106 | ||
| 104 | item="./configure --fast --with-transcode" | 107 | item="./configure --fast --with-transcode" |
| 105 | ok_msg "test \" ${item} \"" | 108 | ok_msg "test \" ${item} \"" |
| 106 | -(./configure --fast --with-transcode && make) >>$log 2>&1 | 109 | +($item && make $params) >>$log 2>&1 |
| 107 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 110 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 108 | ok_msg "test \" ${item} \" success" | 111 | ok_msg "test \" ${item} \" success" |
| 109 | 112 | ||
| 110 | item="./configure --fast --with-ingest" | 113 | item="./configure --fast --with-ingest" |
| 111 | ok_msg "test \" ${item} \"" | 114 | ok_msg "test \" ${item} \"" |
| 112 | -(./configure --fast --with-ingest && make) >>$log 2>&1 | 115 | +($item && make $params) >>$log 2>&1 |
| 113 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 116 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 114 | ok_msg "test \" ${item} \" success" | 117 | ok_msg "test \" ${item} \" success" |
| 115 | 118 | ||
| 116 | item="./configure --fast --with-librtmp" | 119 | item="./configure --fast --with-librtmp" |
| 117 | ok_msg "test \" ${item} \"" | 120 | ok_msg "test \" ${item} \"" |
| 118 | -(./configure --fast --with-librtmp && make) >>$log 2>&1 | 121 | +($item && make $params) >>$log 2>&1 |
| 119 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 122 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 120 | ok_msg "test \" ${item} \" success" | 123 | ok_msg "test \" ${item} \" success" |
| 121 | 124 | ||
| 122 | item="./configure --fast --with-research" | 125 | item="./configure --fast --with-research" |
| 123 | ok_msg "test \" ${item} \"" | 126 | ok_msg "test \" ${item} \"" |
| 124 | -(./configure --fast --with-research && make) >>$log 2>&1 | 127 | +($item && make $params) >>$log 2>&1 |
| 128 | +ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | ||
| 129 | +ok_msg "test \" ${item} \" success" | ||
| 130 | + | ||
| 131 | +item="./configure --fast --with-stream-caster --with-http-api" | ||
| 132 | +ok_msg "test \" ${item} \"" | ||
| 133 | +($item && make $params) >>$log 2>&1 | ||
| 125 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 134 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 126 | ok_msg "test \" ${item} \" success" | 135 | ok_msg "test \" ${item} \" success" |
| 127 | 136 | ||
| 128 | item="./configure --fast --with-utest" | 137 | item="./configure --fast --with-utest" |
| 129 | ok_msg "test \" ${item} \"" | 138 | ok_msg "test \" ${item} \"" |
| 130 | -(./configure --fast --with-utest && make) >>$log 2>&1 | 139 | +($item && make $params) >>$log 2>&1 |
| 131 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 140 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 132 | ok_msg "test \" ${item} \" success" | 141 | ok_msg "test \" ${item} \" success" |
| 133 | 142 | ||
| 134 | item="./configure --fast --with-ssl --with-utest" | 143 | item="./configure --fast --with-ssl --with-utest" |
| 135 | ok_msg "test \" ${item} \"" | 144 | ok_msg "test \" ${item} \"" |
| 136 | -(./configure --fast --with-ssl --with-utest && make) >>$log 2>&1 | 145 | +($item && make $params) >>$log 2>&1 |
| 137 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 146 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 138 | ok_msg "test \" ${item} \" success" | 147 | ok_msg "test \" ${item} \" success" |
| 139 | 148 | ||
| 140 | item="./configure --fast --with-gperf" | 149 | item="./configure --fast --with-gperf" |
| 141 | ok_msg "test \" ${item} \"" | 150 | ok_msg "test \" ${item} \"" |
| 142 | -(./configure --fast --with-gperf && make) >>$log 2>&1 | 151 | +($item && make $params) >>$log 2>&1 |
| 143 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 152 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 144 | ok_msg "test \" ${item} \" success" | 153 | ok_msg "test \" ${item} \" success" |
| 145 | 154 | ||
| 146 | item="./configure --fast --with-gperf --with-gmc" | 155 | item="./configure --fast --with-gperf --with-gmc" |
| 147 | ok_msg "test \" ${item} \"" | 156 | ok_msg "test \" ${item} \"" |
| 148 | -(./configure --fast --with-gperf --with-gmc && make) >>$log 2>&1 | 157 | +($item && make $params) >>$log 2>&1 |
| 149 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 158 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 150 | ok_msg "test \" ${item} \" success" | 159 | ok_msg "test \" ${item} \" success" |
| 151 | 160 | ||
| 152 | item="./configure --fast --with-gperf --with-gmp" | 161 | item="./configure --fast --with-gperf --with-gmp" |
| 153 | ok_msg "test \" ${item} \"" | 162 | ok_msg "test \" ${item} \"" |
| 154 | -(./configure --fast --with-gperf --with-gmp && make) >>$log 2>&1 | 163 | +($item && make $params) >>$log 2>&1 |
| 155 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 164 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 156 | ok_msg "test \" ${item} \" success" | 165 | ok_msg "test \" ${item} \" success" |
| 157 | 166 | ||
| 158 | item="./configure --fast --with-gperf --with-gcp" | 167 | item="./configure --fast --with-gperf --with-gcp" |
| 159 | ok_msg "test \" ${item} \"" | 168 | ok_msg "test \" ${item} \"" |
| 160 | -(./configure --fast --with-gperf --with-gcp && make) >>$log 2>&1 | 169 | +($item && make $params) >>$log 2>&1 |
| 161 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 170 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 162 | ok_msg "test \" ${item} \" success" | 171 | ok_msg "test \" ${item} \" success" |
| 163 | 172 | ||
| 164 | item="./configure --fast --with-gprof" | 173 | item="./configure --fast --with-gprof" |
| 165 | ok_msg "test \" ${item} \"" | 174 | ok_msg "test \" ${item} \"" |
| 166 | -(./configure --fast --with-gprof && make) >>$log 2>&1 | 175 | +($item && make $params) >>$log 2>&1 |
| 167 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 176 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 168 | ok_msg "test \" ${item} \" success" | 177 | ok_msg "test \" ${item} \" success" |
| 169 | 178 | ||
| 170 | item="./configure --fast --log-verbose" | 179 | item="./configure --fast --log-verbose" |
| 171 | ok_msg "test \" ${item} \"" | 180 | ok_msg "test \" ${item} \"" |
| 172 | -(./configure --fast --log-verbose && make) >>$log 2>&1 | 181 | +($item && make $params) >>$log 2>&1 |
| 173 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 182 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 174 | ok_msg "test \" ${item} \" success" | 183 | ok_msg "test \" ${item} \" success" |
| 175 | 184 | ||
| 176 | item="./configure --fast --log-info" | 185 | item="./configure --fast --log-info" |
| 177 | ok_msg "test \" ${item} \"" | 186 | ok_msg "test \" ${item} \"" |
| 178 | -(./configure --fast --log-info && make) >>$log 2>&1 | 187 | +($item && make $params) >>$log 2>&1 |
| 179 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 188 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 180 | ok_msg "test \" ${item} \" success" | 189 | ok_msg "test \" ${item} \" success" |
| 181 | 190 | ||
| 182 | item="./configure --fast --log-trace" | 191 | item="./configure --fast --log-trace" |
| 183 | ok_msg "test \" ${item} \"" | 192 | ok_msg "test \" ${item} \"" |
| 184 | -(./configure --fast --log-trace && make) >>$log 2>&1 | 193 | +($item && make $params) >>$log 2>&1 |
| 185 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 194 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 186 | ok_msg "test \" ${item} \" success" | 195 | ok_msg "test \" ${item} \" success" |
| 187 | 196 | ||
| 188 | item="./configure --fast --log-info --log-verbose --log-trace" | 197 | item="./configure --fast --log-info --log-verbose --log-trace" |
| 189 | ok_msg "test \" ${item} \"" | 198 | ok_msg "test \" ${item} \"" |
| 190 | -(./configure --fast --log-info --log-verbose --log-trace && make) >>$log 2>&1 | 199 | +($item && make $params) >>$log 2>&1 |
| 191 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 200 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 192 | ok_msg "test \" ${item} \" success" | 201 | ok_msg "test \" ${item} \" success" |
| 193 | 202 | ||
| @@ -196,25 +205,70 @@ ok_msg "test \" ${item} \" success" | @@ -196,25 +205,70 @@ ok_msg "test \" ${item} \" success" | ||
| 196 | ####################################################################################################### | 205 | ####################################################################################################### |
| 197 | item="./configure --dev" | 206 | item="./configure --dev" |
| 198 | ok_msg "test \" ${item} \"" | 207 | ok_msg "test \" ${item} \"" |
| 199 | -(./configure --dev && make) >>$log 2>&1 | 208 | +($item && make $params) >>$log 2>&1 |
| 200 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 209 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 201 | ok_msg "test \" ${item} \" success" | 210 | ok_msg "test \" ${item} \" success" |
| 202 | 211 | ||
| 203 | item="./configure --fast-dev" | 212 | item="./configure --fast-dev" |
| 204 | ok_msg "test \" ${item} \"" | 213 | ok_msg "test \" ${item} \"" |
| 205 | -(./configure --fast-dev && make) >>$log 2>&1 | 214 | +($item && make $params) >>$log 2>&1 |
| 206 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 215 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 207 | ok_msg "test \" ${item} \" success" | 216 | ok_msg "test \" ${item} \" success" |
| 208 | 217 | ||
| 209 | item="./configure --demo" | 218 | item="./configure --demo" |
| 210 | ok_msg "test \" ${item} \"" | 219 | ok_msg "test \" ${item} \"" |
| 211 | -(./configure --demo && make) >>$log 2>&1 | 220 | +($item && make $params) >>$log 2>&1 |
| 212 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 221 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 213 | ok_msg "test \" ${item} \" success" | 222 | ok_msg "test \" ${item} \" success" |
| 214 | 223 | ||
| 215 | item="./configure --full" | 224 | item="./configure --full" |
| 216 | ok_msg "test \" ${item} \"" | 225 | ok_msg "test \" ${item} \"" |
| 217 | -(./configure --full && make) >>$log 2>&1 | 226 | +($item && make $params) >>$log 2>&1 |
| 227 | +ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | ||
| 228 | +ok_msg "test \" ${item} \" success" | ||
| 229 | + | ||
| 230 | +####################################################################################################### | ||
| 231 | +####################################################################################################### | ||
| 232 | +####################################################################################################### | ||
| 233 | +item="./configure --disable-all --with-ssl" | ||
| 234 | +ok_msg "test \" ${item} \"" | ||
| 235 | +($item && make $params) >>$log 2>&1 | ||
| 236 | +ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | ||
| 237 | +ok_msg "test \" ${item} \" success" | ||
| 238 | + | ||
| 239 | +item="./configure --disable-all --with-hls --with-ssl --with-http-server --with-http-api" | ||
| 240 | +ok_msg "test \" ${item} \"" | ||
| 241 | +($item && make $params) >>$log 2>&1 | ||
| 242 | +ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | ||
| 243 | +ok_msg "test \" ${item} \" success" | ||
| 244 | + | ||
| 245 | +item="./configure --disable-all --with-ssl --with-hls --with-nginx" | ||
| 246 | +ok_msg "test \" ${item} \"" | ||
| 247 | +($item && make $params) >>$log 2>&1 | ||
| 248 | +ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | ||
| 249 | +ok_msg "test \" ${item} \" success" | ||
| 250 | + | ||
| 251 | +item="./configure --disable-all --with-ssl --with-hls --with-nginx --with-ffmpeg --with-transcode" | ||
| 252 | +ok_msg "test \" ${item} \"" | ||
| 253 | +($item && make $params) >>$log 2>&1 | ||
| 254 | +ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | ||
| 255 | +ok_msg "test \" ${item} \" success" | ||
| 256 | + | ||
| 257 | +item="./configure --disable-all --with-ssl --with-ffmpeg --with-transcode" | ||
| 258 | +ok_msg "test \" ${item} \"" | ||
| 259 | +($item && make $params) >>$log 2>&1 | ||
| 260 | +ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | ||
| 261 | +ok_msg "test \" ${item} \" success" | ||
| 262 | + | ||
| 263 | +item="./configure --disable-all --with-ssl --with-ffmpeg --with-ingest" | ||
| 264 | +ok_msg "test \" ${item} \"" | ||
| 265 | +($item && make $params) >>$log 2>&1 | ||
| 266 | +ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | ||
| 267 | +ok_msg "test \" ${item} \" success" | ||
| 268 | + | ||
| 269 | +item="./configure --disable-all --with-hls --with-ssl --with-http-server" | ||
| 270 | +ok_msg "test \" ${item} \"" | ||
| 271 | +($item && make $params) >>$log 2>&1 | ||
| 218 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi | 272 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi |
| 219 | ok_msg "test \" ${item} \" success" | 273 | ok_msg "test \" ${item} \" success" |
| 220 | 274 |
| @@ -33,7 +33,6 @@ using namespace std; | @@ -33,7 +33,6 @@ using namespace std; | ||
| 33 | #include <srs_kernel_log.hpp> | 33 | #include <srs_kernel_log.hpp> |
| 34 | #include <srs_app_config.hpp> | 34 | #include <srs_app_config.hpp> |
| 35 | #include <srs_app_pithy_print.hpp> | 35 | #include <srs_app_pithy_print.hpp> |
| 36 | -#include <srs_app_http.hpp> | ||
| 37 | #include <srs_app_http_conn.hpp> | 36 | #include <srs_app_http_conn.hpp> |
| 38 | #include <srs_core_autofree.hpp> | 37 | #include <srs_core_autofree.hpp> |
| 39 | #include <srs_kernel_flv.hpp> | 38 | #include <srs_kernel_flv.hpp> |
| @@ -89,9 +88,10 @@ void SrsAppCasterFlv::remove(SrsConnection* c) | @@ -89,9 +88,10 @@ void SrsAppCasterFlv::remove(SrsConnection* c) | ||
| 89 | } | 88 | } |
| 90 | } | 89 | } |
| 91 | 90 | ||
| 92 | -int SrsAppCasterFlv::serve_http(ISrsHttpResponseWriter* w, SrsHttpMessage* r) | 91 | +int SrsAppCasterFlv::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) |
| 93 | { | 92 | { |
| 94 | - SrsDynamicHttpConn* conn = dynamic_cast<SrsDynamicHttpConn*>(r->connection()); | 93 | + SrsHttpMessage* msg = dynamic_cast<SrsHttpMessage*>(r); |
| 94 | + SrsDynamicHttpConn* conn = dynamic_cast<SrsDynamicHttpConn*>(msg->connection()); | ||
| 95 | srs_assert(conn); | 95 | srs_assert(conn); |
| 96 | 96 | ||
| 97 | std::string app = srs_path_dirname(r->path()); | 97 | std::string app = srs_path_dirname(r->path()); |
| @@ -134,13 +134,13 @@ SrsDynamicHttpConn::~SrsDynamicHttpConn() | @@ -134,13 +134,13 @@ SrsDynamicHttpConn::~SrsDynamicHttpConn() | ||
| 134 | srs_freep(pprint); | 134 | srs_freep(pprint); |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | -int SrsDynamicHttpConn::on_got_http_message(SrsHttpMessage* msg) | 137 | +int SrsDynamicHttpConn::on_got_http_message(ISrsHttpMessage* msg) |
| 138 | { | 138 | { |
| 139 | int ret = ERROR_SUCCESS; | 139 | int ret = ERROR_SUCCESS; |
| 140 | return ret; | 140 | return ret; |
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | -int SrsDynamicHttpConn::proxy(ISrsHttpResponseWriter* w, SrsHttpMessage* r, std::string o) | 143 | +int SrsDynamicHttpConn::proxy(ISrsHttpResponseWriter* w, ISrsHttpMessage* r, std::string o) |
| 144 | { | 144 | { |
| 145 | int ret = ERROR_SUCCESS; | 145 | int ret = ERROR_SUCCESS; |
| 146 | 146 | ||
| @@ -430,7 +430,7 @@ int SrsHttpFileReader::read(void* buf, size_t count, ssize_t* pnread) | @@ -430,7 +430,7 @@ int SrsHttpFileReader::read(void* buf, size_t count, ssize_t* pnread) | ||
| 430 | } | 430 | } |
| 431 | 431 | ||
| 432 | int total_read = 0; | 432 | int total_read = 0; |
| 433 | - while (total_read < count) { | 433 | + while (total_read < (int)count) { |
| 434 | int nread = 0; | 434 | int nread = 0; |
| 435 | if ((ret = http->read((char*)buf + total_read, (int)(count - total_read), &nread)) != ERROR_SUCCESS) { | 435 | if ((ret = http->read((char*)buf + total_read, (int)(count - total_read), &nread)) != ERROR_SUCCESS) { |
| 436 | return ret; | 436 | return ret; |
| @@ -37,7 +37,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -37,7 +37,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 37 | 37 | ||
| 38 | class SrsConfDirective; | 38 | class SrsConfDirective; |
| 39 | class SrsHttpServeMux; | 39 | class SrsHttpServeMux; |
| 40 | -class SrsHttpConn; | ||
| 41 | class SrsRtmpClient; | 40 | class SrsRtmpClient; |
| 42 | class SrsStSocket; | 41 | class SrsStSocket; |
| 43 | class SrsRequest; | 42 | class SrsRequest; |
| @@ -48,7 +47,6 @@ class SrsFlvDecoder; | @@ -48,7 +47,6 @@ class SrsFlvDecoder; | ||
| 48 | #include <srs_app_st.hpp> | 47 | #include <srs_app_st.hpp> |
| 49 | #include <srs_app_listener.hpp> | 48 | #include <srs_app_listener.hpp> |
| 50 | #include <srs_app_conn.hpp> | 49 | #include <srs_app_conn.hpp> |
| 51 | -#include <srs_app_http.hpp> | ||
| 52 | #include <srs_app_http_conn.hpp> | 50 | #include <srs_app_http_conn.hpp> |
| 53 | #include <srs_kernel_file.hpp> | 51 | #include <srs_kernel_file.hpp> |
| 54 | 52 | ||
| @@ -75,7 +73,7 @@ public: | @@ -75,7 +73,7 @@ public: | ||
| 75 | virtual void remove(SrsConnection* c); | 73 | virtual void remove(SrsConnection* c); |
| 76 | // ISrsHttpHandler | 74 | // ISrsHttpHandler |
| 77 | public: | 75 | public: |
| 78 | - virtual int serve_http(ISrsHttpResponseWriter* w, SrsHttpMessage* r); | 76 | + virtual int serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r); |
| 79 | }; | 77 | }; |
| 80 | 78 | ||
| 81 | /** | 79 | /** |
| @@ -96,9 +94,9 @@ public: | @@ -96,9 +94,9 @@ public: | ||
| 96 | SrsDynamicHttpConn(IConnectionManager* cm, st_netfd_t fd, SrsHttpServeMux* m); | 94 | SrsDynamicHttpConn(IConnectionManager* cm, st_netfd_t fd, SrsHttpServeMux* m); |
| 97 | virtual ~SrsDynamicHttpConn(); | 95 | virtual ~SrsDynamicHttpConn(); |
| 98 | public: | 96 | public: |
| 99 | - virtual int on_got_http_message(SrsHttpMessage* msg); | 97 | + virtual int on_got_http_message(ISrsHttpMessage* msg); |
| 100 | public: | 98 | public: |
| 101 | - virtual int proxy(ISrsHttpResponseWriter* w, SrsHttpMessage* r, std::string o); | 99 | + virtual int proxy(ISrsHttpResponseWriter* w, ISrsHttpMessage* r, std::string o); |
| 102 | private: | 100 | private: |
| 103 | virtual int do_proxy(ISrsHttpResponseReader* rr, SrsFlvDecoder* dec); | 101 | virtual int do_proxy(ISrsHttpResponseReader* rr, SrsFlvDecoder* dec); |
| 104 | virtual int rtmp_write_packet(char type, u_int32_t timestamp, char* data, int size); | 102 | virtual int rtmp_write_packet(char type, u_int32_t timestamp, char* data, int size); |
| @@ -364,6 +364,8 @@ int SrsConfDirective::read_token(SrsConfigBuffer* buffer, vector<string>& args, | @@ -364,6 +364,8 @@ int SrsConfDirective::read_token(SrsConfigBuffer* buffer, vector<string>& args, | ||
| 364 | 364 | ||
| 365 | SrsConfig::SrsConfig() | 365 | SrsConfig::SrsConfig() |
| 366 | { | 366 | { |
| 367 | + dolphin = false; | ||
| 368 | + | ||
| 367 | show_help = false; | 369 | show_help = false; |
| 368 | show_version = false; | 370 | show_version = false; |
| 369 | test_conf = false; | 371 | test_conf = false; |
| @@ -378,6 +380,25 @@ SrsConfig::~SrsConfig() | @@ -378,6 +380,25 @@ SrsConfig::~SrsConfig() | ||
| 378 | srs_freep(root); | 380 | srs_freep(root); |
| 379 | } | 381 | } |
| 380 | 382 | ||
| 383 | +bool SrsConfig::is_dolphin() | ||
| 384 | +{ | ||
| 385 | + return dolphin; | ||
| 386 | +} | ||
| 387 | + | ||
| 388 | +void SrsConfig::set_config_directive(SrsConfDirective* parent, string dir, string value) | ||
| 389 | +{ | ||
| 390 | + SrsConfDirective* d = parent->get(dir); | ||
| 391 | + | ||
| 392 | + if (!d) { | ||
| 393 | + d = new SrsConfDirective(); | ||
| 394 | + d->name = dir; | ||
| 395 | + parent->directives.push_back(d); | ||
| 396 | + } | ||
| 397 | + | ||
| 398 | + d->args.clear(); | ||
| 399 | + d->args.push_back(value); | ||
| 400 | +} | ||
| 401 | + | ||
| 381 | void SrsConfig::subscribe(ISrsReloadHandler* handler) | 402 | void SrsConfig::subscribe(ISrsReloadHandler* handler) |
| 382 | { | 403 | { |
| 383 | std::vector<ISrsReloadHandler*>::iterator it; | 404 | std::vector<ISrsReloadHandler*>::iterator it; |
| @@ -1260,6 +1281,19 @@ int SrsConfig::parse_argv(int& i, char** argv) | @@ -1260,6 +1281,19 @@ int SrsConfig::parse_argv(int& i, char** argv) | ||
| 1260 | show_help = false; | 1281 | show_help = false; |
| 1261 | test_conf = true; | 1282 | test_conf = true; |
| 1262 | break; | 1283 | break; |
| 1284 | + case 'p': | ||
| 1285 | + dolphin = true; | ||
| 1286 | + if (*p) { | ||
| 1287 | + dolphin_port = p; | ||
| 1288 | + continue; | ||
| 1289 | + } | ||
| 1290 | + if (argv[++i]) { | ||
| 1291 | + dolphin_port = argv[i]; | ||
| 1292 | + continue; | ||
| 1293 | + } | ||
| 1294 | + ret = ERROR_SYSTEM_CONFIG_INVALID; | ||
| 1295 | + srs_error("option \"-p\" requires params, ret=%d", ret); | ||
| 1296 | + return ret; | ||
| 1263 | case 'v': | 1297 | case 'v': |
| 1264 | case 'V': | 1298 | case 'V': |
| 1265 | show_help = false; | 1299 | show_help = false; |
| @@ -1269,11 +1303,11 @@ int SrsConfig::parse_argv(int& i, char** argv) | @@ -1269,11 +1303,11 @@ int SrsConfig::parse_argv(int& i, char** argv) | ||
| 1269 | show_help = false; | 1303 | show_help = false; |
| 1270 | if (*p) { | 1304 | if (*p) { |
| 1271 | config_file = p; | 1305 | config_file = p; |
| 1272 | - return ret; | 1306 | + continue; |
| 1273 | } | 1307 | } |
| 1274 | if (argv[++i]) { | 1308 | if (argv[++i]) { |
| 1275 | config_file = argv[i]; | 1309 | config_file = argv[i]; |
| 1276 | - return ret; | 1310 | + continue; |
| 1277 | } | 1311 | } |
| 1278 | ret = ERROR_SYSTEM_CONFIG_INVALID; | 1312 | ret = ERROR_SYSTEM_CONFIG_INVALID; |
| 1279 | srs_error("option \"-c\" requires parameter, ret=%d", ret); | 1313 | srs_error("option \"-c\" requires parameter, ret=%d", ret); |
| @@ -1845,6 +1879,14 @@ int SrsConfig::parse_buffer(SrsConfigBuffer* buffer) | @@ -1845,6 +1879,14 @@ int SrsConfig::parse_buffer(SrsConfigBuffer* buffer) | ||
| 1845 | return ret; | 1879 | return ret; |
| 1846 | } | 1880 | } |
| 1847 | 1881 | ||
| 1882 | + // mock by dolphin mode. | ||
| 1883 | + // for the dolphin will start srs with specified params. | ||
| 1884 | + if (dolphin) { | ||
| 1885 | + set_config_directive(root, "listen", dolphin_port); | ||
| 1886 | + set_config_directive(root, "daemon", "off"); | ||
| 1887 | + set_config_directive(root, "srs_log_tank", "console"); | ||
| 1888 | + } | ||
| 1889 | + | ||
| 1848 | return ret; | 1890 | return ret; |
| 1849 | } | 1891 | } |
| 1850 | 1892 |
| @@ -267,6 +267,12 @@ class SrsConfig | @@ -267,6 +267,12 @@ class SrsConfig | ||
| 267 | // user command | 267 | // user command |
| 268 | private: | 268 | private: |
| 269 | /** | 269 | /** |
| 270 | + * whether srs is run in dolphin mode. | ||
| 271 | + * @see https://github.com/simple-rtmp-server/srs-dolphin | ||
| 272 | + */ | ||
| 273 | + bool dolphin; | ||
| 274 | + std::string dolphin_port; | ||
| 275 | + /** | ||
| 270 | * whether show help and exit. | 276 | * whether show help and exit. |
| 271 | */ | 277 | */ |
| 272 | bool show_help; | 278 | bool show_help; |
| @@ -309,6 +315,14 @@ private: | @@ -309,6 +315,14 @@ private: | ||
| 309 | public: | 315 | public: |
| 310 | SrsConfig(); | 316 | SrsConfig(); |
| 311 | virtual ~SrsConfig(); | 317 | virtual ~SrsConfig(); |
| 318 | +// dolphin | ||
| 319 | +public: | ||
| 320 | + /** | ||
| 321 | + * whether srs is in dolphin mode. | ||
| 322 | + */ | ||
| 323 | + virtual bool is_dolphin(); | ||
| 324 | +private: | ||
| 325 | + virtual void set_config_directive(SrsConfDirective* parent, std::string dir, std::string value); | ||
| 312 | // reload | 326 | // reload |
| 313 | public: | 327 | public: |
| 314 | /** | 328 | /** |
| @@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 23 | 23 | ||
| 24 | #include <srs_app_heartbeat.hpp> | 24 | #include <srs_app_heartbeat.hpp> |
| 25 | 25 | ||
| 26 | -#ifdef SRS_AUTO_HTTP_PARSER | 26 | +#ifdef SRS_AUTO_HTTP_CORE |
| 27 | 27 | ||
| 28 | #include <sstream> | 28 | #include <sstream> |
| 29 | using namespace std; | 29 | using namespace std; |
| @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 29 | */ | 29 | */ |
| 30 | #include <srs_core.hpp> | 30 | #include <srs_core.hpp> |
| 31 | 31 | ||
| 32 | -#ifdef SRS_AUTO_HTTP_PARSER | 32 | +#ifdef SRS_AUTO_HTTP_CORE |
| 33 | 33 | ||
| 34 | /** | 34 | /** |
| 35 | * the http heartbeat to api-server to notice api | 35 | * the http heartbeat to api-server to notice api |
| @@ -23,11 +23,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -23,11 +23,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 23 | 23 | ||
| 24 | #include <srs_app_hls.hpp> | 24 | #include <srs_app_hls.hpp> |
| 25 | 25 | ||
| 26 | -/** | ||
| 27 | -* the HLS section, only available when HLS enabled. | ||
| 28 | -*/ | ||
| 29 | -#ifdef SRS_AUTO_HLS | ||
| 30 | - | ||
| 31 | #include <sys/types.h> | 26 | #include <sys/types.h> |
| 32 | #include <sys/stat.h> | 27 | #include <sys/stat.h> |
| 33 | #include <fcntl.h> | 28 | #include <fcntl.h> |
| @@ -72,6 +67,11 @@ ISrsHlsHandler::~ISrsHlsHandler() | @@ -72,6 +67,11 @@ ISrsHlsHandler::~ISrsHlsHandler() | ||
| 72 | { | 67 | { |
| 73 | } | 68 | } |
| 74 | 69 | ||
| 70 | +/** | ||
| 71 | + * * the HLS section, only available when HLS enabled. | ||
| 72 | + * */ | ||
| 73 | +#ifdef SRS_AUTO_HLS | ||
| 74 | + | ||
| 75 | SrsHlsCacheWriter::SrsHlsCacheWriter(bool write_cache, bool write_file) | 75 | SrsHlsCacheWriter::SrsHlsCacheWriter(bool write_cache, bool write_file) |
| 76 | { | 76 | { |
| 77 | should_write_cache = write_cache; | 77 | should_write_cache = write_cache; |
| @@ -29,11 +29,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -29,11 +29,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 29 | */ | 29 | */ |
| 30 | #include <srs_core.hpp> | 30 | #include <srs_core.hpp> |
| 31 | 31 | ||
| 32 | -/** | ||
| 33 | -* the HLS section, only available when HLS enabled. | ||
| 34 | -*/ | ||
| 35 | -#ifdef SRS_AUTO_HLS | ||
| 36 | - | ||
| 37 | #include <string> | 32 | #include <string> |
| 38 | #include <vector> | 33 | #include <vector> |
| 39 | 34 | ||
| @@ -87,6 +82,11 @@ public: | @@ -87,6 +82,11 @@ public: | ||
| 87 | }; | 82 | }; |
| 88 | 83 | ||
| 89 | /** | 84 | /** |
| 85 | + * * the HLS section, only available when HLS enabled. | ||
| 86 | + * */ | ||
| 87 | +#ifdef SRS_AUTO_HLS | ||
| 88 | + | ||
| 89 | +/** | ||
| 90 | * write to file and cache. | 90 | * write to file and cache. |
| 91 | */ | 91 | */ |
| 92 | class SrsHlsCacheWriter : public SrsFileWriter | 92 | class SrsHlsCacheWriter : public SrsFileWriter |
| @@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 23 | 23 | ||
| 24 | #include <srs_app_http_client.hpp> | 24 | #include <srs_app_http_client.hpp> |
| 25 | 25 | ||
| 26 | -#ifdef SRS_AUTO_HTTP_PARSER | 26 | +#ifdef SRS_AUTO_HTTP_CORE |
| 27 | 27 | ||
| 28 | #include <arpa/inet.h> | 28 | #include <arpa/inet.h> |
| 29 | 29 |
| @@ -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 | 31 | ||
| 32 | #include <string> | 32 | #include <string> |
| 33 | 33 | ||
| 34 | -#ifdef SRS_AUTO_HTTP_PARSER | 34 | +#ifdef SRS_AUTO_HTTP_CORE |
| 35 | 35 | ||
| 36 | #include <srs_app_st.hpp> | 36 | #include <srs_app_st.hpp> |
| 37 | 37 |
| @@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 23 | 23 | ||
| 24 | #include <srs_app_http_conn.hpp> | 24 | #include <srs_app_http_conn.hpp> |
| 25 | 25 | ||
| 26 | -#if defined(SRS_AUTO_HTTP_PARSER) || defined(SRS_AUTO_HTTP_SERVER) | 26 | +#if defined(SRS_AUTO_HTTP_CORE) || defined(SRS_AUTO_HTTP_SERVER) |
| 27 | 27 | ||
| 28 | #include <sys/types.h> | 28 | #include <sys/types.h> |
| 29 | #include <sys/stat.h> | 29 | #include <sys/stat.h> |
| @@ -55,7 +55,7 @@ using namespace std; | @@ -55,7 +55,7 @@ using namespace std; | ||
| 55 | 55 | ||
| 56 | #endif | 56 | #endif |
| 57 | 57 | ||
| 58 | -#ifdef SRS_AUTO_HTTP_PARSER | 58 | +#ifdef SRS_AUTO_HTTP_CORE |
| 59 | 59 | ||
| 60 | SrsHttpResponseWriter::SrsHttpResponseWriter(SrsStSocket* io) | 60 | SrsHttpResponseWriter::SrsHttpResponseWriter(SrsStSocket* io) |
| 61 | { | 61 | { |
| @@ -2423,6 +2423,9 @@ int SrsHttpServer::initialize_hls_streaming() | @@ -2423,6 +2423,9 @@ int SrsHttpServer::initialize_hls_streaming() | ||
| 2423 | return ret; | 2423 | return ret; |
| 2424 | } | 2424 | } |
| 2425 | 2425 | ||
| 2426 | +#endif | ||
| 2427 | + | ||
| 2428 | +#ifdef SRS_AUTO_HTTP_CORE | ||
| 2426 | SrsHttpConn::SrsHttpConn(IConnectionManager* cm, st_netfd_t fd, SrsHttpServeMux* m) | 2429 | SrsHttpConn::SrsHttpConn(IConnectionManager* cm, st_netfd_t fd, SrsHttpServeMux* m) |
| 2427 | : SrsConnection(cm, fd) | 2430 | : SrsConnection(cm, fd) |
| 2428 | { | 2431 | { |
| @@ -30,11 +30,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -30,11 +30,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 30 | 30 | ||
| 31 | #include <srs_core.hpp> | 31 | #include <srs_core.hpp> |
| 32 | 32 | ||
| 33 | -#ifdef SRS_AUTO_HTTP_PARSER | 33 | +#ifdef SRS_AUTO_HTTP_CORE |
| 34 | #include <http_parser.h> | 34 | #include <http_parser.h> |
| 35 | #endif | 35 | #endif |
| 36 | 36 | ||
| 37 | -#if defined(SRS_AUTO_HTTP_PARSER) || defined(SRS_AUTO_HTTP_SERVER) | 37 | +#ifdef SRS_AUTO_HTTP_CORE |
| 38 | 38 | ||
| 39 | #include <map> | 39 | #include <map> |
| 40 | #include <string> | 40 | #include <string> |
| @@ -69,7 +69,7 @@ class SrsHttpMessage; | @@ -69,7 +69,7 @@ class SrsHttpMessage; | ||
| 69 | 69 | ||
| 70 | #endif | 70 | #endif |
| 71 | 71 | ||
| 72 | -#ifdef SRS_AUTO_HTTP_PARSER | 72 | +#ifdef SRS_AUTO_HTTP_CORE |
| 73 | 73 | ||
| 74 | // the http chunked header size, | 74 | // the http chunked header size, |
| 75 | // for writev, there always one chunk to send it. | 75 | // for writev, there always one chunk to send it. |
| @@ -214,7 +214,7 @@ public: | @@ -214,7 +214,7 @@ public: | ||
| 214 | virtual int update(std::string url, http_parser* header, | 214 | virtual int update(std::string url, http_parser* header, |
| 215 | SrsFastBuffer* body, std::vector<SrsHttpHeaderField>& headers | 215 | SrsFastBuffer* body, std::vector<SrsHttpHeaderField>& headers |
| 216 | ); | 216 | ); |
| 217 | -private: | 217 | +public: |
| 218 | virtual SrsConnection* connection(); | 218 | virtual SrsConnection* connection(); |
| 219 | public: | 219 | public: |
| 220 | virtual u_int8_t method(); | 220 | virtual u_int8_t method(); |
| @@ -711,6 +711,9 @@ private: | @@ -711,6 +711,9 @@ private: | ||
| 711 | virtual int initialize_hls_streaming(); | 711 | virtual int initialize_hls_streaming(); |
| 712 | }; | 712 | }; |
| 713 | 713 | ||
| 714 | +#endif | ||
| 715 | + | ||
| 716 | +#ifdef SRS_AUTO_HTTP_CORE | ||
| 714 | class SrsHttpConn : public SrsConnection | 717 | class SrsHttpConn : public SrsConnection |
| 715 | { | 718 | { |
| 716 | private: | 719 | private: |
| @@ -113,18 +113,18 @@ int SrsUdpListener::listen() | @@ -113,18 +113,18 @@ int SrsUdpListener::listen() | ||
| 113 | 113 | ||
| 114 | if ((_fd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) { | 114 | if ((_fd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) { |
| 115 | ret = ERROR_SOCKET_CREATE; | 115 | ret = ERROR_SOCKET_CREATE; |
| 116 | - srs_error("create linux socket error. port=%d, ret=%d", ip.c_str(), port, ret); | 116 | + srs_error("create linux socket error. ip=%s, port=%d, ret=%d", ip.c_str(), port, ret); |
| 117 | return ret; | 117 | return ret; |
| 118 | } | 118 | } |
| 119 | - srs_verbose("create linux socket success. port=%d, fd=%d", ip.c_str(), port, _fd); | 119 | + srs_verbose("create linux socket success. ip=%s, port=%d, fd=%d", ip.c_str(), port, _fd); |
| 120 | 120 | ||
| 121 | int reuse_socket = 1; | 121 | int reuse_socket = 1; |
| 122 | if (setsockopt(_fd, SOL_SOCKET, SO_REUSEADDR, &reuse_socket, sizeof(int)) == -1) { | 122 | if (setsockopt(_fd, SOL_SOCKET, SO_REUSEADDR, &reuse_socket, sizeof(int)) == -1) { |
| 123 | ret = ERROR_SOCKET_SETREUSE; | 123 | ret = ERROR_SOCKET_SETREUSE; |
| 124 | - srs_error("setsockopt reuse-addr error. port=%d, ret=%d", ip.c_str(), port, ret); | 124 | + srs_error("setsockopt reuse-addr error. ip=%s, port=%d, ret=%d", ip.c_str(), port, ret); |
| 125 | return ret; | 125 | return ret; |
| 126 | } | 126 | } |
| 127 | - srs_verbose("setsockopt reuse-addr success. port=%d, fd=%d", ip.c_str(), port, _fd); | 127 | + srs_verbose("setsockopt reuse-addr success. ip=%s, port=%d, fd=%d", ip.c_str(), port, _fd); |
| 128 | 128 | ||
| 129 | sockaddr_in addr; | 129 | sockaddr_in addr; |
| 130 | addr.sin_family = AF_INET; | 130 | addr.sin_family = AF_INET; |
| @@ -43,10 +43,13 @@ SrsThreadContext::~SrsThreadContext() | @@ -43,10 +43,13 @@ SrsThreadContext::~SrsThreadContext() | ||
| 43 | { | 43 | { |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | -void SrsThreadContext::generate_id() | 46 | +int SrsThreadContext::generate_id() |
| 47 | { | 47 | { |
| 48 | static int id = 100; | 48 | static int id = 100; |
| 49 | - cache[st_thread_self()] = id++; | 49 | + |
| 50 | + int gid = id++; | ||
| 51 | + cache[st_thread_self()] = gid; | ||
| 52 | + return gid; | ||
| 50 | } | 53 | } |
| 51 | 54 | ||
| 52 | int SrsThreadContext::get_id() | 55 | int SrsThreadContext::get_id() |
| @@ -51,7 +51,7 @@ public: | @@ -51,7 +51,7 @@ public: | ||
| 51 | SrsThreadContext(); | 51 | SrsThreadContext(); |
| 52 | virtual ~SrsThreadContext(); | 52 | virtual ~SrsThreadContext(); |
| 53 | public: | 53 | public: |
| 54 | - virtual void generate_id(); | 54 | + virtual int generate_id(); |
| 55 | virtual int get_id(); | 55 | virtual int get_id(); |
| 56 | }; | 56 | }; |
| 57 | 57 |
| @@ -154,9 +154,9 @@ int SrsStreamListener::listen(string i, int p) | @@ -154,9 +154,9 @@ int SrsStreamListener::listen(string i, int p) | ||
| 154 | return ret; | 154 | return ret; |
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | - srs_info("listen thread cid=%d, current_cid=%d, " | 157 | + srs_info("listen thread current_cid=%d, " |
| 158 | "listen at port=%d, type=%d, fd=%d started success, ep=%s:%d", | 158 | "listen at port=%d, type=%d, fd=%d started success, ep=%s:%d", |
| 159 | - pthread->cid(), _srs_context->get_id(), _port, _type, fd, ip.c_str(), port); | 159 | + _srs_context->get_id(), p, type, listener->fd(), i.c_str(), p); |
| 160 | 160 | ||
| 161 | srs_trace("%s listen at tcp://%s:%d, fd=%d", srs_listener_type2string(type).c_str(), ip.c_str(), port, listener->fd()); | 161 | srs_trace("%s listen at tcp://%s:%d, fd=%d", srs_listener_type2string(type).c_str(), ip.c_str(), port, listener->fd()); |
| 162 | 162 | ||
| @@ -327,9 +327,9 @@ int SrsUdpStreamListener::listen(string i, int p) | @@ -327,9 +327,9 @@ int SrsUdpStreamListener::listen(string i, int p) | ||
| 327 | return ret; | 327 | return ret; |
| 328 | } | 328 | } |
| 329 | 329 | ||
| 330 | - srs_info("listen thread cid=%d, current_cid=%d, " | 330 | + srs_info("listen thread current_cid=%d, " |
| 331 | "listen at port=%d, type=%d, fd=%d started success, ep=%s:%d", | 331 | "listen at port=%d, type=%d, fd=%d started success, ep=%s:%d", |
| 332 | - pthread->cid(), _srs_context->get_id(), port, type, fd, ip.c_str(), port); | 332 | + _srs_context->get_id(), p, type, listener->fd(), i.c_str(), p); |
| 333 | 333 | ||
| 334 | // notify the handler the fd changed. | 334 | // notify the handler the fd changed. |
| 335 | if ((ret = caster->on_stfd_change(listener->stfd())) != ERROR_SUCCESS) { | 335 | if ((ret = caster->on_stfd_change(listener->stfd())) != ERROR_SUCCESS) { |
| @@ -495,7 +495,7 @@ SrsServer::SrsServer() | @@ -495,7 +495,7 @@ SrsServer::SrsServer() | ||
| 495 | #ifdef SRS_AUTO_HTTP_SERVER | 495 | #ifdef SRS_AUTO_HTTP_SERVER |
| 496 | http_stream_mux = new SrsHttpServer(this); | 496 | http_stream_mux = new SrsHttpServer(this); |
| 497 | #endif | 497 | #endif |
| 498 | -#ifdef SRS_AUTO_HTTP_PARSER | 498 | +#ifdef SRS_AUTO_HTTP_CORE |
| 499 | http_heartbeat = NULL; | 499 | http_heartbeat = NULL; |
| 500 | #endif | 500 | #endif |
| 501 | #ifdef SRS_AUTO_INGEST | 501 | #ifdef SRS_AUTO_INGEST |
| @@ -530,7 +530,7 @@ void SrsServer::destroy() | @@ -530,7 +530,7 @@ void SrsServer::destroy() | ||
| 530 | srs_freep(http_stream_mux); | 530 | srs_freep(http_stream_mux); |
| 531 | #endif | 531 | #endif |
| 532 | 532 | ||
| 533 | -#ifdef SRS_AUTO_HTTP_PARSER | 533 | +#ifdef SRS_AUTO_HTTP_CORE |
| 534 | srs_freep(http_heartbeat); | 534 | srs_freep(http_heartbeat); |
| 535 | #endif | 535 | #endif |
| 536 | 536 | ||
| @@ -589,7 +589,7 @@ int SrsServer::initialize(ISrsServerCycle* cycle_handler) | @@ -589,7 +589,7 @@ int SrsServer::initialize(ISrsServerCycle* cycle_handler) | ||
| 589 | } | 589 | } |
| 590 | #endif | 590 | #endif |
| 591 | 591 | ||
| 592 | -#ifdef SRS_AUTO_HTTP_PARSER | 592 | +#ifdef SRS_AUTO_HTTP_CORE |
| 593 | srs_assert(!http_heartbeat); | 593 | srs_assert(!http_heartbeat); |
| 594 | http_heartbeat = new SrsHttpHeartbeat(); | 594 | http_heartbeat = new SrsHttpHeartbeat(); |
| 595 | #endif | 595 | #endif |
| @@ -607,7 +607,7 @@ int SrsServer::initialize_st() | @@ -607,7 +607,7 @@ int SrsServer::initialize_st() | ||
| 607 | int ret = ERROR_SUCCESS; | 607 | int ret = ERROR_SUCCESS; |
| 608 | 608 | ||
| 609 | // init st | 609 | // init st |
| 610 | - if ((ret = srs_init_st()) != ERROR_SUCCESS) { | 610 | + if ((ret = srs_st_init()) != ERROR_SUCCESS) { |
| 611 | srs_error("init st failed. ret=%d", ret); | 611 | srs_error("init st failed. ret=%d", ret); |
| 612 | return ret; | 612 | return ret; |
| 613 | } | 613 | } |
| @@ -639,6 +639,11 @@ int SrsServer::acquire_pid_file() | @@ -639,6 +639,11 @@ int SrsServer::acquire_pid_file() | ||
| 639 | { | 639 | { |
| 640 | int ret = ERROR_SUCCESS; | 640 | int ret = ERROR_SUCCESS; |
| 641 | 641 | ||
| 642 | + // when srs in dolphin mode, no need the pid file. | ||
| 643 | + if (_srs_config->is_dolphin()) { | ||
| 644 | + return ret; | ||
| 645 | + } | ||
| 646 | + | ||
| 642 | std::string pid_file = _srs_config->get_pid_file(); | 647 | std::string pid_file = _srs_config->get_pid_file(); |
| 643 | 648 | ||
| 644 | // -rw-r--r-- | 649 | // -rw-r--r-- |
| @@ -971,7 +976,7 @@ int SrsServer::do_cycle() | @@ -971,7 +976,7 @@ int SrsServer::do_cycle() | ||
| 971 | srs_info("update network server kbps info."); | 976 | srs_info("update network server kbps info."); |
| 972 | resample_kbps(); | 977 | resample_kbps(); |
| 973 | } | 978 | } |
| 974 | - #ifdef SRS_AUTO_HTTP_PARSER | 979 | + #ifdef SRS_AUTO_HTTP_CORE |
| 975 | if (_srs_config->get_heartbeat_enabled()) { | 980 | if (_srs_config->get_heartbeat_enabled()) { |
| 976 | if ((i % heartbeat_max_resolution) == 0) { | 981 | if ((i % heartbeat_max_resolution) == 0) { |
| 977 | srs_info("do http heartbeat, for internal server to report."); | 982 | srs_info("do http heartbeat, for internal server to report."); |
| @@ -240,7 +240,7 @@ private: | @@ -240,7 +240,7 @@ private: | ||
| 240 | #ifdef SRS_AUTO_HTTP_SERVER | 240 | #ifdef SRS_AUTO_HTTP_SERVER |
| 241 | SrsHttpServer* http_stream_mux; | 241 | SrsHttpServer* http_stream_mux; |
| 242 | #endif | 242 | #endif |
| 243 | -#ifdef SRS_AUTO_HTTP_PARSER | 243 | +#ifdef SRS_AUTO_HTTP_CORE |
| 244 | SrsHttpHeartbeat* http_heartbeat; | 244 | SrsHttpHeartbeat* http_heartbeat; |
| 245 | #endif | 245 | #endif |
| 246 | #ifdef SRS_AUTO_INGEST | 246 | #ifdef SRS_AUTO_INGEST |
trunk/src/app/srs_app_source.cpp
100644 → 100755
| @@ -357,52 +357,49 @@ int SrsMessageQueue::dump_packets(SrsConsumer* consumer, bool atc, int tba, int | @@ -357,52 +357,49 @@ int SrsMessageQueue::dump_packets(SrsConsumer* consumer, bool atc, int tba, int | ||
| 357 | 357 | ||
| 358 | void SrsMessageQueue::shrink() | 358 | void SrsMessageQueue::shrink() |
| 359 | { | 359 | { |
| 360 | - int iframe_index = -1; | 360 | + SrsSharedPtrMessage* video_sh = NULL; |
| 361 | + SrsSharedPtrMessage* audio_sh = NULL; | ||
| 362 | + int msgs_size = (int)msgs.size(); | ||
| 361 | 363 | ||
| 362 | - // issue the first iframe. | ||
| 363 | - // skip the first frame, whatever the type of it, | ||
| 364 | - // for when we shrinked, the first is the iframe, | ||
| 365 | - // we will directly remove the gop next time. | ||
| 366 | - for (int i = 1; i < (int)msgs.size(); i++) { | 364 | + // remove all msg |
| 365 | + // igone the sequence header | ||
| 366 | + for (int i = 0; i < (int)msgs.size(); i++) { | ||
| 367 | SrsSharedPtrMessage* msg = msgs.at(i); | 367 | SrsSharedPtrMessage* msg = msgs.at(i); |
| 368 | 368 | ||
| 369 | - if (msg->is_video()) { | ||
| 370 | - if (SrsFlvCodec::video_is_keyframe(msg->payload, msg->size)) { | ||
| 371 | - // the max frame index to remove. | ||
| 372 | - iframe_index = i; | ||
| 373 | - | ||
| 374 | - // set the start time, we will remove until this frame. | ||
| 375 | - av_start_time = msg->timestamp; | ||
| 376 | - | ||
| 377 | - break; | 369 | + if (msg->is_video() && SrsFlvCodec::video_is_sequence_header(msg->payload, msg->size)) { |
| 370 | + srs_freep(video_sh); | ||
| 371 | + video_sh = msg; | ||
| 372 | + continue; | ||
| 378 | } | 373 | } |
| 374 | + else if (msg->is_audio() && SrsFlvCodec::audio_is_sequence_header(msg->payload, msg->size)) { | ||
| 375 | + srs_freep(audio_sh); | ||
| 376 | + audio_sh = msg; | ||
| 377 | + continue; | ||
| 379 | } | 378 | } |
| 379 | + | ||
| 380 | + srs_freep(msg); | ||
| 380 | } | 381 | } |
| 382 | + msgs.clear(); | ||
| 381 | 383 | ||
| 382 | - // no iframe, for audio, clear the queue. | ||
| 383 | - // it is ok to clear for audio, for the shrink tell us the queue is full. | ||
| 384 | - // for video, we clear util the I-Frame, for the decoding must start from I-frame, | ||
| 385 | - // for audio, it's ok to clear any data, also we can clear the whole queue. | ||
| 386 | - // @see: https://github.com/simple-rtmp-server/srs/issues/134 | ||
| 387 | - if (iframe_index < 0) { | ||
| 388 | - clear(); | ||
| 389 | - return; | 384 | + // update av_start_time |
| 385 | + av_start_time = av_end_time; | ||
| 386 | + //push_back secquence header and update timestamp | ||
| 387 | + if (video_sh) { | ||
| 388 | + video_sh->timestamp = av_end_time; | ||
| 389 | + msgs.push_back(video_sh); | ||
| 390 | + } | ||
| 391 | + if (audio_sh) { | ||
| 392 | + audio_sh->timestamp = av_end_time; | ||
| 393 | + msgs.push_back(audio_sh); | ||
| 390 | } | 394 | } |
| 391 | 395 | ||
| 392 | if (_ignore_shrink) { | 396 | if (_ignore_shrink) { |
| 393 | srs_info("shrink the cache queue, size=%d, removed=%d, max=%.2f", | 397 | srs_info("shrink the cache queue, size=%d, removed=%d, max=%.2f", |
| 394 | - (int)msgs.size(), iframe_index, queue_size_ms / 1000.0); | 398 | + (int)msgs.size(), msgs_size - (int)msgs.size(), queue_size_ms / 1000.0); |
| 395 | } else { | 399 | } else { |
| 396 | srs_trace("shrink the cache queue, size=%d, removed=%d, max=%.2f", | 400 | srs_trace("shrink the cache queue, size=%d, removed=%d, max=%.2f", |
| 397 | - (int)msgs.size(), iframe_index, queue_size_ms / 1000.0); | ||
| 398 | - } | ||
| 399 | - | ||
| 400 | - // remove the first gop from the front | ||
| 401 | - for (int i = 0; i < iframe_index; i++) { | ||
| 402 | - SrsSharedPtrMessage* msg = msgs.at(i); | ||
| 403 | - srs_freep(msg); | 401 | + (int)msgs.size(), msgs_size - (int)msgs.size(), queue_size_ms / 1000.0); |
| 404 | } | 402 | } |
| 405 | - msgs.erase(msgs.begin(), msgs.begin() + iframe_index); | ||
| 406 | } | 403 | } |
| 407 | 404 | ||
| 408 | void SrsMessageQueue::clear() | 405 | void SrsMessageQueue::clear() |
| @@ -33,7 +33,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -33,7 +33,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 33 | #include <st.h> | 33 | #include <st.h> |
| 34 | 34 | ||
| 35 | // initialize st, requires epoll. | 35 | // initialize st, requires epoll. |
| 36 | -extern int srs_init_st(); | 36 | +extern int srs_st_init(); |
| 37 | 37 | ||
| 38 | // close the netfd, and close the underlayer fd. | 38 | // close the netfd, and close the underlayer fd. |
| 39 | extern void srs_close_stfd(st_netfd_t& stfd); | 39 | extern void srs_close_stfd(st_netfd_t& stfd); |
| @@ -66,8 +66,9 @@ ISrsThreadContext::~ISrsThreadContext() | @@ -66,8 +66,9 @@ ISrsThreadContext::~ISrsThreadContext() | ||
| 66 | { | 66 | { |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | -void ISrsThreadContext::generate_id() | 69 | +int ISrsThreadContext::generate_id() |
| 70 | { | 70 | { |
| 71 | + return 0; | ||
| 71 | } | 72 | } |
| 72 | 73 | ||
| 73 | int ISrsThreadContext::get_id() | 74 | int ISrsThreadContext::get_id() |
| @@ -102,7 +102,7 @@ public: | @@ -102,7 +102,7 @@ public: | ||
| 102 | ISrsThreadContext(); | 102 | ISrsThreadContext(); |
| 103 | virtual ~ISrsThreadContext(); | 103 | virtual ~ISrsThreadContext(); |
| 104 | public: | 104 | public: |
| 105 | - virtual void generate_id(); | 105 | + virtual int generate_id(); |
| 106 | virtual int get_id(); | 106 | virtual int get_id(); |
| 107 | }; | 107 | }; |
| 108 | 108 |
| @@ -61,6 +61,8 @@ ISrsThreadContext* _srs_context = new ISrsThreadContext(); | @@ -61,6 +61,8 @@ ISrsThreadContext* _srs_context = new ISrsThreadContext(); | ||
| 61 | SrsConfig* _srs_config = NULL; | 61 | SrsConfig* _srs_config = NULL; |
| 62 | SrsServer* _srs_server = NULL; | 62 | SrsServer* _srs_server = NULL; |
| 63 | 63 | ||
| 64 | +#if defined(SRS_AUTO_HTTP_CORE) | ||
| 65 | + | ||
| 64 | /** | 66 | /** |
| 65 | * main entrance. | 67 | * main entrance. |
| 66 | */ | 68 | */ |
| @@ -70,7 +72,7 @@ int main(int argc, char** argv) | @@ -70,7 +72,7 @@ int main(int argc, char** argv) | ||
| 70 | srs_assert(srs_is_little_endian()); | 72 | srs_assert(srs_is_little_endian()); |
| 71 | 73 | ||
| 72 | // directly failed when compile limited. | 74 | // directly failed when compile limited. |
| 73 | -#if !defined(SRS_AUTO_HTTP_PARSER) | 75 | +#if !defined(SRS_AUTO_HTTP_CORE) |
| 74 | srs_error("depends on http-parser."); | 76 | srs_error("depends on http-parser."); |
| 75 | exit(-1); | 77 | exit(-1); |
| 76 | #endif | 78 | #endif |
| @@ -1376,7 +1378,7 @@ int proxy_hls2rtmp(string hls, string rtmp) | @@ -1376,7 +1378,7 @@ int proxy_hls2rtmp(string hls, string rtmp) | ||
| 1376 | int ret = ERROR_SUCCESS; | 1378 | int ret = ERROR_SUCCESS; |
| 1377 | 1379 | ||
| 1378 | // init st. | 1380 | // init st. |
| 1379 | - if ((ret = srs_init_st()) != ERROR_SUCCESS) { | 1381 | + if ((ret = srs_st_init()) != ERROR_SUCCESS) { |
| 1380 | srs_error("init st failed. ret=%d", ret); | 1382 | srs_error("init st failed. ret=%d", ret); |
| 1381 | return ret; | 1383 | return ret; |
| 1382 | } | 1384 | } |
| @@ -1402,3 +1404,15 @@ int proxy_hls2rtmp(string hls, string rtmp) | @@ -1402,3 +1404,15 @@ int proxy_hls2rtmp(string hls, string rtmp) | ||
| 1402 | return ret; | 1404 | return ret; |
| 1403 | } | 1405 | } |
| 1404 | 1406 | ||
| 1407 | +#else | ||
| 1408 | + | ||
| 1409 | +int main(int argc, char** argv) | ||
| 1410 | +{ | ||
| 1411 | +#ifndef SRS_AUTO_HTTP_CORE | ||
| 1412 | + srs_error("ingest requires http-api or http-server"); | ||
| 1413 | +#endif | ||
| 1414 | + return -1; | ||
| 1415 | +} | ||
| 1416 | + | ||
| 1417 | +#endif | ||
| 1418 | + |
| @@ -96,7 +96,7 @@ void show_macro_features() | @@ -96,7 +96,7 @@ void show_macro_features() | ||
| 96 | srs_warn("check feature http server: off"); | 96 | srs_warn("check feature http server: off"); |
| 97 | #endif | 97 | #endif |
| 98 | 98 | ||
| 99 | -#ifdef SRS_AUTO_HTTP_PARSER | 99 | +#ifdef SRS_AUTO_HTTP_CORE |
| 100 | srs_trace("check feature http parser: on"); | 100 | srs_trace("check feature http parser: on"); |
| 101 | #else | 101 | #else |
| 102 | srs_warn("check feature http parser: off"); | 102 | srs_warn("check feature http parser: off"); |
| @@ -961,8 +961,8 @@ int SrsProtocol::recv_interlaced_message(SrsCommonMessage** pmsg) | @@ -961,8 +961,8 @@ int SrsProtocol::recv_interlaced_message(SrsCommonMessage** pmsg) | ||
| 961 | return ret; | 961 | return ret; |
| 962 | } | 962 | } |
| 963 | srs_verbose("read message header success. " | 963 | srs_verbose("read message header success. " |
| 964 | - "fmt=%d, mh_size=%d, ext_time=%d, size=%d, message(type=%d, size=%d, time=%"PRId64", sid=%d)", | ||
| 965 | - fmt, mh_size, chunk->extended_timestamp, (chunk->msg? chunk->msg->size : 0), chunk->header.message_type, | 964 | + "fmt=%d, ext_time=%d, size=%d, message(type=%d, size=%d, time=%"PRId64", sid=%d)", |
| 965 | + fmt, chunk->extended_timestamp, (chunk->msg? chunk->msg->size : 0), chunk->header.message_type, | ||
| 966 | chunk->header.payload_length, chunk->header.timestamp, chunk->header.stream_id); | 966 | chunk->header.payload_length, chunk->header.timestamp, chunk->header.stream_id); |
| 967 | 967 | ||
| 968 | // read msg payload from chunk stream. | 968 | // read msg payload from chunk stream. |
-
请 注册 或 登录 后发表评论