winlin

change forward schema

@@ -17,10 +17,10 @@ SRS_FFMPEG=RESERVED @@ -17,10 +17,10 @@ SRS_FFMPEG=RESERVED
17 SRS_HTTP=RESERVED 17 SRS_HTTP=RESERVED
18 SRS_RESEARCH=RESERVED 18 SRS_RESEARCH=RESERVED
19 SRS_UTEST=RESERVED 19 SRS_UTEST=RESERVED
20 -SRS_GPERF=RESERVED  
21 -SRS_GPERF_MC=RESERVED  
22 -SRS_GPERF_MP=RESERVED  
23 -SRS_GPERF_CP=RESERVED 20 +SRS_GPERF=RESERVED # tcmalloc
  21 +SRS_GPERF_MC=RESERVED # gperf memory check
  22 +SRS_GPERF_MP=RESERVED # gperf memory profile
  23 +SRS_GPERF_CP=RESERVED # gperf cpu profile
24 # arguments 24 # arguments
25 SRS_JOBS=1 25 SRS_JOBS=1
26 26
@@ -31,6 +31,7 @@ SRS_FFMPEG=YES @@ -31,6 +31,7 @@ SRS_FFMPEG=YES
31 SRS_HTTP=YES 31 SRS_HTTP=YES
32 SRS_RESEARCH=NO 32 SRS_RESEARCH=NO
33 SRS_UTEST=YES 33 SRS_UTEST=YES
  34 +SRS_GPERF=NO
34 SRS_GPERF_MC=NO 35 SRS_GPERF_MC=NO
35 SRS_GPERF_MP=NO 36 SRS_GPERF_MP=NO
36 SRS_GPERF_CP=NO 37 SRS_GPERF_CP=NO
@@ -61,6 +62,7 @@ do @@ -61,6 +62,7 @@ do
61 --with-http) SRS_HTTP=YES ;; 62 --with-http) SRS_HTTP=YES ;;
62 --with-research) SRS_RESEARCH=YES ;; 63 --with-research) SRS_RESEARCH=YES ;;
63 --with-utest) SRS_UTEST=YES ;; 64 --with-utest) SRS_UTEST=YES ;;
  65 + --with-gperf) SRS_GPERF=YES ;;
64 --with-gmc) SRS_GPERF_MC=YES ;; 66 --with-gmc) SRS_GPERF_MC=YES ;;
65 --with-gmp) SRS_GPERF_MP=YES ;; 67 --with-gmp) SRS_GPERF_MP=YES ;;
66 --with-gcp) SRS_GPERF_CP=YES ;; 68 --with-gcp) SRS_GPERF_CP=YES ;;
@@ -71,6 +73,7 @@ do @@ -71,6 +73,7 @@ do
71 --without-http) SRS_HTTP=NO ;; 73 --without-http) SRS_HTTP=NO ;;
72 --without-research) SRS_RESEARCH=NO ;; 74 --without-research) SRS_RESEARCH=NO ;;
73 --without-utest) SRS_UTEST=NO ;; 75 --without-utest) SRS_UTEST=NO ;;
  76 + --without-gperf) SRS_GPERF=NO ;;
74 --without-gmc) SRS_GPERF_MC=NO ;; 77 --without-gmc) SRS_GPERF_MC=NO ;;
75 --without-gmp) SRS_GPERF_MP=NO ;; 78 --without-gmp) SRS_GPERF_MP=NO ;;
76 --without-gcp) SRS_GPERF_CP=NO ;; 79 --without-gcp) SRS_GPERF_CP=NO ;;
@@ -110,6 +113,7 @@ if [ $help = yes ]; then @@ -110,6 +113,7 @@ if [ $help = yes ]; then
110 --with-ffmpeg enable transcoding with ffmpeg. 113 --with-ffmpeg enable transcoding with ffmpeg.
111 --with-research build the research tools. 114 --with-research build the research tools.
112 --with-utest build the utest for srs. 115 --with-utest build the utest for srs.
  116 + --with-gperf build srs with gperf tools(no gmc/gmp/gcp, with tcmalloc only).
