From 3111870316a7b023e02c763e9e92fa554de67264 Mon Sep 17 00:00:00 2001 From: winlin Date: Sun, 17 Aug 2014 20:38:51 +0800 Subject: [PATCH] for bug #155, refine for osx, with ssl/http, disable statistics. 0.9.198. --- README.md | 1 + trunk/auto/depends.sh | 32 ++++++++++++++++++++++++++------ trunk/auto/options.sh | 25 ++++++++++++++++++++----- trunk/src/app/srs_app_server.cpp | 8 +++++++- trunk/src/core/srs_core.hpp | 2 +- 5 files changed, 55 insertions(+), 13 deletions(-) mode change 100755 => 100644 README.md mode change 100755 => 100644 trunk/auto/depends.sh mode change 100755 => 100644 trunk/auto/options.sh diff --git a/README.md b/README.md old mode 100755 new mode 100644 index 9e7bd3d26..d37a617c8 --- a/README.md +++ b/README.md @@ -208,6 +208,7 @@ Supported operating systems and hardware: * 2013-10-17, Created.
## History +* 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. * 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. * v1.0, 2014-08-06, fix [#147](https://github.com/winlinvip/simple-rtmp-server/issues/147), support identify the srs edge. 0.9.190. * 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. diff --git a/trunk/auto/depends.sh b/trunk/auto/depends.sh old mode 100755 new mode 100644 index 28f182bb1..34770f734 --- a/trunk/auto/depends.sh +++ b/trunk/auto/depends.sh @@ -351,8 +351,21 @@ if [ ! -f ${SRS_OBJS}/st/libst.a ]; then echo "build st-1.9 static lib failed."; ##################################################################################### # check the arm flag file, if flag changed, need to rebuild the st. if [ $SRS_HTTP_PARSER = YES ]; then + # for osx(darwin), donot use sed. + if [ $SRS_OSX = YES ]; then + if [[ -f ${SRS_OBJS}/hp/http_parser.h && -f ${SRS_OBJS}/hp/libhttp_parser.a ]]; then + echo "http-parser-2.1 is ok."; + else + echo "build http-parser-2.1 for osx(darwin)"; + ( + rm -rf ${SRS_OBJS}/http-parser-2.1 && cd ${SRS_OBJS} && unzip -q ../3rdparty/http-parser-2.1.zip && + cd http-parser-2.1 && + make package && + cd .. && rm -rf hp && ln -sf http-parser-2.1 hp + ) + fi # ok, arm specified, if the flag filed does not exists, need to rebuild. - if [ $SRS_EMBEDED_CPU = YES ]; then + elif [ $SRS_EMBEDED_CPU = YES ]; then if [[ -f ${SRS_OBJS}/_flag.st.hp.tmp && -f ${SRS_OBJS}/hp/http_parser.h && -f ${SRS_OBJS}/hp/libhttp_parser.a ]]; then echo "http-parser-2.1 for arm is ok."; else @@ -795,14 +808,21 @@ 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 ##################################################################################### -if [ $OS_IS_CENTOS = YES ]; then - SRS_CONSTRIBUTORS=`cat ../AUTHORS.txt|grep "*"|awk -F '* ' '{print $2}'` -else - SRS_CONSTRIBUTORS=`cat ../AUTHORS.txt|grep "*"|awk -F '\* ' '{print $2}'` -fi +SRS_CONSTRIBUTORS=`cat ../AUTHORS.txt|grep "*"|awk '{print $2}'` echo "#define SRS_AUTO_CONSTRIBUTORS \"\\" >> $SRS_AUTO_HEADERS_H for CONTRIBUTOR in $SRS_CONSTRIBUTORS; do echo "${CONTRIBUTOR} \\" >> $SRS_AUTO_HEADERS_H diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh old mode 100755 new mode 100644 index 9fbe27fcf..f37579571 --- a/trunk/auto/options.sh +++ b/trunk/auto/options.sh @@ -593,11 +593,11 @@ function apply_user_presets() { SRS_SSL=YES SRS_FFMPEG_TOOL=NO SRS_TRANSCODE=YES - SRS_INGEST=NO - SRS_HTTP_PARSER=NO - SRS_HTTP_CALLBACK=NO - SRS_HTTP_SERVER=NO - SRS_HTTP_API=NO + SRS_INGEST=YES + SRS_HTTP_PARSER=YES + SRS_HTTP_CALLBACK=YES + SRS_HTTP_SERVER=YES + SRS_HTTP_API=YES SRS_LIBRTMP=NO SRS_RESEARCH=NO SRS_UTEST=NO @@ -794,6 +794,21 @@ function check_option_conflicts() { echo "x86/x64 should never use static, 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 + echo "--osx is for darwin(your os is not), see: ./configure --help"; __check_ok=NO; + fi + else + if [ `uname -s` = Darwin ]; then + echo "use --osx for darwin, see: ./configure --help"; __check_ok=NO; + fi + fi + + # TODO: FIXME: check more os. # check variable neccessary if [ $SRS_HLS = RESERVED ]; then echo "you must specifies the hls, see: ./configure --help"; __check_ok=NO; fi diff --git a/trunk/src/app/srs_app_server.cpp b/trunk/src/app/srs_app_server.cpp index 49d2b0ac3..7faeaf99d 100644 --- a/trunk/src/app/srs_app_server.cpp +++ b/trunk/src/app/srs_app_server.cpp @@ -671,6 +671,8 @@ int SrsServer::do_cycle() // find the max loop int max = srs_max(0, SRS_SYS_TIME_RESOLUTION_MS_TIMES); + +#ifndef SRS_AUTO_OSX 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); @@ -678,6 +680,7 @@ int SrsServer::do_cycle() max = srs_max(max, SRS_SYS_PLATFORM_INFO_RESOLUTION_TIMES); max = srs_max(max, SRS_SYS_NETWORK_DEVICE_RESOLUTION_TIMES); max = srs_max(max, SRS_SYS_NETWORK_RTMP_SERVER_RESOLUTION_TIMES); +#endif // the deamon thread, update the time cache while (true) { @@ -719,6 +722,8 @@ int SrsServer::do_cycle() srs_info("update current time cache."); srs_update_system_time_ms(); } + +#ifndef SRS_AUTO_OSX if ((i % SRS_SYS_RUSAGE_RESOLUTION_TIMES) == 0) { srs_info("update resource info, rss."); srs_update_system_rusage(); @@ -748,13 +753,14 @@ int SrsServer::do_cycle() resample_kbps(NULL); srs_update_rtmp_server((int)conns.size(), kbps); } -#ifdef SRS_AUTO_HTTP_PARSER + #ifdef SRS_AUTO_HTTP_PARSER if (_srs_config->get_heartbeat_enabled()) { if ((i % heartbeat_max_resolution) == 0) { srs_info("do http heartbeat, for internal server to report."); http_heartbeat->heartbeat(); } } + #endif #endif srs_info("server main thread loop"); } diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index 34f0876d0..71f892c71 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 "197" +#define VERSION_REVISION "198" #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION // server info. #define RTMP_SIG_SRS_KEY "SRS"