正在显示
15 个修改的文件
包含
95 行增加
和
48 行删除
| @@ -514,7 +514,7 @@ function apply_user_presets() { | @@ -514,7 +514,7 @@ function apply_user_presets() { | ||
| 514 | SRS_HTTP_PARSER=YES | 514 | SRS_HTTP_PARSER=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=YES | 517 | + SRS_STREAM_CASTER=NO |
| 518 | SRS_HTTP_API=YES | 518 | SRS_HTTP_API=YES |
| 519 | SRS_LIBRTMP=YES | 519 | SRS_LIBRTMP=YES |
| 520 | SRS_RESEARCH=NO | 520 | SRS_RESEARCH=NO |
| @@ -542,7 +542,7 @@ function apply_user_presets() { | @@ -542,7 +542,7 @@ function apply_user_presets() { | ||
| 542 | SRS_HTTP_PARSER=YES | 542 | SRS_HTTP_PARSER=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=YES | 545 | + SRS_STREAM_CASTER=NO |
| 546 | SRS_HTTP_API=YES | 546 | SRS_HTTP_API=YES |
| 547 | SRS_LIBRTMP=YES | 547 | SRS_LIBRTMP=YES |
| 548 | SRS_RESEARCH=NO | 548 | SRS_RESEARCH=NO |
| @@ -569,7 +569,7 @@ function apply_user_presets() { | @@ -569,7 +569,7 @@ function apply_user_presets() { | ||
| 569 | SRS_HTTP_PARSER=YES | 569 | SRS_HTTP_PARSER=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=YES | 572 | + SRS_STREAM_CASTER=NO |
| 573 | SRS_HTTP_API=YES | 573 | SRS_HTTP_API=YES |
| 574 | SRS_LIBRTMP=YES | 574 | SRS_LIBRTMP=YES |
| 575 | SRS_RESEARCH=NO | 575 | SRS_RESEARCH=NO |
| @@ -596,7 +596,7 @@ function apply_user_presets() { | @@ -596,7 +596,7 @@ function apply_user_presets() { | ||
| 596 | SRS_HTTP_PARSER=YES | 596 | SRS_HTTP_PARSER=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=YES | 599 | + SRS_STREAM_CASTER=NO |
| 600 | SRS_HTTP_API=NO | 600 | SRS_HTTP_API=NO |
| 601 | SRS_LIBRTMP=YES | 601 | SRS_LIBRTMP=YES |
| 602 | SRS_RESEARCH=NO | 602 | SRS_RESEARCH=NO |
| @@ -623,7 +623,7 @@ function apply_user_presets() { | @@ -623,7 +623,7 @@ function apply_user_presets() { | ||
| 623 | SRS_HTTP_PARSER=YES | 623 | SRS_HTTP_PARSER=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=YES | 626 | + SRS_STREAM_CASTER=NO |
| 627 | SRS_HTTP_API=YES | 627 | SRS_HTTP_API=YES |
| 628 | SRS_LIBRTMP=YES | 628 | SRS_LIBRTMP=YES |
| 629 | SRS_RESEARCH=YES | 629 | SRS_RESEARCH=YES |
| @@ -650,7 +650,7 @@ function apply_user_presets() { | @@ -650,7 +650,7 @@ function apply_user_presets() { | ||
| 650 | SRS_HTTP_PARSER=YES | 650 | SRS_HTTP_PARSER=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=YES | 653 | + SRS_STREAM_CASTER=NO |
| 654 | SRS_HTTP_API=YES | 654 | SRS_HTTP_API=YES |
| 655 | SRS_LIBRTMP=NO | 655 | SRS_LIBRTMP=NO |
| 656 | SRS_RESEARCH=NO | 656 | SRS_RESEARCH=NO |
| @@ -677,7 +677,7 @@ function apply_user_presets() { | @@ -677,7 +677,7 @@ function apply_user_presets() { | ||
| 677 | SRS_HTTP_PARSER=YES | 677 | SRS_HTTP_PARSER=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=YES | 680 | + SRS_STREAM_CASTER=NO |
| 681 | SRS_HTTP_API=YES | 681 | SRS_HTTP_API=YES |
| 682 | SRS_LIBRTMP=YES | 682 | SRS_LIBRTMP=YES |
| 683 | SRS_RESEARCH=NO | 683 | SRS_RESEARCH=NO |
| @@ -704,7 +704,7 @@ function apply_user_presets() { | @@ -704,7 +704,7 @@ function apply_user_presets() { | ||
| 704 | SRS_HTTP_PARSER=YES | 704 | SRS_HTTP_PARSER=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=YES | 707 | + SRS_STREAM_CASTER=NO |
| 708 | SRS_HTTP_API=YES | 708 | SRS_HTTP_API=YES |
| 709 | SRS_LIBRTMP=YES | 709 | SRS_LIBRTMP=YES |
| 710 | SRS_RESEARCH=NO | 710 | SRS_RESEARCH=NO |
| @@ -731,7 +731,7 @@ function apply_user_presets() { | @@ -731,7 +731,7 @@ function apply_user_presets() { | ||
| 731 | SRS_HTTP_PARSER=YES | 731 | SRS_HTTP_PARSER=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=YES | 734 | + SRS_STREAM_CASTER=NO |
| 735 | SRS_HTTP_API=YES | 735 | SRS_HTTP_API=YES |
| 736 | SRS_LIBRTMP=YES | 736 | SRS_LIBRTMP=YES |
| 737 | SRS_RESEARCH=NO | 737 | SRS_RESEARCH=NO |
| @@ -11,6 +11,7 @@ SrsIngestSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_INGEST = YES ]; then Sr | @@ -11,6 +11,7 @@ SrsIngestSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_INGEST = YES ]; then Sr | ||
| 11 | SrsHttpCallbackSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_CALLBACK = YES ]; then SrsHttpCallbackSummaryColor="\${GREEN}"; fi | 11 | SrsHttpCallbackSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_CALLBACK = YES ]; then SrsHttpCallbackSummaryColor="\${GREEN}"; fi |
| 12 | SrsHttpServerSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_SERVER = YES ]; then SrsHttpServerSummaryColor="\${GREEN}"; fi | 12 | SrsHttpServerSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_SERVER = YES ]; then SrsHttpServerSummaryColor="\${GREEN}"; fi |
| 13 | SrsHttpApiSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_API = YES ]; then SrsHttpApiSummaryColor="\${GREEN}"; fi | 13 | SrsHttpApiSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_API = YES ]; then SrsHttpApiSummaryColor="\${GREEN}"; fi |
| 14 | +SrsStreamCasterSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_STREAM_CASTER = YES ]; then SrsStreamCasterSummaryColor="\${GREEN}"; fi | ||
| 14 | SrsLibrtmpSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_LIBRTMP = YES ]; then SrsLibrtmpSummaryColor="\${GREEN}"; fi | 15 | SrsLibrtmpSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_LIBRTMP = YES ]; then SrsLibrtmpSummaryColor="\${GREEN}"; fi |
| 15 | SrsLibrtmpSSLSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_LIBRTMP = YES ]; then if [ $SRS_SSL = YES ]; then SrsLibrtmpSSLSummaryColor="\${GREEN}"; fi fi | 16 | SrsLibrtmpSSLSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_LIBRTMP = YES ]; then if [ $SRS_SSL = YES ]; then SrsLibrtmpSSLSummaryColor="\${GREEN}"; fi fi |
| 16 | SrsResearchSummaryColor="\${GREEN}{disabled} "; if [ $SRS_RESEARCH = YES ]; then SrsResearchSummaryColor="\${GREEN}"; fi | 17 | SrsResearchSummaryColor="\${GREEN}{disabled} "; if [ $SRS_RESEARCH = YES ]; then SrsResearchSummaryColor="\${GREEN}"; fi |
| @@ -71,11 +72,11 @@ echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/ | @@ -71,11 +72,11 @@ echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/ | ||
| 71 | echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/objs/srs_bandwidth_check\${BLACK}" | 72 | echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/objs/srs_bandwidth_check\${BLACK}" |
| 72 | echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}" | 73 | echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}" |
| 73 | echo -e " |\${GREEN}server: ./objs/srs -c conf/srs.conf, start the srs server\${BLACK}" | 74 | echo -e " |\${GREEN}server: ./objs/srs -c conf/srs.conf, start the srs server\${BLACK}" |
| 74 | -echo -e " | ${SrsHlsSummaryColor}hls @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DeliveryHLS\${BLACK}" | 75 | +echo -e " | ${SrsHlsSummaryColor}hls @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_DeliveryHLS\${BLACK}" |
| 75 | echo -e " | ${SrsHlsSummaryColor}hls: generate m3u8 and ts from rtmp stream\${BLACK}" | 76 | echo -e " | ${SrsHlsSummaryColor}hls: generate m3u8 and ts from rtmp stream\${BLACK}" |
| 76 | -echo -e " | ${SrsDvrSummaryColor}dvr @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DVR\${BLACK}" | 77 | +echo -e " | ${SrsDvrSummaryColor}dvr @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_DVR\${BLACK}" |
| 77 | echo -e " | ${SrsDvrSummaryColor}dvr: record RTMP stream to flv files.\${BLACK}" | 78 | echo -e " | ${SrsDvrSummaryColor}dvr: record RTMP stream to flv files.\${BLACK}" |
| 78 | -echo -e " | ${SrsNginxSummaryColor}nginx @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DeliveryHLS\${BLACK}" | 79 | +echo -e " | ${SrsNginxSummaryColor}nginx @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_DeliveryHLS\${BLACK}" |
| 79 | echo -e " | ${SrsNginxSummaryColor}nginx: delivery HLS stream by nginx\${BLACK}" | 80 | echo -e " | ${SrsNginxSummaryColor}nginx: delivery HLS stream by nginx\${BLACK}" |
| 80 | echo -e " | ${SrsNginxSummaryColor}nginx: sudo ./objs/nginx/sbin/nginx\${BLACK}" | 81 | echo -e " | ${SrsNginxSummaryColor}nginx: sudo ./objs/nginx/sbin/nginx\${BLACK}" |
| 81 | echo -e " | ${SrsSslSummaryColor}ssl @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_RTMPHandshake\${BLACK}" | 82 | echo -e " | ${SrsSslSummaryColor}ssl @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_RTMPHandshake\${BLACK}" |
| @@ -87,14 +88,16 @@ echo -e " | ${SrsTranscodeSummaryColor}transcode @see: https://github.co | @@ -87,14 +88,16 @@ echo -e " | ${SrsTranscodeSummaryColor}transcode @see: https://github.co | ||
| 87 | echo -e " | ${SrsTranscodeSummaryColor}transcode: support transcoding RTMP stream\${BLACK}" | 88 | echo -e " | ${SrsTranscodeSummaryColor}transcode: support transcoding RTMP stream\${BLACK}" |
| 88 | echo -e " | ${SrsIngestSummaryColor}ingest @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Ingest\${BLACK}" | 89 | echo -e " | ${SrsIngestSummaryColor}ingest @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Ingest\${BLACK}" |
| 89 | echo -e " | ${SrsIngestSummaryColor}ingest: support ingest file/stream/device then push to SRS by RTMP stream\${BLACK}" | 90 | echo -e " | ${SrsIngestSummaryColor}ingest: support ingest file/stream/device then push to SRS by RTMP stream\${BLACK}" |
| 90 | -echo -e " | ${SrsHttpCallbackSummaryColor}http-callback @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_HTTPCallback\${BLACK}" | 91 | +echo -e " | ${SrsHttpCallbackSummaryColor}http-callback @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_HTTPCallback\${BLACK}" |
| 91 | echo -e " | ${SrsHttpCallbackSummaryColor}http-callback: support http callback for authentication and event injection\${BLACK}" | 92 | echo -e " | ${SrsHttpCallbackSummaryColor}http-callback: support http callback for authentication and event injection\${BLACK}" |
| 92 | -echo -e " | ${SrsHttpServerSummaryColor}http-server @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_HTTPServer\${BLACK}" | 93 | +echo -e " | ${SrsHttpServerSummaryColor}http-server @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_HTTPServer\${BLACK}" |
| 93 | echo -e " | ${SrsHttpServerSummaryColor}http-server: support http server to delivery http stream\${BLACK}" | 94 | echo -e " | ${SrsHttpServerSummaryColor}http-server: support http server to delivery http stream\${BLACK}" |
| 94 | -echo -e " | ${SrsHttpApiSummaryColor}http-api @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_HTTPApi\${BLACK}" | 95 | +echo -e " | ${SrsHttpApiSummaryColor}http-api @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_HTTPApi\${BLACK}" |
| 95 | echo -e " | ${SrsHttpApiSummaryColor}http-api: support http api to manage server\${BLACK}" | 96 | echo -e " | ${SrsHttpApiSummaryColor}http-api: support http api to manage server\${BLACK}" |
| 97 | +echo -e " | ${SrsStreamCasterSummaryColor}stream-caster @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_Streamer\${BLACK}" | ||
| 98 | +echo -e " | ${SrsStreamCasterSummaryColor}stream-caster: start server to cast stream over other protocols.\${BLACK}" | ||
| 96 | echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}" | 99 | echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}" |
| 97 | -echo -e "\${GREEN}binaries @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Build\${BLACK}" | 100 | +echo -e "\${GREEN}binaries @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_Build\${BLACK}" |
| 98 | 101 | ||
| 99 | echo "You can:" | 102 | echo "You can:" |
| 100 | echo " ./objs/srs -c conf/srs.conf" | 103 | echo " ./objs/srs -c conf/srs.conf" |
| @@ -474,6 +474,12 @@ vhost http.remux.srs.com { | @@ -474,6 +474,12 @@ vhost http.remux.srs.com { | ||
| 474 | # @remark the port of http is specified by http_server section. | 474 | # @remark the port of http is specified by http_server section. |
| 475 | # default: [vhost]/[app]/[stream].flv | 475 | # default: [vhost]/[app]/[stream].flv |
| 476 | mount [vhost]/[app]/[stream].flv; | 476 | mount [vhost]/[app]/[stream].flv; |
| 477 | + # whether http stream trigger rtmp stream source when no stream available, | ||
| 478 | + # for example, when encoder has not publish stream yet, | ||
| 479 | + # user can play the http flv stream and wait for stream. | ||
| 480 | + # TODO: FIXME: for edge vhost, automatically trigger the backsource connection. | ||
| 481 | + # default: on | ||
| 482 | + hstrs on; | ||
| 477 | } | 483 | } |
| 478 | } | 484 | } |
| 479 | 485 |
| @@ -15,10 +15,18 @@ GREEN="\\033[32m" | @@ -15,10 +15,18 @@ GREEN="\\033[32m" | ||
| 15 | YELLOW="\\033[33m" | 15 | YELLOW="\\033[33m" |
| 16 | BLACK="\\033[0m" | 16 | BLACK="\\033[0m" |
| 17 | 17 | ||
| 18 | +##################################################################################### | ||
| 19 | +# parse user options, set the variables like: | ||
| 20 | +# srs features: SRS_SSL/SRS_HLS/SRS_NGINX/SRS_FFMPEG_TOOL/SRS_HTTP_CALLBACK/...... | ||
| 21 | +# build options: SRS_JOBS | ||
| 22 | +##################################################################################### | ||
| 23 | +# parse options, exit with error when parse options invalid. | ||
| 24 | +. auto/options.sh | ||
| 25 | + | ||
| 18 | # clean the exists, when not export srs-librtmp. | 26 | # clean the exists, when not export srs-librtmp. |
| 19 | # do this only when the options is ok. | 27 | # do this only when the options is ok. |
| 20 | if [[ -f Makefile ]]; then | 28 | if [[ -f Makefile ]]; then |
| 21 | - make clean | 29 | +make clean |
| 22 | fi | 30 | fi |
| 23 | # remove makefile | 31 | # remove makefile |
| 24 | rm -f ${SRS_WORKDIR}/${SRS_MAKEFILE} | 32 | rm -f ${SRS_WORKDIR}/${SRS_MAKEFILE} |
| @@ -26,14 +34,6 @@ rm -f ${SRS_WORKDIR}/${SRS_MAKEFILE} | @@ -26,14 +34,6 @@ rm -f ${SRS_WORKDIR}/${SRS_MAKEFILE} | ||
| 26 | # create objs | 34 | # create objs |
| 27 | mkdir -p ${SRS_OBJS} | 35 | mkdir -p ${SRS_OBJS} |
| 28 | 36 | ||
| 29 | -##################################################################################### | ||
| 30 | -# parse user options, set the variables like: | ||
| 31 | -# srs features: SRS_SSL/SRS_HLS/SRS_NGINX/SRS_FFMPEG_TOOL/SRS_HTTP_CALLBACK/...... | ||
| 32 | -# build options: SRS_JOBS | ||
| 33 | -##################################################################################### | ||
| 34 | -# parse options, exit with error when parse options invalid. | ||
| 35 | -. auto/options.sh | ||
| 36 | - | ||
| 37 | # for export srs-librtmp, change target to it. | 37 | # for export srs-librtmp, change target to it. |
| 38 | . auto/generate-srs-librtmp-project.sh | 38 | . auto/generate-srs-librtmp-project.sh |
| 39 | 39 |
| @@ -1471,7 +1471,7 @@ int SrsConfig::check_config() | @@ -1471,7 +1471,7 @@ int SrsConfig::check_config() | ||
| 1471 | } else if (n == "http_remux") { | 1471 | } else if (n == "http_remux") { |
| 1472 | for (int j = 0; j < (int)conf->directives.size(); j++) { | 1472 | for (int j = 0; j < (int)conf->directives.size(); j++) { |
| 1473 | string m = conf->at(j)->name.c_str(); | 1473 | string m = conf->at(j)->name.c_str(); |
| 1474 | - if (m != "enabled" && m != "mount" && m != "fast_cache") { | 1474 | + if (m != "enabled" && m != "mount" && m != "fast_cache" && m != "crss") { |
| 1475 | ret = ERROR_SYSTEM_CONFIG_INVALID; | 1475 | ret = ERROR_SYSTEM_CONFIG_INVALID; |
| 1476 | srs_error("unsupported vhost http_remux directive %s, ret=%d", m.c_str(), ret); | 1476 | srs_error("unsupported vhost http_remux directive %s, ret=%d", m.c_str(), ret); |
| 1477 | return ret; | 1477 | return ret; |
| @@ -3751,6 +3751,30 @@ string SrsConfig::get_vhost_http_remux_mount(string vhost) | @@ -3751,6 +3751,30 @@ string SrsConfig::get_vhost_http_remux_mount(string vhost) | ||
| 3751 | return conf->arg0(); | 3751 | return conf->arg0(); |
| 3752 | } | 3752 | } |
| 3753 | 3753 | ||
| 3754 | +bool SrsConfig::get_vhost_http_remux_hstrs(string vhost) | ||
| 3755 | +{ | ||
| 3756 | + SrsConfDirective* conf = get_vhost(vhost); | ||
| 3757 | + if (!conf) { | ||
| 3758 | + return false; | ||
| 3759 | + } | ||
| 3760 | + | ||
| 3761 | + conf = conf->get("http_remux"); | ||
| 3762 | + if (!conf) { | ||
| 3763 | + return false; | ||
| 3764 | + } | ||
| 3765 | + | ||
| 3766 | + conf = conf->get("hstrs"); | ||
| 3767 | + if (!conf) { | ||
| 3768 | + return false; | ||
| 3769 | + } | ||
| 3770 | + | ||
| 3771 | + if (conf->arg0() == "on") { | ||
| 3772 | + return true; | ||
| 3773 | + } | ||
| 3774 | + | ||
| 3775 | + return false; | ||
| 3776 | +} | ||
| 3777 | + | ||
| 3754 | SrsConfDirective* SrsConfig::get_heartbeart() | 3778 | SrsConfDirective* SrsConfig::get_heartbeart() |
| 3755 | { | 3779 | { |
| 3756 | return root->get("heartbeat"); | 3780 | return root->get("heartbeat"); |
| @@ -1041,6 +1041,10 @@ public: | @@ -1041,6 +1041,10 @@ public: | ||
| 1041 | * used to generate the flv stream mount path. | 1041 | * used to generate the flv stream mount path. |
| 1042 | */ | 1042 | */ |
| 1043 | virtual std::string get_vhost_http_remux_mount(std::string vhost); | 1043 | virtual std::string get_vhost_http_remux_mount(std::string vhost); |
| 1044 | + /** | ||
| 1045 | + * get whether the hstrs(http stream trigger rtmp source) enabled. | ||
| 1046 | + */ | ||
| 1047 | + virtual bool get_vhost_http_remux_hstrs(std::string vhost); | ||
| 1044 | // http heartbeart section | 1048 | // http heartbeart section |
| 1045 | private: | 1049 | private: |
| 1046 | /** | 1050 | /** |
| @@ -1269,9 +1269,9 @@ int SrsHttpParser::parse_message(SrsStSocket* skt, SrsHttpMessage** ppmsg) | @@ -1269,9 +1269,9 @@ int SrsHttpParser::parse_message(SrsStSocket* skt, SrsHttpMessage** ppmsg) | ||
| 1269 | int ret = ERROR_SUCCESS; | 1269 | int ret = ERROR_SUCCESS; |
| 1270 | 1270 | ||
| 1271 | // reset request data. | 1271 | // reset request data. |
| 1272 | - filed_name = ""; | 1272 | + field_name = ""; |
| 1273 | field_value = ""; | 1273 | field_value = ""; |
| 1274 | - expect_filed_name = true; | 1274 | + expect_field_name = true; |
| 1275 | state = SrsHttpParseStateInit; | 1275 | state = SrsHttpParseStateInit; |
| 1276 | header = http_parser(); | 1276 | header = http_parser(); |
| 1277 | url = ""; | 1277 | url = ""; |
| @@ -1339,8 +1339,8 @@ int SrsHttpParser::parse_message_imp(SrsStSocket* skt) | @@ -1339,8 +1339,8 @@ int SrsHttpParser::parse_message_imp(SrsStSocket* skt) | ||
| 1339 | } | 1339 | } |
| 1340 | 1340 | ||
| 1341 | // parse last header. | 1341 | // parse last header. |
| 1342 | - if (!filed_name.empty() && !field_value.empty()) { | ||
| 1343 | - headers.push_back(std::make_pair(filed_name, field_value)); | 1342 | + if (!field_name.empty() && !field_value.empty()) { |
| 1343 | + headers.push_back(std::make_pair(field_name, field_value)); | ||
| 1344 | } | 1344 | } |
| 1345 | 1345 | ||
| 1346 | return ret; | 1346 | return ret; |
| @@ -1406,17 +1406,17 @@ int SrsHttpParser::on_header_field(http_parser* parser, const char* at, size_t l | @@ -1406,17 +1406,17 @@ int SrsHttpParser::on_header_field(http_parser* parser, const char* at, size_t l | ||
| 1406 | srs_assert(obj); | 1406 | srs_assert(obj); |
| 1407 | 1407 | ||
| 1408 | // field value=>name, reap the field. | 1408 | // field value=>name, reap the field. |
| 1409 | - if (!obj->expect_filed_name) { | ||
| 1410 | - obj->headers.push_back(std::make_pair(obj->filed_name, obj->field_value)); | 1409 | + if (!obj->expect_field_name) { |
| 1410 | + obj->headers.push_back(std::make_pair(obj->field_name, obj->field_value)); | ||
| 1411 | 1411 | ||
| 1412 | // reset the field name when parsed. | 1412 | // reset the field name when parsed. |
| 1413 | - obj->filed_name = ""; | 1413 | + obj->field_name = ""; |
| 1414 | obj->field_value = ""; | 1414 | obj->field_value = ""; |
| 1415 | } | 1415 | } |
| 1416 | - obj->expect_filed_name = true; | 1416 | + obj->expect_field_name = true; |
| 1417 | 1417 | ||
| 1418 | if (length > 0) { | 1418 | if (length > 0) { |
| 1419 | - obj->filed_name.append(at, (int)length); | 1419 | + obj->field_name.append(at, (int)length); |
| 1420 | } | 1420 | } |
| 1421 | 1421 | ||
| 1422 | srs_info("Header field(%d bytes): %.*s", (int)length, (int)length, at); | 1422 | srs_info("Header field(%d bytes): %.*s", (int)length, (int)length, at); |
| @@ -1431,7 +1431,7 @@ int SrsHttpParser::on_header_value(http_parser* parser, const char* at, size_t l | @@ -1431,7 +1431,7 @@ int SrsHttpParser::on_header_value(http_parser* parser, const char* at, size_t l | ||
| 1431 | if (length > 0) { | 1431 | if (length > 0) { |
| 1432 | obj->field_value.append(at, (int)length); | 1432 | obj->field_value.append(at, (int)length); |
| 1433 | } | 1433 | } |
| 1434 | - obj->expect_filed_name = false; | 1434 | + obj->expect_field_name = false; |
| 1435 | 1435 | ||
| 1436 | srs_info("Header value(%d bytes): %.*s", (int)length, (int)length, at); | 1436 | srs_info("Header value(%d bytes): %.*s", (int)length, (int)length, at); |
| 1437 | return 0; | 1437 | return 0; |
| @@ -330,9 +330,13 @@ public: | @@ -330,9 +330,13 @@ public: | ||
| 330 | class SrsHttpServeMux | 330 | class SrsHttpServeMux |
| 331 | { | 331 | { |
| 332 | private: | 332 | private: |
| 333 | - // the pattern handler. | 333 | + // the pattern handler, to handle the http request. |
| 334 | std::map<std::string, SrsHttpMuxEntry*> entries; | 334 | std::map<std::string, SrsHttpMuxEntry*> entries; |
| 335 | // the vhost handler. | 335 | // the vhost handler. |
| 336 | + // when find the handler to process the request, | ||
| 337 | + // append the matched vhost when pattern not starts with /, | ||
| 338 | + // for example, for pattern /live/livestream.flv of vhost ossrs.net, | ||
| 339 | + // the path will rewrite to ossrs.net/live/livestream.flv | ||
| 336 | std::map<std::string, ISrsHttpHandler*> vhosts; | 340 | std::map<std::string, ISrsHttpHandler*> vhosts; |
| 337 | public: | 341 | public: |
| 338 | SrsHttpServeMux(); | 342 | SrsHttpServeMux(); |
| @@ -544,8 +548,8 @@ private: | @@ -544,8 +548,8 @@ private: | ||
| 544 | SrsFastBuffer* buffer; | 548 | SrsFastBuffer* buffer; |
| 545 | private: | 549 | private: |
| 546 | // http parse data, reset before parse message. | 550 | // http parse data, reset before parse message. |
| 547 | - bool expect_filed_name; | ||
| 548 | - std::string filed_name; | 551 | + bool expect_field_name; |
| 552 | + std::string field_name; | ||
| 549 | std::string field_value; | 553 | std::string field_value; |
| 550 | SrsHttpParseState state; | 554 | SrsHttpParseState state; |
| 551 | http_parser header; | 555 | http_parser header; |
| @@ -826,7 +826,7 @@ int SrsHttpServer::initialize() | @@ -826,7 +826,7 @@ int SrsHttpServer::initialize() | ||
| 826 | return ret; | 826 | return ret; |
| 827 | } | 827 | } |
| 828 | 828 | ||
| 829 | -int SrsHttpServer::mount(SrsSource* s, SrsRequest* r) | 829 | +int SrsHttpServer::http_mount(SrsSource* s, SrsRequest* r) |
| 830 | { | 830 | { |
| 831 | int ret = ERROR_SUCCESS; | 831 | int ret = ERROR_SUCCESS; |
| 832 | 832 | ||
| @@ -886,7 +886,7 @@ int SrsHttpServer::mount(SrsSource* s, SrsRequest* r) | @@ -886,7 +886,7 @@ int SrsHttpServer::mount(SrsSource* s, SrsRequest* r) | ||
| 886 | return ret; | 886 | return ret; |
| 887 | } | 887 | } |
| 888 | 888 | ||
| 889 | -void SrsHttpServer::unmount(SrsSource* s, SrsRequest* r) | 889 | +void SrsHttpServer::http_unmount(SrsSource* s, SrsRequest* r) |
| 890 | { | 890 | { |
| 891 | std::string sid = r->get_stream_url(); | 891 | std::string sid = r->get_stream_url(); |
| 892 | 892 | ||
| @@ -1185,7 +1185,7 @@ SrsHttpConn::SrsHttpConn(SrsServer* svr, st_netfd_t fd, SrsHttpServer* m) | @@ -1185,7 +1185,7 @@ SrsHttpConn::SrsHttpConn(SrsServer* svr, st_netfd_t fd, SrsHttpServer* m) | ||
| 1185 | : SrsConnection(svr, fd) | 1185 | : SrsConnection(svr, fd) |
| 1186 | { | 1186 | { |
| 1187 | parser = new SrsHttpParser(); | 1187 | parser = new SrsHttpParser(); |
| 1188 | - mux = m; | 1188 | + http_server = m; |
| 1189 | } | 1189 | } |
| 1190 | 1190 | ||
| 1191 | SrsHttpConn::~SrsHttpConn() | 1191 | SrsHttpConn::~SrsHttpConn() |
| @@ -1271,7 +1271,7 @@ int SrsHttpConn::process_request(ISrsHttpResponseWriter* w, SrsHttpMessage* r) | @@ -1271,7 +1271,7 @@ int SrsHttpConn::process_request(ISrsHttpResponseWriter* w, SrsHttpMessage* r) | ||
| 1271 | r->method_str().c_str(), r->url().c_str(), r->content_length()); | 1271 | r->method_str().c_str(), r->url().c_str(), r->content_length()); |
| 1272 | 1272 | ||
| 1273 | // use default server mux to serve http request. | 1273 | // use default server mux to serve http request. |
| 1274 | - if ((ret = mux->mux.serve_http(w, r)) != ERROR_SUCCESS) { | 1274 | + if ((ret = http_server->mux.serve_http(w, r)) != ERROR_SUCCESS) { |
| 1275 | if (!srs_is_client_gracefully_close(ret)) { | 1275 | if (!srs_is_client_gracefully_close(ret)) { |
| 1276 | srs_error("serve http msg failed. ret=%d", ret); | 1276 | srs_error("serve http msg failed. ret=%d", ret); |
| 1277 | } | 1277 | } |
| @@ -333,8 +333,8 @@ public: | @@ -333,8 +333,8 @@ public: | ||
| 333 | virtual int initialize(); | 333 | virtual int initialize(); |
| 334 | // http flv/ts/mp3/aac stream | 334 | // http flv/ts/mp3/aac stream |
| 335 | public: | 335 | public: |
| 336 | - virtual int mount(SrsSource* s, SrsRequest* r); | ||
| 337 | - virtual void unmount(SrsSource* s, SrsRequest* r); | 336 | + virtual int http_mount(SrsSource* s, SrsRequest* r); |
| 337 | + virtual void http_unmount(SrsSource* s, SrsRequest* r); | ||
| 338 | // hls stream | 338 | // hls stream |
| 339 | public: | 339 | public: |
| 340 | virtual int mount_hls(SrsRequest* r); | 340 | virtual int mount_hls(SrsRequest* r); |
| @@ -356,7 +356,7 @@ class SrsHttpConn : public SrsConnection | @@ -356,7 +356,7 @@ class SrsHttpConn : public SrsConnection | ||
| 356 | { | 356 | { |
| 357 | private: | 357 | private: |
| 358 | SrsHttpParser* parser; | 358 | SrsHttpParser* parser; |
| 359 | - SrsHttpServer* mux; | 359 | + SrsHttpServer* http_server; |
| 360 | public: | 360 | public: |
| 361 | SrsHttpConn(SrsServer* svr, st_netfd_t fd, SrsHttpServer* m); | 361 | SrsHttpConn(SrsServer* svr, st_netfd_t fd, SrsHttpServer* m); |
| 362 | virtual ~SrsHttpConn(); | 362 | virtual ~SrsHttpConn(); |
| @@ -1195,7 +1195,7 @@ int SrsServer::on_publish(SrsSource* s, SrsRequest* r) | @@ -1195,7 +1195,7 @@ int SrsServer::on_publish(SrsSource* s, SrsRequest* r) | ||
| 1195 | int ret = ERROR_SUCCESS; | 1195 | int ret = ERROR_SUCCESS; |
| 1196 | 1196 | ||
| 1197 | #ifdef SRS_AUTO_HTTP_SERVER | 1197 | #ifdef SRS_AUTO_HTTP_SERVER |
| 1198 | - if ((ret = http_stream_mux->mount(s, r)) != ERROR_SUCCESS) { | 1198 | + if ((ret = http_stream_mux->http_mount(s, r)) != ERROR_SUCCESS) { |
| 1199 | return ret; | 1199 | return ret; |
| 1200 | } | 1200 | } |
| 1201 | #endif | 1201 | #endif |
| @@ -1206,7 +1206,7 @@ int SrsServer::on_publish(SrsSource* s, SrsRequest* r) | @@ -1206,7 +1206,7 @@ int SrsServer::on_publish(SrsSource* s, SrsRequest* r) | ||
| 1206 | void SrsServer::on_unpublish(SrsSource* s, SrsRequest* r) | 1206 | void SrsServer::on_unpublish(SrsSource* s, SrsRequest* r) |
| 1207 | { | 1207 | { |
| 1208 | #ifdef SRS_AUTO_HTTP_SERVER | 1208 | #ifdef SRS_AUTO_HTTP_SERVER |
| 1209 | - http_stream_mux->unmount(s, r); | 1209 | + http_stream_mux->http_unmount(s, r); |
| 1210 | #endif | 1210 | #endif |
| 1211 | } | 1211 | } |
| 1212 | 1212 |
-
请 注册 或 登录 后发表评论