From 7240fe304092a91c97bc36fb3f0c1d34f41f506c Mon Sep 17 00:00:00 2001 From: winlin Date: Wed, 15 Jan 2020 21:26:02 +0800 Subject: [PATCH] For #1509, decrease the fast vector init size from 64KB to 64B. 3.0.99 --- README.md | 1 + trunk/auto/options.sh | 20 ++++---------------- trunk/auto/summary.sh | 5 +---- trunk/src/app/srs_app_config.cpp | 8 ++++---- trunk/src/app/srs_app_http_stream.cpp | 8 ++++---- trunk/src/app/srs_app_source.cpp | 4 ++-- trunk/src/core/srs_core.hpp | 2 +- 7 files changed, 17 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 31b8e31f2d..f082fa7bbd 100755 --- a/README.md +++ b/README.md @@ -146,6 +146,7 @@ For previous versions, please read: ## V3 changes +* v3.0, 2020-01-15, For [#1509][bug #1509], decrease the fast vector init size from 64KB to 64B. 3.0.99 * v3.0, 2020-01-15, For [#1509][bug #1509], release coroutine when source is idle. 3.0.98 * v3.0, 2020-01-10, [3.0 alpha8(3.0.97)][r3.0a8] released. 121555 lines. * v3.0, 2020-01-09, For [#1042][bug #1042], improve test coverage for service. 3.0.97 diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh index a6436535c6..d19e18356f 100755 --- a/trunk/auto/options.sh +++ b/trunk/auto/options.sh @@ -122,6 +122,7 @@ Options: --with-research build the research tools. --with-utest build the utest for SRS. --with-gperf build SRS with gperf tools(no gmd/gmc/gmp/gcp, with tcmalloc only). + https://blog.csdn.net/win_lin/article/details/53503869 --with-gmc build memory check for SRS with gperf tools. --with-gmd build memory defense(corrupt memory) for SRS with gperf tools. --with-gmp build memory profile for SRS with gperf tools. @@ -198,6 +199,7 @@ Experts: --memory-watch enable memory watch to detect memory leaking(hurts performance). --export-librtmp-project= export srs-librtmp to specified project in path. --export-librtmp-single= export srs-librtmp to a single file(.h+.cpp) in path. + --with-valgrind support valgrind for memory check. --without-valgrind donot support valgrind for memory check. Workflow: @@ -207,10 +209,7 @@ Workflow: 4. generate detail features. Remark: - 1. both ubuntu12 and ubuntu14 are ok for SRS. - 2. the centos5, centos6 and centos7 are ok for SRS. - 3. all linux and unix-like os are ok for SRS. - 4. windows is absolutely impossible for SRS. + 1. For performance improving, read https://blog.csdn.net/win_lin/article/details/53503869 END } @@ -289,6 +288,7 @@ function parse_user_option() { --memory-watch) SRS_MEM_WATCH=YES ;; --export-librtmp-project) SRS_EXPORT_LIBRTMP_PROJECT=${value} ;; --export-librtmp-single) SRS_EXPORT_LIBRTMP_SINGLE=${value} ;; + --with-valgrind) SRS_VALGRIND=YES ;; --without-valgrind) SRS_VALGRIND=NO ;; --with-http-callback) SRS_HTTP_CALLBACK=YES ;; @@ -395,18 +395,6 @@ function apply_user_presets() { SRS_STATIC=NO fi - # for osx(darwin) - if [ $SRS_OSX = YES ]; then - SRS_HDS=YES - SRS_LIBRTMP=YES - SRS_RESEARCH=NO - SRS_UTEST=YES - SRS_STATIC=NO - # valgrind is not supported by macOS sierra, read - # https://stackoverflow.com/questions/40650338/valgrind-on-macos-sierra - SRS_VALGRIND=NO - fi - # if dev specified, open features if possible. if [ $SRS_DEV = YES ]; then SRS_HDS=YES diff --git a/trunk/auto/summary.sh b/trunk/auto/summary.sh index f19a27722a..0af1673b18 100755 --- a/trunk/auto/summary.sh +++ b/trunk/auto/summary.sh @@ -43,16 +43,13 @@ echo -e " \${BLACK}+-------------------------------------------------------- echo -e " |\${GREEN}The main server usage: ./objs/srs -c conf/srs.conf, start the srs server\${BLACK}" echo -e " | ${SrsHlsSummaryColor}About HLS, please read https://github.com/ossrs/srs/wiki/v2_CN_DeliveryHLS\${BLACK}" echo -e " | ${SrsDvrSummaryColor}About DVR, please read https://github.com/ossrs/srs/wiki/v3_CN_DVR\${BLACK}" -echo -e " | ${SrsNginxSummaryColor}About NGINX, please read https://github.com/ossrs/srs/wiki/v2_CN_DeliveryHLS\${BLACK}" echo -e " | ${SrsSslSummaryColor}About SSL, please read https://github.com/ossrs/srs/wiki/v1_CN_RTMPHandshake\${BLACK}" -echo -e " | ${SrsFfmpegSummaryColor}About FFMPEG, please read https://github.com/ossrs/srs/wiki/v3_CN_FFMPEG\${BLACK}" echo -e " | ${SrsTranscodeSummaryColor}About transcoding, please read https://github.com/ossrs/srs/wiki/v3_CN_FFMPEG\${BLACK}" echo -e " | ${SrsIngestSummaryColor}About ingester, please read https://github.com/ossrs/srs/wiki/v1_CN_Ingest\${BLACK}" echo -e " | ${SrsHttpCallbackSummaryColor}About http-callback, please read https://github.com/ossrs/srs/wiki/v3_CN_HTTPCallback\${BLACK}" -echo -e " | ${SrsHttpServerSummaryColor}Aoubt embeded http-server, please read https://github.com/ossrs/srs/wiki/v2_CN_HTTPServer\${BLACK}" +echo -e " | ${SrsHttpServerSummaryColor}Aoubt http-server, please read https://github.com/ossrs/srs/wiki/v2_CN_HTTPServer\${BLACK}" echo -e " | ${SrsHttpApiSummaryColor}About http-api, please read https://github.com/ossrs/srs/wiki/v3_CN_HTTPApi\${BLACK}" echo -e " | ${SrsStreamCasterSummaryColor}About stream-caster, please read https://github.com/ossrs/srs/wiki/v2_CN_Streamer\${BLACK}" -echo -e " | ${SrsKafkaSummaryColor}About kafka, please read https://github.com/ossrs/srs/wiki/v3_CN_Kafka\${BLACK}" echo -e " | ${SrsValgrindSummaryColor}About VALGRIND, please read https://github.com/ossrs/state-threads/issues/2\${BLACK}" echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}" echo -e "\${GREEN}binaries, please read https://github.com/ossrs/srs/wiki/v2_CN_Build\${BLACK}" diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index a0277f3c95..20594b917d 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -6771,22 +6771,22 @@ string SrsConfig::get_vhost_http_dir(string vhost) bool SrsConfig::get_vhost_http_remux_enabled(string vhost) { static bool DEFAULT = false; - + SrsConfDirective* conf = get_vhost(vhost); if (!conf) { return DEFAULT; } - + conf = conf->get("http_remux"); if (!conf) { return DEFAULT; } - + conf = conf->get("enabled"); if (!conf || conf->arg0().empty()) { return DEFAULT; } - + return SRS_CONF_PERFER_FALSE(conf->arg0()); } diff --git a/trunk/src/app/srs_app_http_stream.cpp b/trunk/src/app/srs_app_http_stream.cpp index 21d84be59b..dddacdf92c 100755 --- a/trunk/src/app/srs_app_http_stream.cpp +++ b/trunk/src/app/srs_app_http_stream.cpp @@ -1023,7 +1023,7 @@ srs_error_t SrsHttpStreamServer::hijack(ISrsHttpMessage* request, ISrsHttpHandle if (it == tflvs.end()) { return err; } - + // hstrs always enabled. // for origin, the http stream will be mount already when publish, // so it must never enter this line for stream already mounted. @@ -1064,7 +1064,7 @@ srs_error_t SrsHttpStreamServer::hijack(ISrsHttpMessage* request, ISrsHttpHandle if (srs_string_count(upath, "/") != srs_string_count(entry->mount, "/")) { return err; } - + // convert to concreate class. SrsHttpMessage* hreq = dynamic_cast(request); srs_assert(hreq); @@ -1127,7 +1127,7 @@ srs_error_t SrsHttpStreamServer::initialize_flv_streaming() if (!conf->is_vhost()) { continue; } - + if ((err = initialize_flv_entry(conf->arg0())) != srs_success) { return srs_error_wrap(err, "init flv entries"); } @@ -1139,7 +1139,7 @@ srs_error_t SrsHttpStreamServer::initialize_flv_streaming() srs_error_t SrsHttpStreamServer::initialize_flv_entry(std::string vhost) { srs_error_t err = srs_success; - + if (!_srs_config->get_vhost_http_remux_enabled(vhost)) { return err; } diff --git a/trunk/src/app/srs_app_source.cpp b/trunk/src/app/srs_app_source.cpp index 788773c800..b058f55a18 100755 --- a/trunk/src/app/srs_app_source.cpp +++ b/trunk/src/app/srs_app_source.cpp @@ -154,7 +154,7 @@ int64_t SrsRtmpJitter::get_time() SrsFastVector::SrsFastVector() { count = 0; - nb_msgs = SRS_PERF_MW_MSGS * 8; + nb_msgs = 8; msgs = new SrsSharedPtrMessage*[nb_msgs]; } @@ -212,7 +212,7 @@ void SrsFastVector::push_back(SrsSharedPtrMessage* msg) { // increase vector. if (count >= nb_msgs) { - int size = nb_msgs * 2; + int size = srs_max(SRS_PERF_MW_MSGS * 8, nb_msgs * 2); SrsSharedPtrMessage** buf = new SrsSharedPtrMessage*[size]; for (int i = 0; i < nb_msgs; i++) { buf[i] = msgs[i]; diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index b6aa583424..db851d3d46 100644 --- a/trunk/src/core/srs_core.hpp +++ b/trunk/src/core/srs_core.hpp @@ -27,7 +27,7 @@ // The version config. #define VERSION_MAJOR 3 #define VERSION_MINOR 0 -#define VERSION_REVISION 98 +#define VERSION_REVISION 99 // The macros generated by configure script. #include