From 8cd1c11add9ba4a816c819ad7c03048c9ed8dc84 Mon Sep 17 00:00:00 2001 From: winlin Date: Fri, 7 Mar 2014 14:27:32 +0800 Subject: [PATCH] change forward schema --- trunk/auto/options.sh | 29 ++++++++++++++++--- trunk/conf/srs.conf | 16 +++++++--- trunk/configure | 8 +++-- .../gperftools/heap-profiler/heap_profiler.cc | 5 ---- 4 files changed, 43 insertions(+), 15 deletions(-) mode change 100755 => 100644 trunk/conf/srs.conf diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh index 5646918b9..d456b6e5d 100644 --- a/trunk/auto/options.sh +++ b/trunk/auto/options.sh @@ -17,10 +17,10 @@ SRS_FFMPEG=RESERVED SRS_HTTP=RESERVED SRS_RESEARCH=RESERVED SRS_UTEST=RESERVED -SRS_GPERF=RESERVED -SRS_GPERF_MC=RESERVED -SRS_GPERF_MP=RESERVED -SRS_GPERF_CP=RESERVED +SRS_GPERF=RESERVED # tcmalloc +SRS_GPERF_MC=RESERVED # gperf memory check +SRS_GPERF_MP=RESERVED # gperf memory profile +SRS_GPERF_CP=RESERVED # gperf cpu profile # arguments SRS_JOBS=1 @@ -31,6 +31,7 @@ SRS_FFMPEG=YES SRS_HTTP=YES SRS_RESEARCH=NO SRS_UTEST=YES +SRS_GPERF=NO SRS_GPERF_MC=NO SRS_GPERF_MP=NO SRS_GPERF_CP=NO @@ -61,6 +62,7 @@ do --with-http) SRS_HTTP=YES ;; --with-research) SRS_RESEARCH=YES ;; --with-utest) SRS_UTEST=YES ;; + --with-gperf) SRS_GPERF=YES ;; --with-gmc) SRS_GPERF_MC=YES ;; --with-gmp) SRS_GPERF_MP=YES ;; --with-gcp) SRS_GPERF_CP=YES ;; @@ -71,6 +73,7 @@ do --without-http) SRS_HTTP=NO ;; --without-research) SRS_RESEARCH=NO ;; --without-utest) SRS_UTEST=NO ;; + --without-gperf) SRS_GPERF=NO ;; --without-gmc) SRS_GPERF_MC=NO ;; --without-gmp) SRS_GPERF_MP=NO ;; --without-gcp) SRS_GPERF_CP=NO ;; @@ -110,6 +113,7 @@ if [ $help = yes ]; then --with-ffmpeg enable transcoding with ffmpeg. --with-research build the research tools. --with-utest build the utest for srs. + --with-gperf build srs with gperf tools(no gmc/gmp/gcp, with tcmalloc only). --with-gmc build memory check for srs with gperf tools. --without-ssl disable rtmp complex handshake. @@ -118,6 +122,7 @@ if [ $help = yes ]; then --without-ffmpeg disable the ffmpeg transcoding feature. --without-research do not build the research tools. --without-utest do not build the utest for srs. + --without-gperf do not build srs with gperf tools(without tcmalloc and gmc/gmp/gcp). --without-gmc do not build memory check for srs with gperf tools. --jobs[=N] Allow N jobs at once; infinite jobs with no arg. @@ -131,6 +136,22 @@ fi # check user options ##################################################################################### __check_ok=YES +# check conflict +if [ $SRS_GPERF = NO ]; then + if [ $SRS_GPERF_MC = YES ]; then + echo "gperf-mc depends on gperf, see: ./configure --help"; + __check_ok=NO + fi + if [ $SRS_GPERF_MP = YES ]; then + echo "gperf-mp depends on gperf, see: ./configure --help"; + __check_ok=NO + fi + if [ $SRS_GPERF_CP = YES ]; then + echo "gperf-cp depends on gperf, see: ./configure --help"; + __check_ok=NO + fi +fi +# check variable neccessary if [ $SRS_SSL = RESERVED ]; then echo "you must specifies the ssl, see: ./configure --help"; __check_ok=NO diff --git a/trunk/conf/srs.conf b/trunk/conf/srs.conf old mode 100755 new mode 100644 index 08d21ca5c..eaeb4712d --- a/trunk/conf/srs.conf +++ b/trunk/conf/srs.conf @@ -535,14 +535,22 @@ vhost same.vhost.forward.vhost.com { # this used to split/forward the current stream for cluster active-standby, # active-active for cdn to build high available fault tolerance system. # format: {ip}:{port} {ip_N}:{port_N} - # or specify the vhost by: - # format: {ip}:{port}?vhost={vhost} {ip_N}:{port_N}?vhost={vhost} + # or specify the vhost by params, @see: change.vhost.forward.vhost.com # if vhost not specified, use the request vhost instead. forward 127.0.0.1:1936 127.0.0.1:1937; } -# the vhost which forward publish streams to other vhosts. +# TODO: FIXME: change the forward schema with vhost. +# [plan] the vhost which forward publish streams to other vhosts. vhost change.vhost.forward.vhost.com { - forward 127.0.0.1:1936?vhost=forward2.vhost.com 127.0.0.1:1937?vhost=forward3.vhost.com; + forward 127.0.0.1:1936 127.0.0.1:1937 { + # specify the vhost to override the vhost in client request. + vhost forward2.vhost.com; + # specify the refer(pageUrl) to override the refer in client request. + refer http://srs/index.html; + } + forward 127.0.0.1:1938 { + vhost forward3.vhost.com; + } } # the vhost disabled. diff --git a/trunk/configure b/trunk/configure index e95c9bb9d..2a363fa61 100755 --- a/trunk/configure +++ b/trunk/configure @@ -66,6 +66,7 @@ SrsResearchSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_RESEARCH = YES ]; the SrsUtestSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_UTEST = YES ]; then SrsUtestSummaryColor="\$(GREEN)"; fi SrsGperfSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_GPERF = YES ]; then SrsGperfSummaryColor="\$(GREEN)"; fi SrsGperfMCSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_GPERF_MC = YES ]; then SrsGperfMCSummaryColor="\$(GREEN)"; fi +SrsGperfMPSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_GPERF_MP = YES ]; then SrsGperfMPSummaryColor="\$(GREEN)"; fi ##################################################################################### # makefile @@ -95,8 +96,11 @@ default: bandwidth librtmp-sample utest @echo -e " ${SrsUtestSummaryColor}utest: ./objs/srs_utest, the utest for srs\$(BLACK)" @echo -e " ${SrsGperfSummaryColor}gperf: gmc/gmp/gcp for srs, @see: \$(BLACK)" @echo -e " ${SrsGperfMCSummaryColor}gmc: gperf memory check, @see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html\$(BLACK)" - @echo -e " ${SrsGperfMCSummaryColor}env PPROF_PATH=./objs/pprof HEAPCHECK=normal ./objs/srs -c conf/srs.conf # start gmc\$(BLACK)" - @echo -e " ${SrsGperfMCSummaryColor}killall -2 srs # or CTRL+C to stop gmc\$(BLACK)" + @echo -e " ${SrsGperfMCSummaryColor}env PPROF_PATH=./objs/pprof HEAPCHECK=normal ./objs/srs -c conf/srs.conf # start gmc\$(BLACK)" + @echo -e " ${SrsGperfMCSummaryColor}killall -2 srs # or CTRL+C to stop gmc\$(BLACK)" + @echo -e " ${SrsGperfMPSummaryColor}gmc: gperf memory profile, @see: http://google-perftools.googlecode.com/svn/trunk/doc/heapprofile.html\$(BLACK)" + @echo -e " ${SrsGperfMPSummaryColor}env PPROF_PATH=./objs/pprof HEAPCHECK=normal ./objs/srs -c conf/srs.conf # start gmc\$(BLACK)" + @echo -e " ${SrsGperfMPSummaryColor}killall -2 srs # or CTRL+C to stop gmc\$(BLACK)" @echo -e "\$(GREEN)binaries @see: https://github.com/winlinvip/simple-rtmp-server/wiki/Build\$(BLACK)" help: diff --git a/trunk/research/gperftools/heap-profiler/heap_profiler.cc b/trunk/research/gperftools/heap-profiler/heap_profiler.cc index 38774cfce..d13aa6a5d 100644 --- a/trunk/research/gperftools/heap-profiler/heap_profiler.cc +++ b/trunk/research/gperftools/heap-profiler/heap_profiler.cc @@ -52,12 +52,7 @@ void memory_alloc_profile() { memory_alloc_profile_imp(); } -void handler(int sig) { - exit(0); -} int main(int argc, char** argv) { - signal(SIGINT, handler); - // must start profiler manually. HeapProfilerStart(NULL);