113 --with-gmc build memory check for srs with gperf tools. 117 --with-gmc build memory check for srs with gperf tools.
114 118
115 --without-ssl disable rtmp complex handshake. 119 --without-ssl disable rtmp complex handshake.
@@ -118,6 +122,7 @@ if [ $help = yes ]; then @@ -118,6 +122,7 @@ if [ $help = yes ]; then
118 --without-ffmpeg disable the ffmpeg transcoding feature. 122 --without-ffmpeg disable the ffmpeg transcoding feature.
119 --without-research do not build the research tools. 123 --without-research do not build the research tools.
120 --without-utest do not build the utest for srs. 124 --without-utest do not build the utest for srs.
  125 + --without-gperf do not build srs with gperf tools(without tcmalloc and gmc/gmp/gcp).
121 --without-gmc do not build memory check for srs with gperf tools. 126 --without-gmc do not build memory check for srs with gperf tools.
122 127
123 --jobs[=N] Allow N jobs at once; infinite jobs with no arg. 128 --jobs[=N] Allow N jobs at once; infinite jobs with no arg.
@@ -131,6 +136,22 @@ fi @@ -131,6 +136,22 @@ fi
131 # check user options 136 # check user options
132 ##################################################################################### 137 #####################################################################################
133 __check_ok=YES 138 __check_ok=YES
  139 +# check conflict
  140 +if [ $SRS_GPERF = NO ]; then
  141 + if [ $SRS_GPERF_MC = YES ]; then
  142 + echo "gperf-mc depends on gperf, see: ./configure --help";
  143 + __check_ok=NO
  144 + fi
  145 + if [ $SRS_GPERF_MP = YES ]; then
  146 + echo "gperf-mp depends on gperf, see: ./configure --help";
  147 + __check_ok=NO
  148 + fi
  149 + if [ $SRS_GPERF_CP = YES ]; then
  150 + echo "gperf-cp depends on gperf, see: ./configure --help";
  151 + __check_ok=NO
  152 + fi
  153 +fi
  154 +# check variable neccessary
134 if [ $SRS_SSL = RESERVED ]; then 155 if [ $SRS_SSL = RESERVED ]; then
135 echo "you must specifies the ssl, see: ./configure --help"; 156 echo "you must specifies the ssl, see: ./configure --help";
136 __check_ok=NO 157 __check_ok=NO
@@ -535,14 +535,22 @@ vhost same.vhost.forward.vhost.com { @@ -535,14 +535,22 @@ vhost same.vhost.forward.vhost.com {
535 # this used to split/forward the current stream for cluster active-standby, 535 # this used to split/forward the current stream for cluster active-standby,
536 # active-active for cdn to build high available fault tolerance system. 536 # active-active for cdn to build high available fault tolerance system.
537 # format: {ip}:{port} {ip_N}:{port_N} 537 # format: {ip}:{port} {ip_N}:{port_N}
538 - # or specify the vhost by:  
539 - # format: {ip}:{port}?vhost={vhost} {ip_N}:{port_N}?vhost={vhost} 538 + # or specify the vhost by params, @see: change.vhost.forward.vhost.com
540 # if vhost not specified, use the request vhost instead. 539 # if vhost not specified, use the request vhost instead.
541 forward 127.0.0.1:1936 127.0.0.1:1937; 540 forward 127.0.0.1:1936 127.0.0.1:1937;
542 } 541 }
543 -# the vhost which forward publish streams to other vhosts. 542 +# TODO: FIXME: change the forward schema with vhost.
  543 +# [plan] the vhost which forward publish streams to other vhosts.
