reorder the config functions. add comments for st to support 100k threads, use MALLOC_STACK macro.
正在显示
3 个修改的文件
包含
26 行增加
和
24 行删除
| @@ -283,7 +283,7 @@ install-api: install | @@ -283,7 +283,7 @@ install-api: install | ||
| 283 | @sed -i "s|^ROOT=.*|ROOT=\"\$(SRS_PREFIX)\"|g" \$(__REAL_INSTALL)/etc/init.d/srs-api | 283 | @sed -i "s|^ROOT=.*|ROOT=\"\$(SRS_PREFIX)\"|g" \$(__REAL_INSTALL)/etc/init.d/srs-api |
| 284 | @echo "" | 284 | @echo "" |
| 285 | @echo "api installed, to link and start api:" | 285 | @echo "api installed, to link and start api:" |
| 286 | - @echo " sudo ln -sf /usr/local/srs/etc/init.d/srs-api /etc/init.d/srs-api" | 286 | + @echo " sudo ln -sf \$(SRS_PREFIX)/etc/init.d/srs-api /etc/init.d/srs-api" |
| 287 | @echo " /etc/init.d/srs-api start" | 287 | @echo " /etc/init.d/srs-api start" |
| 288 | @echo " http://\$(shell bash auto/local_ip.sh):8085" | 288 | @echo " http://\$(shell bash auto/local_ip.sh):8085" |
| 289 | @echo "@see: https://github.com/winlinvip/simple-rtmp-server/wiki/LinuxService" | 289 | @echo "@see: https://github.com/winlinvip/simple-rtmp-server/wiki/LinuxService" |
| @@ -306,7 +306,7 @@ install: | @@ -306,7 +306,7 @@ install: | ||
| 306 | @sed -i "s|^ROOT=.*|ROOT=\"\$(SRS_PREFIX)\"|g" \$(__REAL_INSTALL)/etc/init.d/srs | 306 | @sed -i "s|^ROOT=.*|ROOT=\"\$(SRS_PREFIX)\"|g" \$(__REAL_INSTALL)/etc/init.d/srs |
| 307 | @echo "" | 307 | @echo "" |
| 308 | @echo "srs installed, to link and start srs:" | 308 | @echo "srs installed, to link and start srs:" |
| 309 | - @echo " sudo ln -sf /usr/local/srs/etc/init.d/srs /etc/init.d/srs" | 309 | + @echo " sudo ln -sf \$(SRS_PREFIX)/etc/init.d/srs /etc/init.d/srs" |
| 310 | @echo " /etc/init.d/srs start" | 310 | @echo " /etc/init.d/srs start" |
| 311 | @echo "@see: https://github.com/winlinvip/simple-rtmp-server/wiki/LinuxService" | 311 | @echo "@see: https://github.com/winlinvip/simple-rtmp-server/wiki/LinuxService" |
| 312 | 312 |
| @@ -2746,58 +2746,58 @@ string SrsConfig::get_ingest_input_url(SrsConfDirective* ingest) | @@ -2746,58 +2746,58 @@ string SrsConfig::get_ingest_input_url(SrsConfDirective* ingest) | ||
| 2746 | return conf->arg0(); | 2746 | return conf->arg0(); |
| 2747 | } | 2747 | } |
| 2748 | 2748 | ||
| 2749 | -string SrsConfig::get_log_file() | 2749 | +bool SrsConfig::get_log_tank_file() |
| 2750 | { | 2750 | { |
| 2751 | srs_assert(root); | 2751 | srs_assert(root); |
| 2752 | 2752 | ||
| 2753 | - SrsConfDirective* conf = root->get("srs_log_file"); | ||
| 2754 | - if (!conf || conf->arg0().empty()) { | ||
| 2755 | - return SRS_CONF_DEFAULT_LOG_FILE; | 2753 | + SrsConfDirective* conf = root->get("srs_log_tank"); |
| 2754 | + if (conf && conf->arg0() == SRS_CONF_DEFAULT_LOG_TANK_CONSOLE) { | ||
| 2755 | + return false; | ||
| 2756 | } | 2756 | } |
| 2757 | 2757 | ||
| 2758 | - return conf->arg0(); | ||
| 2759 | -} | ||
| 2760 | - | ||
| 2761 | -bool SrsConfig::get_ffmpeg_log_enabled() | ||
| 2762 | -{ | ||
| 2763 | - string log = get_ffmpeg_log_dir(); | ||
| 2764 | - return log != SRS_CONSTS_NULL_FILE; | 2758 | + return true; |
| 2765 | } | 2759 | } |
| 2766 | 2760 | ||
| 2767 | -string SrsConfig::get_ffmpeg_log_dir() | 2761 | +string SrsConfig::get_log_level() |
| 2768 | { | 2762 | { |
| 2769 | srs_assert(root); | 2763 | srs_assert(root); |
| 2770 | 2764 | ||
| 2771 | - SrsConfDirective* conf = root->get("ff_log_dir"); | 2765 | + SrsConfDirective* conf = root->get("srs_log_level"); |
| 2772 | if (!conf || conf->arg0().empty()) { | 2766 | if (!conf || conf->arg0().empty()) { |
| 2773 | - return SRS_CONF_DEFAULT_FF_LOG_DIR; | 2767 | + return SRS_CONF_DEFAULT_LOG_LEVEL; |
| 2774 | } | 2768 | } |
| 2775 | 2769 | ||
| 2776 | return conf->arg0(); | 2770 | return conf->arg0(); |
| 2777 | } | 2771 | } |
| 2778 | 2772 | ||
| 2779 | -string SrsConfig::get_log_level() | 2773 | +string SrsConfig::get_log_file() |
| 2780 | { | 2774 | { |
| 2781 | srs_assert(root); | 2775 | srs_assert(root); |
| 2782 | 2776 | ||
| 2783 | - SrsConfDirective* conf = root->get("srs_log_level"); | 2777 | + SrsConfDirective* conf = root->get("srs_log_file"); |
| 2784 | if (!conf || conf->arg0().empty()) { | 2778 | if (!conf || conf->arg0().empty()) { |
| 2785 | - return SRS_CONF_DEFAULT_LOG_LEVEL; | 2779 | + return SRS_CONF_DEFAULT_LOG_FILE; |
| 2786 | } | 2780 | } |
| 2787 | 2781 | ||
| 2788 | return conf->arg0(); | 2782 | return conf->arg0(); |
| 2789 | } | 2783 | } |
| 2790 | 2784 | ||
| 2791 | -bool SrsConfig::get_log_tank_file() | 2785 | +bool SrsConfig::get_ffmpeg_log_enabled() |
| 2786 | +{ | ||
| 2787 | + string log = get_ffmpeg_log_dir(); | ||
| 2788 | + return log != SRS_CONSTS_NULL_FILE; | ||
| 2789 | +} | ||
| 2790 | + | ||
| 2791 | +string SrsConfig::get_ffmpeg_log_dir() | ||
| 2792 | { | 2792 | { |
| 2793 | srs_assert(root); | 2793 | srs_assert(root); |
| 2794 | 2794 | ||
| 2795 | - SrsConfDirective* conf = root->get("srs_log_tank"); | ||
| 2796 | - if (conf && conf->arg0() == SRS_CONF_DEFAULT_LOG_TANK_CONSOLE) { | ||
| 2797 | - return false; | 2795 | + SrsConfDirective* conf = root->get("ff_log_dir"); |
| 2796 | + if (!conf || conf->arg0().empty()) { | ||
| 2797 | + return SRS_CONF_DEFAULT_FF_LOG_DIR; | ||
| 2798 | } | 2798 | } |
| 2799 | 2799 | ||
| 2800 | - return true; | 2800 | + return conf->arg0(); |
| 2801 | } | 2801 | } |
| 2802 | 2802 | ||
| 2803 | SrsConfDirective* SrsConfig::get_hls(string vhost) | 2803 | SrsConfDirective* SrsConfig::get_hls(string vhost) |
| @@ -545,6 +545,8 @@ int SrsServer::initialize_st() | @@ -545,6 +545,8 @@ int SrsServer::initialize_st() | ||
| 545 | } | 545 | } |
| 546 | srs_verbose("st_set_eventsys use linux epoll success"); | 546 | srs_verbose("st_set_eventsys use linux epoll success"); |
| 547 | 547 | ||
| 548 | + // @remark, st alloc segment use mmap, which only support 32757 threads, | ||
| 549 | + // if need to support more, for instance, 100k threads, define the macro MALLOC_STACK. | ||
| 548 | if(st_init() != 0){ | 550 | if(st_init() != 0){ |
| 549 | ret = ERROR_ST_INITIALIZE; | 551 | ret = ERROR_ST_INITIALIZE; |
| 550 | srs_error("st_init failed. ret=%d", ret); | 552 | srs_error("st_init failed. ret=%d", ret); |
-
请 注册 或 登录 后发表评论