winlin

for bug #155, refine for osx, with ssl/http, disable statistics. 0.9.198.

@@ -208,6 +208,7 @@ Supported operating systems and hardware: @@ -208,6 +208,7 @@ Supported operating systems and hardware:
208 * 2013-10-17, Created.<br/> 208 * 2013-10-17, Created.<br/>
209 209
210 ## History 210 ## History
  211 +* v1.0, 2014-08-17, for [#155](https://github.com/winlinvip/simple-rtmp-server/issues/155), refine for osx, with ssl/http, disable statistics. 0.9.198.
211 * v1.0, 2014-08-06, fix [#148](https://github.com/winlinvip/simple-rtmp-server/issues/148), simplify the RTMP handshake key generation. 0.9.191. 212 * v1.0, 2014-08-06, fix [#148](https://github.com/winlinvip/simple-rtmp-server/issues/148), simplify the RTMP handshake key generation. 0.9.191.
212 * v1.0, 2014-08-06, fix [#147](https://github.com/winlinvip/simple-rtmp-server/issues/147), support identify the srs edge. 0.9.190. 213 * v1.0, 2014-08-06, fix [#147](https://github.com/winlinvip/simple-rtmp-server/issues/147), support identify the srs edge. 0.9.190.
213 * <strong>v1.0, 2014-08-03, [1.0 mainline7(0.9.189)](https://github.com/winlinvip/simple-rtmp-server/releases/tag/1.0.mainline7) released. 57432 lines.</strong> 214 * <strong>v1.0, 2014-08-03, [1.0 mainline7(0.9.189)](https://github.com/winlinvip/simple-rtmp-server/releases/tag/1.0.mainline7) released. 57432 lines.</strong>
@@ -351,8 +351,21 @@ if [ ! -f ${SRS_OBJS}/st/libst.a ]; then echo "build st-1.9 static lib failed."; @@ -351,8 +351,21 @@ if [ ! -f ${SRS_OBJS}/st/libst.a ]; then echo "build st-1.9 static lib failed.";
351 ##################################################################################### 351 #####################################################################################
352 # check the arm flag file, if flag changed, need to rebuild the st. 352 # check the arm flag file, if flag changed, need to rebuild the st.
353 if [ $SRS_HTTP_PARSER = YES ]; then 353 if [ $SRS_HTTP_PARSER = YES ]; then
  354 + # for osx(darwin), donot use sed.
  355 + if [ $SRS_OSX = YES ]; then
  356 + if [[ -f ${SRS_OBJS}/hp/http_parser.h && -f ${SRS_OBJS}/hp/libhttp_parser.a ]]; then
  357 + echo "http-parser-2.1 is ok.";
  358 + else
  359 + echo "build http-parser-2.1 for osx(darwin)";
  360 + (
  361 + rm -rf ${SRS_OBJS}/http-parser-2.1 && cd ${SRS_OBJS} && unzip -q ../3rdparty/http-parser-2.1.zip &&
  362 + cd http-parser-2.1 &&
  363 + make package &&
  364 + cd .. && rm -rf hp && ln -sf http-parser-2.1 hp
  365 + )
  366 + fi
354 # ok, arm specified, if the flag filed does not exists, need to rebuild. 367 # ok, arm specified, if the flag filed does not exists, need to rebuild.
355 - if [ $SRS_EMBEDED_CPU = YES ]; then 368 + elif [ $SRS_EMBEDED_CPU = YES ]; then
356 if [[ -f ${SRS_OBJS}/_flag.st.hp.tmp && -f ${SRS_OBJS}/hp/http_parser.h && -f ${SRS_OBJS}/hp/libhttp_parser.a ]]; then 369 if [[ -f ${SRS_OBJS}/_flag.st.hp.tmp && -f ${SRS_OBJS}/hp/http_parser.h && -f ${SRS_OBJS}/hp/libhttp_parser.a ]]; then
357 echo "http-parser-2.1 for arm is ok."; 370 echo "http-parser-2.1 for arm is ok.";
358 else 371 else
@@ -795,14 +808,21 @@ echo "#define SRS_AUTO_PREFIX \"${SRS_PREFIX}\"" >> $SRS_AUTO_HEADERS_H @@ -795,14 +808,21 @@ echo "#define SRS_AUTO_PREFIX \"${SRS_PREFIX}\"" >> $SRS_AUTO_HEADERS_H
795 808
796 echo "" >> $SRS_AUTO_HEADERS_H 809 echo "" >> $SRS_AUTO_HEADERS_H
797 810
  811 +# os specified
  812 +echo "" >> $SRS_AUTO_HEADERS_H
  813 +
  814 +if [ $SRS_OSX = YES ]; then
  815 + echo "#define SRS_AUTO_OSX" >> $SRS_AUTO_HEADERS_H
  816 +else
  817 + echo "#undef SRS_AUTO_OSX" >> $SRS_AUTO_HEADERS_H
  818 +fi
  819 +
  820 +echo "" >> $SRS_AUTO_HEADERS_H
  821 +
798 ##################################################################################### 822 #####################################################################################
799 # generated the contributors from AUTHORS.txt 823 # generated the contributors from AUTHORS.txt
800 ##################################################################################### 824 #####################################################################################
801 -if [ $OS_IS_CENTOS = YES ]; then  
802 - SRS_CONSTRIBUTORS=`cat ../AUTHORS.txt|grep "*"|awk -F '* ' '{print $2}'`  
803 -else  
804 - SRS_CONSTRIBUTORS=`cat ../AUTHORS.txt|grep "*"|awk -F '\* ' '{print $2}'`  
805 -fi 825 +SRS_CONSTRIBUTORS=`cat ../AUTHORS.txt|grep "*"|awk '{print $2}'`
806 echo "#define SRS_AUTO_CONSTRIBUTORS \"\\" >> $SRS_AUTO_HEADERS_H 826 echo "#define SRS_AUTO_CONSTRIBUTORS \"\\" >> $SRS_AUTO_HEADERS_H
807 for CONTRIBUTOR in $SRS_CONSTRIBUTORS; do 827 for CONTRIBUTOR in $SRS_CONSTRIBUTORS; do
808 echo "${CONTRIBUTOR} \\" >> $SRS_AUTO_HEADERS_H 828 echo "${CONTRIBUTOR} \\" >> $SRS_AUTO_HEADERS_H
@@ -593,11 +593,11 @@ function apply_user_presets() { @@ -593,11 +593,11 @@ function apply_user_presets() {
593 SRS_SSL=YES 593 SRS_SSL=YES
594 SRS_FFMPEG_TOOL=NO 594 SRS_FFMPEG_TOOL=NO
595 SRS_TRANSCODE=YES 595 SRS_TRANSCODE=YES
596 - SRS_INGEST=NO  
597 - SRS_HTTP_PARSER=NO  
598 - SRS_HTTP_CALLBACK=NO  
599 - SRS_HTTP_SERVER=NO  
600 - SRS_HTTP_API=NO 596 + SRS_INGEST=YES
  597 + SRS_HTTP_PARSER=YES
  598 + SRS_HTTP_CALLBACK=YES
  599 + SRS_HTTP_SERVER=YES
  600 + SRS_HTTP_API=YES
601 SRS_LIBRTMP=NO 601 SRS_LIBRTMP=NO
602 SRS_RESEARCH=NO 602 SRS_RESEARCH=NO
603 SRS_UTEST=NO 603 SRS_UTEST=NO
@@ -794,6 +794,21 @@ function check_option_conflicts() { @@ -794,6 +794,21 @@ function check_option_conflicts() {
794 echo "x86/x64 should never use static, see: ./configure --help"; __check_ok=NO; 794 echo "x86/x64 should never use static, see: ./configure --help"; __check_ok=NO;
795 fi 795 fi
796 fi 796 fi
  797 +
  798 + # for darwin, must use --osx, vice versa
  799 + if [ $SRS_OSX = YES ]; then
  800 + if [ `uname -s` = Darwin ]; then
  801 + echo "osx(darwin) is ok"
  802 + else
  803 + echo "--osx is for darwin(your os is not), see: ./configure --help"; __check_ok=NO;
  804 + fi
  805 + else
  806 + if [ `uname -s` = Darwin ]; then
  807 + echo "use --osx for darwin, see: ./configure --help"; __check_ok=NO;
  808 + fi
  809 + fi
  810 +
  811 + # TODO: FIXME: check more os.
797 812
798 # check variable neccessary 813 # check variable neccessary
799 if [ $SRS_HLS = RESERVED ]; then echo "you must specifies the hls, see: ./configure --help"; __check_ok=NO; fi 814 if [ $SRS_HLS = RESERVED ]; then echo "you must specifies the hls, see: ./configure --help"; __check_ok=NO; fi
@@ -671,6 +671,8 @@ int SrsServer::do_cycle() @@ -671,6 +671,8 @@ int SrsServer::do_cycle()
671 671
672 // find the max loop 672 // find the max loop
673 int max = srs_max(0, SRS_SYS_TIME_RESOLUTION_MS_TIMES); 673 int max = srs_max(0, SRS_SYS_TIME_RESOLUTION_MS_TIMES);
  674 +
  675 +#ifndef SRS_AUTO_OSX
674 max = srs_max(max, SRS_SYS_RUSAGE_RESOLUTION_TIMES); 676 max = srs_max(max, SRS_SYS_RUSAGE_RESOLUTION_TIMES);
675 max = srs_max(max, SRS_SYS_CPU_STAT_RESOLUTION_TIMES); 677 max = srs_max(max, SRS_SYS_CPU_STAT_RESOLUTION_TIMES);
676 max = srs_max(max, SRS_SYS_DISK_STAT_RESOLUTION_TIMES); 678 max = srs_max(max, SRS_SYS_DISK_STAT_RESOLUTION_TIMES);
@@ -678,6 +680,7 @@ int SrsServer::do_cycle() @@ -678,6 +680,7 @@ int SrsServer::do_cycle()
678 max = srs_max(max, SRS_SYS_PLATFORM_INFO_RESOLUTION_TIMES); 680 max = srs_max(max, SRS_SYS_PLATFORM_INFO_RESOLUTION_TIMES);
679 max = srs_max(max, SRS_SYS_NETWORK_DEVICE_RESOLUTION_TIMES); 681 max = srs_max(max, SRS_SYS_NETWORK_DEVICE_RESOLUTION_TIMES);
680 max = srs_max(max, SRS_SYS_NETWORK_RTMP_SERVER_RESOLUTION_TIMES); 682 max = srs_max(max, SRS_SYS_NETWORK_RTMP_SERVER_RESOLUTION_TIMES);
  683 +#endif
681 684
682 // the deamon thread, update the time cache 685 // the deamon thread, update the time cache
683 while (true) { 686 while (true) {
@@ -719,6 +722,8 @@ int SrsServer::do_cycle() @@ -719,6 +722,8 @@ int SrsServer::do_cycle()
719 srs_info("update current time cache."); 722 srs_info("update current time cache.");
720 srs_update_system_time_ms(); 723 srs_update_system_time_ms();
721 } 724 }
  725 +
  726 +#ifndef SRS_AUTO_OSX
722 if ((i % SRS_SYS_RUSAGE_RESOLUTION_TIMES) == 0) { 727 if ((i % SRS_SYS_RUSAGE_RESOLUTION_TIMES) == 0) {
723 srs_info("update resource info, rss."); 728 srs_info("update resource info, rss.");
724 srs_update_system_rusage(); 729 srs_update_system_rusage();
@@ -748,13 +753,14 @@ int SrsServer::do_cycle() @@ -748,13 +753,14 @@ int SrsServer::do_cycle()
748 resample_kbps(NULL); 753 resample_kbps(NULL);
749 srs_update_rtmp_server((int)conns.size(), kbps); 754 srs_update_rtmp_server((int)conns.size(), kbps);
750 } 755 }
751 -#ifdef SRS_AUTO_HTTP_PARSER 756 + #ifdef SRS_AUTO_HTTP_PARSER
752 if (_srs_config->get_heartbeat_enabled()) { 757 if (_srs_config->get_heartbeat_enabled()) {
753 if ((i % heartbeat_max_resolution) == 0) { 758 if ((i % heartbeat_max_resolution) == 0) {
754 srs_info("do http heartbeat, for internal server to report."); 759 srs_info("do http heartbeat, for internal server to report.");
755 http_heartbeat->heartbeat(); 760 http_heartbeat->heartbeat();
756 } 761 }
757 } 762 }
  763 + #endif
758 #endif 764 #endif
759 srs_info("server main thread loop"); 765 srs_info("server main thread loop");
760 } 766 }
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 // current release version 31 // current release version
32 #define VERSION_MAJOR "0" 32 #define VERSION_MAJOR "0"
33 #define VERSION_MINOR "9" 33 #define VERSION_MINOR "9"
34 -#define VERSION_REVISION "197" 34 +#define VERSION_REVISION "198"
35 #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION 35 #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
36 // server info. 36 // server info.
37 #define RTMP_SIG_SRS_KEY "SRS" 37 #define RTMP_SIG_SRS_KEY "SRS"