544 vhost change.vhost.forward.vhost.com { 544 vhost change.vhost.forward.vhost.com {
545 - forward 127.0.0.1:1936?vhost=forward2.vhost.com 127.0.0.1:1937?vhost=forward3.vhost.com; 545 + forward 127.0.0.1:1936 127.0.0.1:1937 {
  546 + # specify the vhost to override the vhost in client request.
  547 + vhost forward2.vhost.com;
  548 + # specify the refer(pageUrl) to override the refer in client request.
  549 + refer http://srs/index.html;
  550 + }
  551 + forward 127.0.0.1:1938 {
  552 + vhost forward3.vhost.com;
  553 + }
546 } 554 }
547 555
548 # the vhost disabled. 556 # the vhost disabled.
@@ -66,6 +66,7 @@ SrsResearchSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_RESEARCH = YES ]; the @@ -66,6 +66,7 @@ SrsResearchSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_RESEARCH = YES ]; the
66 SrsUtestSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_UTEST = YES ]; then SrsUtestSummaryColor="\$(GREEN)"; fi 66 SrsUtestSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_UTEST = YES ]; then SrsUtestSummaryColor="\$(GREEN)"; fi
67 SrsGperfSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_GPERF = YES ]; then SrsGperfSummaryColor="\$(GREEN)"; fi 67 SrsGperfSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_GPERF = YES ]; then SrsGperfSummaryColor="\$(GREEN)"; fi
68 SrsGperfMCSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_GPERF_MC = YES ]; then SrsGperfMCSummaryColor="\$(GREEN)"; fi 68 SrsGperfMCSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_GPERF_MC = YES ]; then SrsGperfMCSummaryColor="\$(GREEN)"; fi
  69 +SrsGperfMPSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_GPERF_MP = YES ]; then SrsGperfMPSummaryColor="\$(GREEN)"; fi
69 70
70 ##################################################################################### 71 #####################################################################################
71 # makefile 72 # makefile
@@ -95,8 +96,11 @@ default: bandwidth librtmp-sample utest @@ -95,8 +96,11 @@ default: bandwidth librtmp-sample utest
95 @echo -e " ${SrsUtestSummaryColor}utest: ./objs/srs_utest, the utest for srs\$(BLACK)" 96 @echo -e " ${SrsUtestSummaryColor}utest: ./objs/srs_utest, the utest for srs\$(BLACK)"
96 @echo -e " ${SrsGperfSummaryColor}gperf: gmc/gmp/gcp for srs, @see: \$(BLACK)" 97 @echo -e " ${SrsGperfSummaryColor}gperf: gmc/gmp/gcp for srs, @see: \$(BLACK)"
97 @echo -e " ${SrsGperfMCSummaryColor}gmc: gperf memory check, @see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html\$(BLACK)" 98 @echo -e " ${SrsGperfMCSummaryColor}gmc: gperf memory check, @see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html\$(BLACK)"
98 - @echo -e " ${SrsGperfMCSummaryColor}env PPROF_PATH=./objs/pprof HEAPCHECK=normal ./objs/srs -c conf/srs.conf # start gmc\$(BLACK)"  
99 - @echo -e " ${SrsGperfMCSummaryColor}killall -2 srs # or CTRL+C to stop gmc\$(BLACK)" 99 + @echo -e " ${SrsGperfMCSummaryColor}env PPROF_PATH=./objs/pprof HEAPCHECK=normal ./objs/srs -c conf/srs.conf # start gmc\$(BLACK)"
  100 + @echo -e " ${SrsGperfMCSummaryColor}killall -2 srs # or CTRL+C to stop gmc\$(BLACK)"
  101 + @echo -e " ${SrsGperfMPSummaryColor}gmc: gperf memory profile, @see: http://google-perftools.googlecode.com/svn/trunk/doc/heapprofile.html\$(BLACK)"
  102 + @echo -e " ${SrsGperfMPSummaryColor}env PPROF_PATH=./objs/pprof HEAPCHECK=normal ./objs/srs -c conf/srs.conf # start gmc\$(BLACK)"
  103 + @echo -e " ${SrsGperfMPSummaryColor}killall -2 srs # or CTRL+C to stop gmc\$(BLACK)"
100 @echo -e "\$(GREEN)binaries @see: https://github.com/winlinvip/simple-rtmp-server/wiki/Build\$(BLACK)" 104 @echo -e "\$(GREEN)binaries @see: https://github.com/winlinvip/simple-rtmp-server/wiki/Build\$(BLACK)"
101 105
102 help: 106 help:
@@ -52,12 +52,7 @@ void memory_alloc_profile() { @@ -52,12 +52,7 @@ void memory_alloc_profile() {
52 memory_alloc_profile_imp(); 52 memory_alloc_profile_imp();
53 } 53 }
54 54
55 -void handler(int sig) {  
56 - exit(0);  
57 -}  
58 int main(int argc, char** argv) { 55 int main(int argc, char** argv) {
59 - signal(SIGINT, handler);  
60 -  
61 // must start profiler manually. 56 // must start profiler manually.
62 HeapProfilerStart(NULL); 57 HeapProfilerStart(NULL);
63 58