From 6103b1c3ce2b21b48b2ed66e6bac7e85fb898f6f Mon Sep 17 00:00:00 2001 From: winlin Date: Sun, 17 Aug 2014 22:11:43 +0800 Subject: [PATCH] refine options, add --with-stat. 0.9.199 --- trunk/auto/depends.sh | 18 +++++++---------- trunk/auto/options.sh | 34 +++++++++++++++++++++++++++----- trunk/src/app/srs_app_server.cpp | 4 ++-- trunk/src/core/srs_core.hpp | 2 +- 4 files changed, 39 insertions(+), 19 deletions(-) diff --git a/trunk/auto/depends.sh b/trunk/auto/depends.sh index 34770f734..2d9099cfc 100644 --- a/trunk/auto/depends.sh +++ b/trunk/auto/depends.sh @@ -678,6 +678,13 @@ else echo "#undef SRS_AUTO_INGEST" >> $SRS_AUTO_HEADERS_H fi +# for statistic. +if [ $SRS_STAT = YES ]; then + echo "#define SRS_AUTO_STAT" >> $SRS_AUTO_HEADERS_H +else + echo "#undef SRS_AUTO_STAT" >> $SRS_AUTO_HEADERS_H +fi + ##################################################################################### # build research code, librtmp ##################################################################################### @@ -808,17 +815,6 @@ echo "#define SRS_AUTO_PREFIX \"${SRS_PREFIX}\"" >> $SRS_AUTO_HEADERS_H echo "" >> $SRS_AUTO_HEADERS_H -# os specified -echo "" >> $SRS_AUTO_HEADERS_H - -if [ $SRS_OSX = YES ]; then - echo "#define SRS_AUTO_OSX" >> $SRS_AUTO_HEADERS_H -else - echo "#undef SRS_AUTO_OSX" >> $SRS_AUTO_HEADERS_H -fi - -echo "" >> $SRS_AUTO_HEADERS_H - ##################################################################################### # generated the contributors from AUTHORS.txt ##################################################################################### diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh index f37579571..feaa3bb1e 100644 --- a/trunk/auto/options.sh +++ b/trunk/auto/options.sh @@ -22,6 +22,7 @@ SRS_SSL=RESERVED SRS_FFMPEG_TOOL=RESERVED SRS_TRANSCODE=RESERVED SRS_INGEST=RESERVED +SRS_STAT=RESERVED SRS_HTTP_CALLBACK=RESERVED SRS_HTTP_SERVER=RESERVED SRS_HTTP_API=RESERVED @@ -118,6 +119,7 @@ Options: user must specifies the transcode tools in conf. --with-ingest enable ingest features. user must specifies the ingest tools in conf. + --with-stat enable the data statistic, for http api. --with-librtmp enable srs-librtmp, library for client. --with-bwtc enable SRS bandwidth test client tool. --with-research build the research tools. @@ -139,6 +141,7 @@ Options: --without-ffmpeg disable the ffmpeg transcode tool feature. --without-transcode disable the transcoding feature. --without-ingest disable the ingest feature. + --without-stat disable the data statistic feature. --without-librtmp disable srs-librtmp, library for client. --without-bwtc disable SRS bandwidth test client tool. --without-research do not build the research tools. @@ -203,9 +206,10 @@ function parse_user_option() { --with-hls) SRS_HLS=YES ;; --with-dvr) SRS_DVR=YES ;; --with-nginx) SRS_NGINX=YES ;; - --with-ffmpeg) SRS_FFMPEG_TOOL=YES ;; + --with-ffmpeg) SRS_FFMPEG_TOOL=YES ;; --with-transcode) SRS_TRANSCODE=YES ;; --with-ingest) SRS_INGEST=YES ;; + --with-stat) SRS_STAT=YES ;; --with-http-callback) SRS_HTTP_CALLBACK=YES ;; --with-http-server) SRS_HTTP_SERVER=YES ;; --with-http-api) SRS_HTTP_API=YES ;; @@ -224,9 +228,10 @@ function parse_user_option() { --without-hls) SRS_HLS=NO ;; --without-dvr) SRS_DVR=NO ;; --without-nginx) SRS_NGINX=NO ;; - --without-ffmpeg) SRS_FFMPEG_TOOL=NO ;; + --without-ffmpeg) SRS_FFMPEG_TOOL=NO ;; --without-transcode) SRS_TRANSCODE=NO ;; --without-ingest) SRS_INGEST=NO ;; + --without-stat) SRS_STAT=NO ;; --without-http-callback) SRS_HTTP_CALLBACK=NO ;; --without-http-server) SRS_HTTP_SERVER=NO ;; --without-http-api) SRS_HTTP_API=NO ;; @@ -353,6 +358,7 @@ function apply_user_presets() { SRS_FFMPEG_TOOL=NO SRS_TRANSCODE=NO SRS_INGEST=NO + SRS_STAT=NO SRS_HTTP_PARSER=NO SRS_HTTP_CALLBACK=NO SRS_HTTP_SERVER=NO @@ -377,6 +383,7 @@ function apply_user_presets() { SRS_FFMPEG_TOOL=YES SRS_TRANSCODE=YES SRS_INGEST=YES + SRS_STAT=YES SRS_HTTP_PARSER=YES SRS_HTTP_CALLBACK=YES SRS_HTTP_SERVER=YES @@ -401,6 +408,7 @@ function apply_user_presets() { SRS_FFMPEG_TOOL=NO SRS_TRANSCODE=NO SRS_INGEST=NO + SRS_STAT=NO SRS_HTTP_PARSER=NO SRS_HTTP_CALLBACK=NO SRS_HTTP_SERVER=NO @@ -425,6 +433,7 @@ function apply_user_presets() { SRS_FFMPEG_TOOL=NO SRS_TRANSCODE=NO SRS_INGEST=NO + SRS_STAT=NO SRS_HTTP_PARSER=NO SRS_HTTP_CALLBACK=NO SRS_HTTP_SERVER=NO @@ -449,6 +458,7 @@ function apply_user_presets() { SRS_FFMPEG_TOOL=NO SRS_TRANSCODE=NO SRS_INGEST=NO + SRS_STAT=NO SRS_HTTP_PARSER=NO SRS_HTTP_CALLBACK=NO SRS_HTTP_SERVER=NO @@ -473,6 +483,7 @@ function apply_user_presets() { SRS_FFMPEG_TOOL=NO SRS_TRANSCODE=YES SRS_INGEST=YES + SRS_STAT=YES SRS_HTTP_PARSER=YES SRS_HTTP_CALLBACK=YES SRS_HTTP_SERVER=YES @@ -498,6 +509,7 @@ function apply_user_presets() { SRS_FFMPEG_TOOL=NO SRS_TRANSCODE=YES SRS_INGEST=YES + SRS_STAT=YES SRS_HTTP_PARSER=YES SRS_HTTP_CALLBACK=YES SRS_HTTP_SERVER=YES @@ -522,6 +534,7 @@ function apply_user_presets() { SRS_FFMPEG_TOOL=NO SRS_TRANSCODE=YES SRS_INGEST=YES + SRS_STAT=YES SRS_HTTP_PARSER=YES SRS_HTTP_CALLBACK=YES SRS_HTTP_SERVER=YES @@ -546,6 +559,7 @@ function apply_user_presets() { SRS_FFMPEG_TOOL=YES SRS_TRANSCODE=YES SRS_INGEST=YES + SRS_STAT=YES SRS_HTTP_PARSER=YES SRS_HTTP_CALLBACK=YES SRS_HTTP_SERVER=YES @@ -570,6 +584,7 @@ function apply_user_presets() { SRS_FFMPEG_TOOL=NO SRS_TRANSCODE=YES SRS_INGEST=YES + SRS_STAT=YES SRS_HTTP_PARSER=YES SRS_HTTP_CALLBACK=YES SRS_HTTP_SERVER=YES @@ -594,6 +609,7 @@ function apply_user_presets() { SRS_FFMPEG_TOOL=NO SRS_TRANSCODE=YES SRS_INGEST=YES + SRS_STAT=NO SRS_HTTP_PARSER=YES SRS_HTTP_CALLBACK=YES SRS_HTTP_SERVER=YES @@ -620,6 +636,7 @@ function apply_user_presets() { SRS_FFMPEG_TOOL=YES SRS_TRANSCODE=YES SRS_INGEST=YES + SRS_STAT=YES SRS_HTTP_PARSER=YES SRS_HTTP_CALLBACK=YES SRS_HTTP_SERVER=YES @@ -644,6 +661,7 @@ function apply_user_presets() { SRS_FFMPEG_TOOL=NO SRS_TRANSCODE=YES SRS_INGEST=YES + SRS_STAT=YES SRS_HTTP_PARSER=YES SRS_HTTP_CALLBACK=YES SRS_HTTP_SERVER=YES @@ -668,6 +686,7 @@ function apply_user_presets() { SRS_FFMPEG_TOOL=YES SRS_TRANSCODE=YES SRS_INGEST=YES + SRS_STAT=YES SRS_HTTP_PARSER=YES SRS_HTTP_CALLBACK=YES SRS_HTTP_SERVER=YES @@ -794,12 +813,17 @@ function check_option_conflicts() { echo "x86/x64 should never use static, see: ./configure --help"; __check_ok=NO; fi fi + + # for darwin, not support stat yet. + if [ $SRS_OSX = YES ]; then + if [ $SRS_STAT = YES ]; then + echo "osx should never use stat, see: ./configure --help"; __check_ok=NO; + fi + fi # for darwin, must use --osx, vice versa if [ $SRS_OSX = YES ]; then - if [ `uname -s` = Darwin ]; then - echo "osx(darwin) is ok" - else + if [ `uname -s` != Darwin ]; then echo "--osx is for darwin(your os is not), see: ./configure --help"; __check_ok=NO; fi else diff --git a/trunk/src/app/srs_app_server.cpp b/trunk/src/app/srs_app_server.cpp index 7faeaf99d..007fddf59 100644 --- a/trunk/src/app/srs_app_server.cpp +++ b/trunk/src/app/srs_app_server.cpp @@ -672,7 +672,7 @@ int SrsServer::do_cycle() // find the max loop int max = srs_max(0, SRS_SYS_TIME_RESOLUTION_MS_TIMES); -#ifndef SRS_AUTO_OSX +#ifdef SRS_AUTO_STAT max = srs_max(max, SRS_SYS_RUSAGE_RESOLUTION_TIMES); max = srs_max(max, SRS_SYS_CPU_STAT_RESOLUTION_TIMES); max = srs_max(max, SRS_SYS_DISK_STAT_RESOLUTION_TIMES); @@ -723,7 +723,7 @@ int SrsServer::do_cycle() srs_update_system_time_ms(); } -#ifndef SRS_AUTO_OSX +#ifdef SRS_AUTO_STAT if ((i % SRS_SYS_RUSAGE_RESOLUTION_TIMES) == 0) { srs_info("update resource info, rss."); srs_update_system_rusage(); diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index 71f892c71..d82a21ad6 100644 --- a/trunk/src/core/srs_core.hpp +++ b/trunk/src/core/srs_core.hpp @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // current release version #define VERSION_MAJOR "0" #define VERSION_MINOR "9" -#define VERSION_REVISION "198" +#define VERSION_REVISION "199" #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION // server info. #define RTMP_SIG_SRS_KEY "SRS"