From 8e5d4dc73d4ccf86fcfe5dcef0dd927eb43af4db Mon Sep 17 00:00:00 2001 From: winlin Date: Sat, 11 Feb 2017 13:29:53 +0800 Subject: [PATCH] always enable http and hls --- trunk/auto/options.sh | 35 +++++++++--------------------- trunk/src/app/srs_app_config.cpp | 2 -- trunk/src/app/srs_app_hls.cpp | 7 ------ trunk/src/app/srs_app_hls.hpp | 7 ------ trunk/src/app/srs_app_http_api.cpp | 4 ---- trunk/src/app/srs_app_source.cpp | 22 ------------------- trunk/src/app/srs_app_source.hpp | 4 ---- 7 files changed, 10 insertions(+), 71 deletions(-) diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh index 14e427f70..79c8ec687 100755 --- a/trunk/auto/options.sh +++ b/trunk/auto/options.sh @@ -15,7 +15,6 @@ help=no ################################################################ # feature options -SRS_HLS=RESERVED SRS_HDS=RESERVED SRS_DVR=RESERVED SRS_NGINX=RESERVED @@ -42,11 +41,12 @@ SRS_GPERF_CP=RESERVED # gprof SRS_GPROF=RESERVED # -# Always enable the HTTP features. +# Always enable the bellow features. SRS_HTTP_CALLBACK=YES SRS_HTTP_SERVER=YES SRS_HTTP_API=YES SRS_HTTP_CORE=YES +SRS_HLS=YES # ################################################################ # libraries @@ -116,7 +116,6 @@ Options: -h, --help print this message --with-ssl enable rtmp complex handshake, requires openssl-devel installed. - --with-hls enable hls streaming, mux RTMP to m3u8/ts files. --with-hds enable hds streaming, mux RTMP to f4m/f4v files. --with-dvr enable dvr, mux RTMP to flv files. --with-nginx enable delivery HTTP stream with nginx. @@ -139,7 +138,6 @@ Options: --with-mips-ubuntu12 cross build SRS on ubuntu12 for mips. --without-ssl disable rtmp complex handshake. - --without-hls disable hls, the apple http live streaming. --without-hds disable hds, the adobe http dynamic streaming. --without-dvr disable dvr, donot support record RTMP stream to flv. --without-nginx disable delivery HTTP stream with nginx. @@ -189,6 +187,7 @@ Always Enabled: --with-http-api enable http api, to manage SRS by http api. --with-http-callback enable http hooks, build cherrypy as demo api server. --with-http-server enable http server to delivery http stream. + --with-hls enable hls streaming, mux RTMP to m3u8/ts files. Conflicts: 1. --with-gmc vs --with-gmp: @@ -225,7 +224,6 @@ function parse_user_option() { --help) help=yes ;; --with-ssl) SRS_SSL=YES ;; - --with-hls) SRS_HLS=YES ;; --with-hds) SRS_HDS=YES ;; --with-dvr) SRS_DVR=YES ;; --with-nginx) SRS_NGINX=YES ;; @@ -248,7 +246,6 @@ function parse_user_option() { --with-mips-ubuntu12) SRS_MIPS_UBUNTU12=YES ;; --without-ssl) SRS_SSL=NO ;; - --without-hls) SRS_HLS=NO ;; --without-hds) SRS_HDS=NO ;; --without-dvr) SRS_DVR=NO ;; --without-nginx) SRS_NGINX=NO ;; @@ -300,9 +297,11 @@ function parse_user_option() { --with-http-callback) SRS_HTTP_CALLBACK=YES ;; --with-http-api) SRS_HTTP_API=YES ;; --with-http-server) SRS_HTTP_SERVER=YES ;; + --with-hls) SRS_HLS=YES ;; --without-http-callback) SRS_HTTP_CALLBACK=NO ;; --without-http-api) SRS_HTTP_API=NO ;; --without-http-server) SRS_HTTP_SERVER=NO ;; + --without-hls) SRS_HLS=NO ;; *) echo "$0: error: invalid option \"$option\"" @@ -383,7 +382,6 @@ function apply_user_presets() { # all disabled. if [ $SRS_DISABLE_ALL = YES ]; then - SRS_HLS=NO SRS_HDS=NO SRS_DVR=NO SRS_NGINX=NO @@ -408,7 +406,6 @@ function apply_user_presets() { # all enabled. if [ $SRS_ENABLE_ALL = YES ]; then - SRS_HLS=YES SRS_HDS=YES SRS_DVR=YES SRS_NGINX=YES @@ -433,7 +430,6 @@ function apply_user_presets() { # only rtmp vp6 if [ $SRS_FAST = YES ]; then - SRS_HLS=NO SRS_HDS=NO SRS_DVR=NO SRS_NGINX=NO @@ -458,7 +454,6 @@ function apply_user_presets() { # only ssl for RTMP with complex handshake. if [ $SRS_PURE_RTMP = YES ]; then - SRS_HLS=NO SRS_HDS=NO SRS_DVR=NO SRS_NGINX=NO @@ -483,7 +478,6 @@ function apply_user_presets() { # if arm specified, set some default to disabled. if [ $SRS_ARM_UBUNTU12 = YES ]; then - SRS_HLS=YES SRS_HDS=YES SRS_DVR=YES SRS_NGINX=NO @@ -509,7 +503,6 @@ function apply_user_presets() { # if mips specified, set some default to disabled. if [ $SRS_MIPS_UBUNTU12 = YES ]; then - SRS_HLS=YES SRS_HDS=YES SRS_DVR=YES SRS_NGINX=NO @@ -534,7 +527,6 @@ function apply_user_presets() { # defaults for x86/x64 if [ $SRS_X86_X64 = YES ]; then - SRS_HLS=YES SRS_HDS=YES SRS_DVR=YES SRS_NGINX=NO @@ -559,7 +551,6 @@ function apply_user_presets() { # for osx(darwin) if [ $SRS_OSX = YES ]; then - SRS_HLS=YES SRS_HDS=YES SRS_DVR=YES SRS_NGINX=NO @@ -584,7 +575,6 @@ function apply_user_presets() { # if dev specified, open features if possible. if [ $SRS_DEV = YES ]; then - SRS_HLS=YES SRS_HDS=YES SRS_DVR=YES SRS_NGINX=NO @@ -609,7 +599,6 @@ function apply_user_presets() { # if fast dev specified, open main server features. if [ $SRS_FAST_DEV = YES ]; then - SRS_HLS=YES SRS_HDS=YES SRS_DVR=YES SRS_NGINX=NO @@ -634,7 +623,6 @@ function apply_user_presets() { # for srs demo if [ $SRS_DEMO = YES ]; then - SRS_HLS=YES SRS_HDS=YES SRS_DVR=YES SRS_NGINX=NO @@ -659,7 +647,6 @@ function apply_user_presets() { # if raspberry-pi specified, open ssl/hls/static features if [ $SRS_PI = YES ]; then - SRS_HLS=YES SRS_HDS=YES SRS_DVR=YES SRS_NGINX=NO @@ -684,7 +671,6 @@ function apply_user_presets() { # if cubieboard specified, open features except ffmpeg/nginx. if [ $SRS_CUBIE = YES ]; then - SRS_HLS=YES SRS_HDS=YES SRS_DVR=YES SRS_NGINX=NO @@ -725,10 +711,11 @@ function apply_user_detail_options() { if [ $SRS_INGEST = YES ]; then SRS_FFMPEG_STUB=YES; fi # Always enable HTTP utilies. - if [ $SRS_HTTP_CORE = NO ]; then SRS_HTTP_CORE=YES; echo -e "${YELLOW}[WARN] Always enable http utilies.${BLACK}"; fi - if [ $SRS_HTTP_CALLBACK = NO ]; then SRS_HTTP_CALLBACK=YES; echo -e "${YELLOW}[WARN] Always enable http callback.${BLACK}"; fi - if [ $SRS_HTTP_SERVER = NO ]; then SRS_HTTP_SERVER=YES; echo -e "${YELLOW}[WARN] Always enable http server.${BLACK}"; fi - if [ $SRS_HTTP_API = NO ]; then SRS_HTTP_API=YES; echo -e "${YELLOW}[WARN] Always enable http api.${BLACK}"; fi + if [ $SRS_HTTP_CORE = NO ]; then SRS_HTTP_CORE=YES; echo -e "${YELLOW}[WARN] Always enable HTTP utilies.${BLACK}"; fi + if [ $SRS_HTTP_CALLBACK = NO ]; then SRS_HTTP_CALLBACK=YES; echo -e "${YELLOW}[WARN] Always enable HTTP callback.${BLACK}"; fi + if [ $SRS_HTTP_SERVER = NO ]; then SRS_HTTP_SERVER=YES; echo -e "${YELLOW}[WARN] Always enable HTTP server.${BLACK}"; fi + if [ $SRS_HTTP_API = NO ]; then SRS_HTTP_API=YES; echo -e "${YELLOW}[WARN] Always enable HTTP API.${BLACK}"; fi + if [ $SRS_HLS = NO ]; then SRS_HLS=YES; echo -e "${YELLOW}[WARN] Always enable HLS.${BLACK}"; fi # parse the jobs for make if [[ "" -eq SRS_JOBS ]]; then @@ -744,7 +731,6 @@ function apply_user_detail_options() { # disable almost all features for export srs-librtmp. if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then - SRS_HLS=NO SRS_HDS=NO SRS_DVR=NO SRS_NGINX=NO @@ -866,7 +852,6 @@ function check_option_conflicts() { # 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 if [ $SRS_HDS = RESERVED ]; then echo "you must specifies the hds, see: ./configure --help"; __check_ok=NO; fi if [ $SRS_DVR = RESERVED ]; then echo "you must specifies the dvr, see: ./configure --help"; __check_ok=NO; fi if [ $SRS_NGINX = RESERVED ]; then echo "you must specifies the nginx, see: ./configure --help"; __check_ok=NO; fi diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index a0bccb401..22f713795 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -4045,11 +4045,9 @@ int SrsConfig::check_config() srs_warn("dvr of vhost %s is disabled by configure", vhost->arg0().c_str()); } #endif -#ifndef SRS_AUTO_HLS if (get_hls_enabled(vhost->arg0())) { srs_warn("hls of vhost %s is disabled by configure", vhost->arg0().c_str()); } -#endif #ifndef SRS_AUTO_TRANSCODE if (get_transcode_enabled(get_transcode(vhost->arg0(), ""))) { srs_warn("transcode of vhost %s is disabled by configure", vhost->arg0().c_str()); diff --git a/trunk/src/app/srs_app_hls.cpp b/trunk/src/app/srs_app_hls.cpp index 2e52a0dd5..0b13cf141 100644 --- a/trunk/src/app/srs_app_hls.cpp +++ b/trunk/src/app/srs_app_hls.cpp @@ -61,11 +61,6 @@ using namespace std; // reset the piece id when deviation overflow this. #define SRS_JUMP_WHEN_PIECE_DEVIATION 20 -/** - * * the HLS section, only available when HLS enabled. - * */ -#ifdef SRS_AUTO_HLS - SrsHlsCacheWriter::SrsHlsCacheWriter(bool write_cache, bool write_file) { should_write_cache = write_cache; @@ -1408,6 +1403,4 @@ void SrsHls::hls_show_mux_log() } } -#endif - diff --git a/trunk/src/app/srs_app_hls.hpp b/trunk/src/app/srs_app_hls.hpp index fb265c35b..e9285f200 100644 --- a/trunk/src/app/srs_app_hls.hpp +++ b/trunk/src/app/srs_app_hls.hpp @@ -54,11 +54,6 @@ class SrsHlsSegment; class SrsTsCache; class SrsTsContext; -/** - * * the HLS section, only available when HLS enabled. - * */ -#ifdef SRS_AUTO_HLS - /** * write to file and cache. */ @@ -420,5 +415,3 @@ private: }; #endif - -#endif diff --git a/trunk/src/app/srs_app_http_api.cpp b/trunk/src/app/srs_app_http_api.cpp index 1f4c77d78..5f610238c 100644 --- a/trunk/src/app/srs_app_http_api.cpp +++ b/trunk/src/app/srs_app_http_api.cpp @@ -544,11 +544,7 @@ int SrsGoApiFeatures::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) #else features->set("ssl", SrsJsonAny::boolean(false)); #endif -#ifdef SRS_AUTO_HLS features->set("hls", SrsJsonAny::boolean(true)); -#else - features->set("hls", SrsJsonAny::boolean(false)); -#endif #ifdef SRS_AUTO_HDS features->set("hds", SrsJsonAny::boolean(true)); #else diff --git a/trunk/src/app/srs_app_source.cpp b/trunk/src/app/srs_app_source.cpp index 6fc607898..0e280222d 100755 --- a/trunk/src/app/srs_app_source.cpp +++ b/trunk/src/app/srs_app_source.cpp @@ -842,9 +842,7 @@ SrsOriginHub::SrsOriginHub(SrsSource* s) req = NULL; is_active = false; -#ifdef SRS_AUTO_HLS hls = new SrsHls(); -#endif #ifdef SRS_AUTO_DVR dvr = new SrsDvr(); #endif @@ -873,9 +871,7 @@ SrsOriginHub::~SrsOriginHub() } srs_freep(ng_exec); -#ifdef SRS_AUTO_HLS srs_freep(hls); -#endif #ifdef SRS_AUTO_DVR srs_freep(dvr); #endif @@ -893,11 +889,9 @@ int SrsOriginHub::initialize(SrsRequest* r) req = r; -#ifdef SRS_AUTO_HLS if ((ret = hls->initialize(this, req)) != ERROR_SUCCESS) { return ret; } -#endif #ifdef SRS_AUTO_DVR if ((ret = dvr->initialize(this, req)) != ERROR_SUCCESS) { @@ -910,20 +904,16 @@ int SrsOriginHub::initialize(SrsRequest* r) void SrsOriginHub::dispose() { -#ifdef SRS_AUTO_HLS hls->dispose(); -#endif } int SrsOriginHub::cycle() { int ret = ERROR_SUCCESS; -#ifdef SRS_AUTO_HLS if ((ret = hls->cycle()) != ERROR_SUCCESS) { return ret; } -#endif return ret; } @@ -960,7 +950,6 @@ int SrsOriginHub::on_audio(SrsSharedPtrMessage* shared_audio) SrsSharedPtrMessage* msg = shared_audio; -#ifdef SRS_AUTO_HLS if ((ret = hls->on_audio(msg)) != ERROR_SUCCESS) { // apply the error strategy for hls. // @see https://github.com/ossrs/srs/issues/264 @@ -985,7 +974,6 @@ int SrsOriginHub::on_audio(SrsSharedPtrMessage* shared_audio) return ret; } } -#endif #ifdef SRS_AUTO_DVR if ((ret = dvr->on_audio(msg)) != ERROR_SUCCESS) { @@ -1031,7 +1019,6 @@ int SrsOriginHub::on_video(SrsSharedPtrMessage* shared_video, bool is_sequence_h SrsSharedPtrMessage* msg = shared_video; -#ifdef SRS_AUTO_HLS if ((ret = hls->on_video(msg, is_sequence_header)) != ERROR_SUCCESS) { // apply the error strategy for hls. // @see https://github.com/ossrs/srs/issues/264 @@ -1056,7 +1043,6 @@ int SrsOriginHub::on_video(SrsSharedPtrMessage* shared_video, bool is_sequence_h return ret; } } -#endif #ifdef SRS_AUTO_DVR if ((ret = dvr->on_video(msg)) != ERROR_SUCCESS) { @@ -1114,12 +1100,10 @@ int SrsOriginHub::on_publish() } #endif -#ifdef SRS_AUTO_HLS if ((ret = hls->on_publish(false)) != ERROR_SUCCESS) { srs_error("start hls failed. ret=%d", ret); return ret; } -#endif #ifdef SRS_AUTO_DVR if ((ret = dvr->on_publish(false)) != ERROR_SUCCESS) { @@ -1158,9 +1142,7 @@ void SrsOriginHub::on_unpublish() encoder->on_unpublish(); #endif -#ifdef SRS_AUTO_HLS hls->on_unpublish(); -#endif #ifdef SRS_AUTO_DVR dvr->on_unpublish(); @@ -1206,7 +1188,6 @@ int SrsOriginHub::on_hls_start() SrsSharedPtrMessage* cache_sh_video = source->meta->vsh(); SrsSharedPtrMessage* cache_sh_audio = source->meta->ash(); -#ifdef SRS_AUTO_HLS // feed the hls the metadata/sequence header, // when reload to start hls, hls will never get the sequence header in stream, // use the SrsSource.on_hls_start to push the sequence header to HLS. @@ -1219,7 +1200,6 @@ int SrsOriginHub::on_hls_start() srs_error("hls process audio sequence header message failed. ret=%d", ret); return ret; } -#endif return ret; } @@ -1292,7 +1272,6 @@ int SrsOriginHub::on_reload_vhost_hls(string vhost) // TODO: FIXME: maybe should ignore when publish already stopped? -#ifdef SRS_AUTO_HLS hls->on_unpublish(); // Don't start forwarders when source is not active. @@ -1305,7 +1284,6 @@ int SrsOriginHub::on_reload_vhost_hls(string vhost) return ret; } srs_trace("vhost %s hls reload success", vhost.c_str()); -#endif return ret; } diff --git a/trunk/src/app/srs_app_source.hpp b/trunk/src/app/srs_app_source.hpp index 8b48cd5c9..3d5e1b0b4 100644 --- a/trunk/src/app/srs_app_source.hpp +++ b/trunk/src/app/srs_app_source.hpp @@ -54,9 +54,7 @@ class SrsMessageArray; class SrsNgExec; class SrsConnection; class SrsMessageHeader; -#ifdef SRS_AUTO_HLS class SrsHls; -#endif #ifdef SRS_AUTO_DVR class SrsDvr; #endif @@ -425,9 +423,7 @@ private: bool is_active; private: // hls handler. -#ifdef SRS_AUTO_HLS SrsHls* hls; -#endif // dvr handler. #ifdef SRS_AUTO_DVR SrsDvr* dvr;