1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

for #742, always enable http utilities.

This commit is contained in:
winlin 2017-01-23 17:43:59 +08:00
parent 79def81792
commit a1fcf66f32
25 changed files with 42 additions and 362 deletions

View file

@ -79,18 +79,6 @@ fi
echo "" >> $SRS_AUTO_HEADERS_H
# auto headers in depends.
if [ $SRS_HTTP_CORE = YES ]; then
srs_define_macro "SRS_AUTO_HTTP_CORE" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_AUTO_HTTP_CORE" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_HTTP_SERVER = YES ]; then
srs_define_macro "SRS_AUTO_HTTP_SERVER" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_AUTO_HTTP_SERVER" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_STREAM_CASTER = YES ]; then
srs_define_macro "SRS_AUTO_STREAM_CASTER" $SRS_AUTO_HEADERS_H
else
@ -103,12 +91,6 @@ else
srs_undefine_macro "SRS_AUTO_KAFKA" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_HTTP_API = YES ]; then
srs_define_macro "SRS_AUTO_HTTP_API" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_AUTO_HTTP_API" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_NGINX = YES ]; then
srs_define_macro "SRS_AUTO_NGINX" $SRS_AUTO_HEADERS_H
else
@ -133,12 +115,6 @@ else
srs_undefine_macro "SRS_AUTO_HDS" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_HTTP_CALLBACK = YES ]; then
srs_define_macro "SRS_AUTO_HTTP_CALLBACK" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_AUTO_HTTP_CALLBACK" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_SSL = YES ]; then
srs_define_macro "SRS_AUTO_SSL" $SRS_AUTO_HEADERS_H
else

View file

@ -477,14 +477,6 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
if [ ! -f ${SRS_OBJS}/st/libst.a ]; then echo "Build state-threads static lib failed."; exit -1; fi
fi
#####################################################################################
# http-parser-2.1
#####################################################################################
# check the cross build flag file, if flag changed, need to rebuild the st.
if [ $SRS_HTTP_CORE = YES ]; then
echo "The http-parser is copied into srs_http_stack.*pp"
fi
#####################################################################################
# nginx for HLS, nginx-1.5.0
#####################################################################################
@ -557,22 +549,20 @@ fi
#####################################################################################
# cherrypy for http hooks callback, CherryPy-3.2.4
#####################################################################################
if [ $SRS_HTTP_CALLBACK = YES ]; then
if [[ -f ${SRS_OBJS}/CherryPy-3.2.4/setup.py ]]; then
echo "CherryPy-3.2.4 is ok.";
else
require_sudoer "install CherryPy-3.2.4"
echo "Installing CherryPy-3.2.4";
(
sudo rm -rf ${SRS_OBJS}/CherryPy-3.2.4 && cd ${SRS_OBJS} &&
unzip -q ../3rdparty/CherryPy-3.2.4.zip && cd CherryPy-3.2.4 &&
sudo python setup.py install
)
fi
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "build CherryPy-3.2.4 failed, ret=$ret"; exit $ret; fi
if [ ! -f ${SRS_OBJS}/CherryPy-3.2.4/setup.py ]; then echo "build CherryPy-3.2.4 failed."; exit -1; fi
if [[ -f ${SRS_OBJS}/CherryPy-3.2.4/setup.py ]]; then
echo "CherryPy-3.2.4 is ok.";
else
require_sudoer "install CherryPy-3.2.4"
echo "Installing CherryPy-3.2.4";
(
sudo rm -rf ${SRS_OBJS}/CherryPy-3.2.4 && cd ${SRS_OBJS} &&
unzip -q ../3rdparty/CherryPy-3.2.4.zip && cd CherryPy-3.2.4 &&
sudo python setup.py install
)
fi
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "build CherryPy-3.2.4 failed, ret=$ret"; exit $ret; fi
if [ ! -f ${SRS_OBJS}/CherryPy-3.2.4/setup.py ]; then echo "build CherryPy-3.2.4 failed."; exit -1; fi
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
echo "Link players to cherrypy static-dir"
@ -597,13 +587,11 @@ if [ $__SRS_BUILD_NGINX = YES ]; then
rm -f ${SRS_OBJS}/nginx/html/index.html &&
ln -sf `pwd`/research/players/nginx_index.html ${SRS_OBJS}/nginx/html/index.html
fi
# if http-server enalbed, use srs embeded http-server
if [ $SRS_HTTP_SERVER = YES ]; then
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
# if http-server enalbed, use srs embeded http-server
rm -f ${SRS_OBJS}/nginx/html/index.html &&
ln -sf `pwd`/research/players/srs-http-server_index.html ${SRS_OBJS}/nginx/html/index.html
fi
# if api-server enabled, generate for api server.
if [ $SRS_HTTP_CALLBACK = YES ]; then
# if api-server enabled, generate for api server.
rm -f ${SRS_OBJS}/nginx/html/index.html &&
ln -sf `pwd`/research/players/api-server_index.html ${SRS_OBJS}/nginx/html/index.html
fi

View file

@ -24,11 +24,8 @@ SRS_FFMPEG_TOOL=RESERVED
SRS_TRANSCODE=RESERVED
SRS_INGEST=RESERVED
SRS_STAT=RESERVED
SRS_HTTP_CALLBACK=RESERVED
SRS_HTTP_SERVER=RESERVED
SRS_STREAM_CASTER=RESERVED
SRS_KAFKA=RESERVED
SRS_HTTP_API=RESERVED
SRS_LIBRTMP=RESERVED
SRS_RESEARCH=RESERVED
SRS_UTEST=RESERVED
@ -44,11 +41,16 @@ SRS_GPERF_MP=RESERVED
SRS_GPERF_CP=RESERVED
# gprof
SRS_GPROF=RESERVED
#
# Always enable the HTTP features.
SRS_HTTP_CALLBACK=YES
SRS_HTTP_SERVER=YES
SRS_HTTP_API=YES
SRS_HTTP_CORE=YES
#
################################################################
# libraries
SRS_FFMPEG_STUB=RESERVED
SRS_HTTP_CORE=RESERVED
# arguments
SRS_PREFIX=/usr/local/srs
SRS_JOBS=1
@ -235,11 +237,8 @@ function parse_user_option() {
--with-transcode) SRS_TRANSCODE=YES ;;
--with-ingest) SRS_INGEST=YES ;;
--with-stat) SRS_STAT=YES ;;
--with-http-callback) SRS_HTTP_CALLBACK=YES ;;
--with-http-server) SRS_HTTP_SERVER=YES ;;
--with-stream-caster) SRS_STREAM_CASTER=YES ;;
--with-kafka) SRS_KAFKA=YES ;;
--with-http-api) SRS_HTTP_API=YES ;;
--with-librtmp) SRS_LIBRTMP=YES ;;
--with-research) SRS_RESEARCH=YES ;;
--with-utest) SRS_UTEST=YES ;;
@ -261,11 +260,8 @@ function parse_user_option() {
--without-transcode) SRS_TRANSCODE=NO ;;
--without-ingest) SRS_INGEST=NO ;;
--without-stat) SRS_STAT=NO ;;
--without-http-callback) SRS_HTTP_CALLBACK=NO ;;
--without-http-server) SRS_HTTP_SERVER=NO ;;
--without-stream-caster) SRS_STREAM_CASTER=NO ;;
--without-kafka) SRS_KAFKA=NO ;;
--without-http-api) SRS_HTTP_API=NO ;;
--without-librtmp) SRS_LIBRTMP=NO ;;
--without-research) SRS_RESEARCH=NO ;;
--without-utest) SRS_UTEST=NO ;;
@ -306,6 +302,13 @@ function parse_user_option() {
--export-librtmp-project) SRS_EXPORT_LIBRTMP_PROJECT=${value} ;;
--export-librtmp-single) SRS_EXPORT_LIBRTMP_SINGLE=${value} ;;
--with-http-callback) SRS_HTTP_CALLBACK=YES ;;
--with-http-api) SRS_HTTP_API=YES ;;
--with-http-server) SRS_HTTP_SERVER=YES ;;
--without-http-callback) SRS_HTTP_CALLBACK=NO ;;
--without-http-api) SRS_HTTP_API=NO ;;
--without-http-server) SRS_HTTP_SERVER=NO ;;
*)
echo "$0: error: invalid option \"$option\""
exit 1
@ -396,12 +399,8 @@ function apply_user_presets() {
SRS_TRANSCODE=NO
SRS_INGEST=NO
SRS_STAT=NO
SRS_HTTP_CORE=NO
SRS_HTTP_CALLBACK=NO
SRS_HTTP_SERVER=NO
SRS_STREAM_CASTER=NO
SRS_KAFKA=NO
SRS_HTTP_API=NO
SRS_LIBRTMP=NO
SRS_RESEARCH=NO
SRS_UTEST=NO
@ -425,12 +424,8 @@ function apply_user_presets() {
SRS_TRANSCODE=YES
SRS_INGEST=YES
SRS_STAT=YES
SRS_HTTP_CORE=YES
SRS_HTTP_CALLBACK=YES
SRS_HTTP_SERVER=YES
SRS_STREAM_CASTER=YES
SRS_KAFKA=YES
SRS_HTTP_API=YES
SRS_LIBRTMP=YES
SRS_RESEARCH=YES
SRS_UTEST=YES
@ -454,12 +449,8 @@ function apply_user_presets() {
SRS_TRANSCODE=NO
SRS_INGEST=NO
SRS_STAT=NO
SRS_HTTP_CORE=NO
SRS_HTTP_CALLBACK=NO
SRS_HTTP_SERVER=NO
SRS_STREAM_CASTER=NO
SRS_KAFKA=NO
SRS_HTTP_API=NO
SRS_LIBRTMP=NO
SRS_RESEARCH=NO
SRS_UTEST=NO
@ -483,12 +474,8 @@ function apply_user_presets() {
SRS_TRANSCODE=NO
SRS_INGEST=NO
SRS_STAT=NO
SRS_HTTP_CORE=NO
SRS_HTTP_CALLBACK=NO
SRS_HTTP_SERVER=NO
SRS_STREAM_CASTER=NO
SRS_KAFKA=NO
SRS_HTTP_API=NO
SRS_LIBRTMP=NO
SRS_RESEARCH=NO
SRS_UTEST=NO
@ -512,12 +499,8 @@ function apply_user_presets() {
SRS_TRANSCODE=NO
SRS_INGEST=NO
SRS_STAT=NO
SRS_HTTP_CORE=NO
SRS_HTTP_CALLBACK=NO
SRS_HTTP_SERVER=NO
SRS_STREAM_CASTER=NO
SRS_KAFKA=NO
SRS_HTTP_API=NO
SRS_LIBRTMP=NO
SRS_RESEARCH=NO
SRS_UTEST=NO
@ -541,12 +524,8 @@ function apply_user_presets() {
SRS_TRANSCODE=YES
SRS_INGEST=YES
SRS_STAT=YES
SRS_HTTP_CORE=YES
SRS_HTTP_CALLBACK=YES
SRS_HTTP_SERVER=YES
SRS_STREAM_CASTER=YES
SRS_KAFKA=YES
SRS_HTTP_API=YES
SRS_LIBRTMP=YES
SRS_RESEARCH=NO
SRS_UTEST=NO
@ -571,12 +550,8 @@ function apply_user_presets() {
SRS_TRANSCODE=YES
SRS_INGEST=YES
SRS_STAT=YES
SRS_HTTP_CORE=YES
SRS_HTTP_CALLBACK=YES
SRS_HTTP_SERVER=YES
SRS_STREAM_CASTER=YES
SRS_KAFKA=YES
SRS_HTTP_API=YES
SRS_LIBRTMP=YES
SRS_RESEARCH=NO
SRS_UTEST=NO
@ -600,12 +575,8 @@ function apply_user_presets() {
SRS_TRANSCODE=YES
SRS_INGEST=YES
SRS_STAT=YES
SRS_HTTP_CORE=YES
SRS_HTTP_CALLBACK=YES
SRS_HTTP_SERVER=YES
SRS_STREAM_CASTER=YES
SRS_KAFKA=YES
SRS_HTTP_API=YES
SRS_LIBRTMP=YES
SRS_RESEARCH=NO
SRS_UTEST=YES
@ -629,12 +600,8 @@ function apply_user_presets() {
SRS_TRANSCODE=YES
SRS_INGEST=YES
SRS_STAT=YES
SRS_HTTP_CORE=YES
SRS_HTTP_CALLBACK=YES
SRS_HTTP_SERVER=YES
SRS_STREAM_CASTER=YES
SRS_KAFKA=YES
SRS_HTTP_API=YES
SRS_LIBRTMP=YES
SRS_RESEARCH=NO
SRS_UTEST=YES
@ -658,12 +625,8 @@ function apply_user_presets() {
SRS_TRANSCODE=YES
SRS_INGEST=YES
SRS_STAT=YES
SRS_HTTP_CORE=YES
SRS_HTTP_CALLBACK=YES
SRS_HTTP_SERVER=YES
SRS_STREAM_CASTER=YES
SRS_KAFKA=YES
SRS_HTTP_API=YES
SRS_LIBRTMP=YES
SRS_RESEARCH=YES
SRS_UTEST=YES
@ -687,12 +650,8 @@ function apply_user_presets() {
SRS_TRANSCODE=YES
SRS_INGEST=YES
SRS_STAT=YES
SRS_HTTP_CORE=YES
SRS_HTTP_CALLBACK=YES
SRS_HTTP_SERVER=YES
SRS_STREAM_CASTER=YES
SRS_KAFKA=YES
SRS_HTTP_API=YES
SRS_LIBRTMP=NO
SRS_RESEARCH=NO
SRS_UTEST=NO
@ -716,12 +675,8 @@ function apply_user_presets() {
SRS_TRANSCODE=YES
SRS_INGEST=YES
SRS_STAT=YES
SRS_HTTP_CORE=YES
SRS_HTTP_CALLBACK=YES
SRS_HTTP_SERVER=YES
SRS_STREAM_CASTER=YES
SRS_KAFKA=YES
SRS_HTTP_API=YES
SRS_LIBRTMP=YES
SRS_RESEARCH=NO
SRS_UTEST=YES
@ -745,12 +700,8 @@ function apply_user_presets() {
SRS_TRANSCODE=YES
SRS_INGEST=YES
SRS_STAT=YES
SRS_HTTP_CORE=YES
SRS_HTTP_CALLBACK=YES
SRS_HTTP_SERVER=YES
SRS_STREAM_CASTER=YES
SRS_KAFKA=YES
SRS_HTTP_API=YES
SRS_LIBRTMP=YES
SRS_RESEARCH=NO
SRS_UTEST=NO
@ -774,12 +725,8 @@ function apply_user_presets() {
SRS_TRANSCODE=YES
SRS_INGEST=YES
SRS_STAT=YES
SRS_HTTP_CORE=YES
SRS_HTTP_CALLBACK=YES
SRS_HTTP_SERVER=YES
SRS_STREAM_CASTER=NO
SRS_KAFKA=YES
SRS_HTTP_API=YES
SRS_LIBRTMP=YES
SRS_RESEARCH=NO
SRS_UTEST=NO
@ -809,11 +756,11 @@ function apply_user_detail_options() {
if [ $SRS_TRANSCODE = YES ]; then SRS_FFMPEG_STUB=YES; fi
if [ $SRS_INGEST = YES ]; then SRS_FFMPEG_STUB=YES; fi
# if http-xxxx specified, open the SRS_HTTP_CORE
SRS_HTTP_CORE=NO
if [ $SRS_HTTP_CALLBACK = YES ]; then SRS_HTTP_CORE=YES; fi
if [ $SRS_HTTP_SERVER = YES ]; then SRS_HTTP_CORE=YES; fi
if [ $SRS_HTTP_API = YES ]; then SRS_HTTP_CORE=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
# parse the jobs for make
if [[ "" -eq SRS_JOBS ]]; then
@ -838,12 +785,8 @@ function apply_user_detail_options() {
SRS_TRANSCODE=NO
SRS_INGEST=NO
SRS_STAT=NO
SRS_HTTP_CORE=NO
SRS_HTTP_CALLBACK=NO
SRS_HTTP_SERVER=NO
SRS_STREAM_CASTER=NO
SRS_KAFKA=NO
SRS_HTTP_API=NO
SRS_LIBRTMP=YES
SRS_RESEARCH=YES
SRS_UTEST=NO
@ -915,9 +858,6 @@ function check_option_conflicts() {
echo "Note that since the heap-checker uses the heap-profiling framework internally, it is not possible to run both the heap-checker and heap profiler at the same time";
__check_ok=NO
fi
if [[ $SRS_HTTP_CORE = NO && $SRS_STREAM_CASTER = YES ]]; then
echo "stream-caster depends on http-api or http-server, see: ./configure --help"; __check_ok=NO;
fi
# generate the group option: SRS_GPERF
__gperf_slow=NO
if [ $SRS_GPERF_MC = YES ]; then SRS_GPERF=YES; __gperf_slow=YES; fi
@ -964,11 +904,8 @@ function check_option_conflicts() {
if [ $SRS_NGINX = RESERVED ]; then echo "you must specifies the nginx, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_SSL = RESERVED ]; then echo "you must specifies the ssl, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_FFMPEG_TOOL = RESERVED ]; then echo "you must specifies the ffmpeg, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_HTTP_CALLBACK = RESERVED ]; then echo "you must specifies the http-callback, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_HTTP_SERVER = RESERVED ]; then echo "you must specifies the http-server, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_STREAM_CASTER = RESERVED ]; then echo "you must specifies the stream-caster, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_KAFKA = RESERVED ]; then echo "you must specifies the kafka, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_HTTP_API = RESERVED ]; then echo "you must specifies the http-api, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_LIBRTMP = RESERVED ]; then echo "you must specifies the librtmp, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_RESEARCH = RESERVED ]; then echo "you must specifies the research, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_UTEST = RESERVED ]; then echo "you must specifies the utest, see: ./configure --help"; __check_ok=NO; fi

View file

@ -3783,17 +3783,6 @@ int SrsConfig::check_config()
////////////////////////////////////////////////////////////////////////
// check features
////////////////////////////////////////////////////////////////////////
#ifndef SRS_AUTO_HTTP_SERVER
if (get_http_stream_enabled()) {
srs_warn("http_stream is disabled by configure");
}
#endif
#ifndef SRS_AUTO_HTTP_API
if (get_http_api_enabled()) {
srs_warn("http_api is disabled by configure");
}
#endif
vector<SrsConfDirective*> stream_casters = get_stream_casters();
for (int n = 0; n < (int)stream_casters.size(); n++) {
SrsConfDirective* stream_caster = stream_casters[n];
@ -4066,11 +4055,6 @@ int SrsConfig::check_config()
srs_warn("hls of vhost %s is disabled by configure", vhost->arg0().c_str());
}
#endif
#ifndef SRS_AUTO_HTTP_CALLBACK
if (get_vhost_http_hooks_enabled(vhost->arg0())) {
srs_warn("http_hooks 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());

View file

@ -302,7 +302,6 @@ int SrsFlvSegment::write_video(SrsSharedPtrMessage* shared_video)
int size = video->size;
bool is_sequence_header = SrsFlvCodec::video_is_sequence_header(payload, size);
#ifdef SRS_AUTO_HTTP_CALLBACK
bool is_key_frame = SrsFlvCodec::video_is_h264(payload, size)
&& SrsFlvCodec::video_is_keyframe(payload, size) && !is_sequence_header;
if (is_key_frame) {
@ -312,7 +311,6 @@ int SrsFlvSegment::write_video(SrsSharedPtrMessage* shared_video)
}
}
srs_verbose("dvr video is key: %d", is_key_frame);
#endif
// accept the sequence header here.
// when got no keyframe, ignore when should wait keyframe.
@ -512,7 +510,6 @@ int SrsDvrAsyncCallOnDvr::call()
{
int ret = ERROR_SUCCESS;
#ifdef SRS_AUTO_HTTP_CALLBACK
if (!_srs_config->get_vhost_http_hooks_enabled(req->vhost)) {
return ret;
}
@ -540,7 +537,6 @@ int SrsDvrAsyncCallOnDvr::call()
return ret;
}
}
#endif
return ret;
}

View file

@ -23,8 +23,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_app_heartbeat.hpp>
#ifdef SRS_AUTO_HTTP_CORE
#include <sstream>
using namespace std;
@ -104,5 +102,3 @@ void SrsHttpHeartbeat::heartbeat()
return;
}
#endif

View file

@ -29,8 +29,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <srs_core.hpp>
#ifdef SRS_AUTO_HTTP_CORE
/**
* the http heartbeat to api-server to notice api
* that the information of SRS.
@ -46,5 +44,3 @@ public:
#endif
#endif

View file

@ -190,7 +190,6 @@ int SrsDvrAsyncCallOnHls::call()
{
int ret = ERROR_SUCCESS;
#ifdef SRS_AUTO_HTTP_CALLBACK
if (!_srs_config->get_vhost_http_hooks_enabled(req->vhost)) {
return ret;
}
@ -218,7 +217,6 @@ int SrsDvrAsyncCallOnHls::call()
return ret;
}
}
#endif
return ret;
}
@ -244,7 +242,6 @@ int SrsDvrAsyncCallOnHlsNotify::call()
{
int ret = ERROR_SUCCESS;
#ifdef SRS_AUTO_HTTP_CALLBACK
if (!_srs_config->get_vhost_http_hooks_enabled(req->vhost)) {
return ret;
}
@ -273,7 +270,6 @@ int SrsDvrAsyncCallOnHlsNotify::call()
return ret;
}
}
#endif
return ret;
}

View file

@ -23,8 +23,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_app_http_api.hpp>
#ifdef SRS_AUTO_HTTP_API
#include <sstream>
#include <stdlib.h>
#include <signal.h>
@ -556,21 +554,9 @@ int SrsGoApiFeatures::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
#else
features->set("hds", SrsJsonAny::boolean(false));
#endif
#ifdef SRS_AUTO_HTTP_CALLBACK
features->set("callback", SrsJsonAny::boolean(true));
#else
features->set("callback", SrsJsonAny::boolean(false));
#endif
#ifdef SRS_AUTO_HTTP_API
features->set("api", SrsJsonAny::boolean(true));
#else
features->set("api", SrsJsonAny::boolean(false));
#endif
#ifdef SRS_AUTO_HTTP_SERVER
features->set("httpd", SrsJsonAny::boolean(true));
#else
features->set("httpd", SrsJsonAny::boolean(false));
#endif
#ifdef SRS_AUTO_DVR
features->set("dvr", SrsJsonAny::boolean(true));
#else
@ -1447,5 +1433,3 @@ int SrsHttpApi::on_reload_http_api_crossdomain()
return ERROR_SUCCESS;
}
#endif

View file

@ -30,8 +30,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_core.hpp>
#ifdef SRS_AUTO_HTTP_API
class SrsStSocket;
class ISrsHttpMessage;
class SrsHttpParser;
@ -233,5 +231,3 @@ public:
#endif
#endif

View file

@ -23,8 +23,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_app_http_client.hpp>
#ifdef SRS_AUTO_HTTP_CORE
#include <arpa/inet.h>
using namespace std;
@ -247,5 +245,3 @@ int SrsHttpClient::connect()
return ret;
}
#endif

View file

@ -32,8 +32,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <string>
#include <map>
#ifdef SRS_AUTO_HTTP_CORE
#include <srs_app_st.hpp>
class SrsHttpUri;
@ -112,5 +110,3 @@ private:
#endif
#endif

View file

@ -23,8 +23,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_app_http_conn.hpp>
#if defined(SRS_AUTO_HTTP_CORE)
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@ -60,10 +58,6 @@ using namespace std;
#include <srs_protocol_amf0.hpp>
#include <srs_app_utility.hpp>
#endif
#ifdef SRS_AUTO_HTTP_CORE
SrsHttpResponseWriter::SrsHttpResponseWriter(SrsStSocket* io)
{
skt = io;
@ -1280,12 +1274,10 @@ int SrsHttpServer::initialize()
{
int ret = ERROR_SUCCESS;
#if defined(SRS_AUTO_HTTP_SERVER) && defined(SRS_AUTO_HTTP_API)
// for SRS go-sharp to detect the status of HTTP server of SRS HTTP FLV Cluster.
if ((ret = http_static->mux.handle("/api/v1/versions", new SrsGoApiVersion())) != ERROR_SUCCESS) {
return ret;
}
#endif
if ((ret = http_stream->initialize()) != ERROR_SUCCESS) {
return ret;
@ -1318,5 +1310,3 @@ void SrsHttpServer::http_unmount(SrsSource* s, SrsRequest* r)
http_stream->http_unmount(s, r);
}
#endif

View file

@ -30,8 +30,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_core.hpp>
#ifdef SRS_AUTO_HTTP_CORE
#include <map>
#include <string>
#include <vector>
@ -428,5 +426,3 @@ public:
#endif
#endif

View file

@ -23,8 +23,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_app_http_hooks.hpp>
#ifdef SRS_AUTO_HTTP_CALLBACK
#include <sstream>
using namespace std;
@ -503,5 +501,3 @@ int SrsHttpHooks::do_post(SrsHttpClient* hc, std::string url, std::string req, i
return ret;
}
#endif

View file

@ -31,8 +31,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <string>
#ifdef SRS_AUTO_HTTP_CALLBACK
class SrsHttpUri;
class SrsStSocket;
class SrsRequest;
@ -124,5 +122,3 @@ private:
#endif
#endif

View file

@ -23,8 +23,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_app_http_static.hpp>
#if defined(SRS_AUTO_HTTP_CORE)
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@ -53,10 +51,6 @@ using namespace std;
#include <srs_app_source.hpp>
#include <srs_app_server.hpp>
#endif
#ifdef SRS_AUTO_HTTP_SERVER
SrsVodStream::SrsVodStream(string root_dir)
: SrsHttpFileServer(root_dir)
{
@ -315,5 +309,3 @@ int SrsHttpStaticServer::on_reload_vhost_http_updated()
return ret;
}
#endif

View file

@ -32,8 +32,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_app_http_conn.hpp>
#ifdef SRS_AUTO_HTTP_SERVER
/**
* the flv vod stream supports flv?start=offset-bytes.
* for example, http://server/file.flv?start=10240
@ -75,5 +73,3 @@ public:
#endif
#endif

View file

@ -25,8 +25,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define SRS_STREAM_CACHE_CYCLE_SECONDS 30
#if defined(SRS_AUTO_HTTP_CORE)
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@ -56,10 +54,6 @@ using namespace std;
#include <srs_app_server.hpp>
#include <srs_app_statistic.hpp>
#endif
#ifdef SRS_AUTO_HTTP_SERVER
SrsBufferCache::SrsBufferCache(SrsSource* s, SrsRequest* r)
{
req = r->copy();
@ -1077,5 +1071,3 @@ int SrsHttpStreamServer::initialize_flv_entry(std::string vhost)
return ret;
}
#endif

View file

@ -32,8 +32,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_app_http_conn.hpp>
#ifdef SRS_AUTO_HTTP_SERVER
/**
* for the srs http stream cache,
* for example, the audio stream cache to make android(weixin) happy.
@ -354,5 +352,3 @@ private:
#endif
#endif

View file

@ -1567,7 +1567,6 @@ int SrsRtmpConn::http_hooks_on_connect()
SrsRequest* req = info->req;
#ifdef SRS_AUTO_HTTP_CALLBACK
if (!_srs_config->get_vhost_http_hooks_enabled(req->vhost)) {
return ret;
}
@ -1595,14 +1594,12 @@ int SrsRtmpConn::http_hooks_on_connect()
return ret;
}
}
#endif
return ret;
}
void SrsRtmpConn::http_hooks_on_close()
{
#ifdef SRS_AUTO_HTTP_CALLBACK
SrsRequest* req = info->req;
if (!_srs_config->get_vhost_http_hooks_enabled(req->vhost)) {
@ -1629,14 +1626,12 @@ void SrsRtmpConn::http_hooks_on_close()
std::string url = hooks.at(i);
SrsHttpHooks::on_close(url, req, kbps->get_send_bytes(), kbps->get_recv_bytes());
}
#endif
}
int SrsRtmpConn::http_hooks_on_publish()
{
int ret = ERROR_SUCCESS;
#ifdef SRS_AUTO_HTTP_CALLBACK
SrsRequest* req = info->req;
if (!_srs_config->get_vhost_http_hooks_enabled(req->vhost)) {
@ -1666,14 +1661,12 @@ int SrsRtmpConn::http_hooks_on_publish()
return ret;
}
}
#endif
return ret;
}
void SrsRtmpConn::http_hooks_on_unpublish()
{
#ifdef SRS_AUTO_HTTP_CALLBACK
SrsRequest* req = info->req;
if (!_srs_config->get_vhost_http_hooks_enabled(req->vhost)) {
@ -1700,14 +1693,12 @@ void SrsRtmpConn::http_hooks_on_unpublish()
std::string url = hooks.at(i);
SrsHttpHooks::on_unpublish(url, req);
}
#endif
}
int SrsRtmpConn::http_hooks_on_play()
{
int ret = ERROR_SUCCESS;
#ifdef SRS_AUTO_HTTP_CALLBACK
SrsRequest* req = info->req;
if (!_srs_config->get_vhost_http_hooks_enabled(req->vhost)) {
@ -1737,14 +1728,12 @@ int SrsRtmpConn::http_hooks_on_play()
return ret;
}
}
#endif
return ret;
}
void SrsRtmpConn::http_hooks_on_stop()
{
#ifdef SRS_AUTO_HTTP_CALLBACK
SrsRequest* req = info->req;
if (!_srs_config->get_vhost_http_hooks_enabled(req->vhost)) {
@ -1771,7 +1760,6 @@ void SrsRtmpConn::http_hooks_on_stop()
std::string url = hooks.at(i);
SrsHttpHooks::on_stop(url, req);
}
#endif
return;
}

View file

@ -46,9 +46,7 @@ class SrsRefer;
class SrsConsumer;
class SrsCommonMessage;
class SrsStSocket;
#ifdef SRS_AUTO_HTTP_CALLBACK
class SrsHttpHooks;
#endif
class SrsBandwidth;
class SrsKbps;
class SrsRtmpClient;

View file

@ -493,15 +493,10 @@ SrsServer::SrsServer()
// donot new object in constructor,
// for some global instance is not ready now,
// new these objects in initialize instead.
#ifdef SRS_AUTO_HTTP_API
http_api_mux = new SrsHttpServeMux();
#endif
#ifdef SRS_AUTO_HTTP_SERVER
http_server = new SrsHttpServer(this);
#endif
#ifdef SRS_AUTO_HTTP_CORE
http_heartbeat = NULL;
#endif
#ifdef SRS_AUTO_INGEST
ingester = NULL;
#endif
@ -518,17 +513,9 @@ void SrsServer::destroy()
dispose();
#ifdef SRS_AUTO_HTTP_API
srs_freep(http_api_mux);
#endif
#ifdef SRS_AUTO_HTTP_SERVER
srs_freep(http_server);
#endif
#ifdef SRS_AUTO_HTTP_CORE
srs_freep(http_heartbeat);
#endif
#ifdef SRS_AUTO_INGEST
srs_freep(ingester);
@ -591,23 +578,15 @@ int SrsServer::initialize(ISrsServerCycle* cycle_handler)
return ret;
}
#ifdef SRS_AUTO_HTTP_API
if ((ret = http_api_mux->initialize()) != ERROR_SUCCESS) {
return ret;
}
#endif
#ifdef SRS_AUTO_HTTP_SERVER
srs_assert(http_server);
if ((ret = http_server->initialize()) != ERROR_SUCCESS) {
return ret;
}
#endif
#ifdef SRS_AUTO_HTTP_CORE
srs_assert(!http_heartbeat);
http_heartbeat = new SrsHttpHeartbeat();
#endif
#ifdef SRS_AUTO_INGEST
srs_assert(!ingester);
@ -779,7 +758,6 @@ int SrsServer::http_handle()
{
int ret = ERROR_SUCCESS;
#ifdef SRS_AUTO_HTTP_API
srs_assert(http_api_mux);
if ((ret = http_api_mux->handle("/", new SrsHttpNotFoundHandler())) != ERROR_SUCCESS) {
return ret;
@ -852,7 +830,6 @@ int SrsServer::http_handle()
return ret;
}
srs_trace("http: api mount /console to %s", dir.c_str());
#endif
return ret;
}
@ -1075,14 +1052,12 @@ int SrsServer::do_cycle()
srs_info("update network server kbps info.");
resample_kbps();
}
#ifdef SRS_AUTO_HTTP_CORE
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");
@ -1123,7 +1098,6 @@ int SrsServer::listen_http_api()
{
int ret = ERROR_SUCCESS;
#ifdef SRS_AUTO_HTTP_API
close_listeners(SrsListenerHttpApi);
if (_srs_config->get_http_api_enabled()) {
SrsListener* listener = new SrsBufferListener(this, SrsListenerHttpApi);
@ -1140,7 +1114,6 @@ int SrsServer::listen_http_api()
return ret;
}
}
#endif
return ret;
}
@ -1149,7 +1122,6 @@ int SrsServer::listen_http_stream()
{
int ret = ERROR_SUCCESS;
#ifdef SRS_AUTO_HTTP_SERVER
close_listeners(SrsListenerHttpStream);
if (_srs_config->get_http_stream_enabled()) {
SrsListener* listener = new SrsBufferListener(this, SrsListenerHttpStream);
@ -1166,7 +1138,6 @@ int SrsServer::listen_http_stream()
return ret;
}
}
#endif
return ret;
}
@ -1329,30 +1300,15 @@ SrsConnection* SrsServer::fd2conn(SrsListenerType type, st_netfd_t stfd)
}
SrsConnection* conn = NULL;
bool close_for_not_served = false;
if (type == SrsListenerRtmpStream) {
conn = new SrsRtmpConn(this, stfd, ip);
} else if (type == SrsListenerHttpApi) {
#ifdef SRS_AUTO_HTTP_API
conn = new SrsHttpApi(this, stfd, http_api_mux, ip);
#else
srs_warn("close http client for server not support http-api");
close_for_not_served = true;
#endif
} else if (type == SrsListenerHttpStream) {
#ifdef SRS_AUTO_HTTP_SERVER
conn = new SrsResponseOnlyHttpConn(this, stfd, http_server, ip);
#else
srs_warn("close http client for server not support http-server");
close_for_not_served = true;
#endif
} else {
// TODO: FIXME: handler others
srs_assert(false);
}
if (close_for_not_served) {
srs_warn("close for no service handler. fd=%d, ip=%s", fd, ip.c_str());
srs_close_stfd(stfd);
return NULL;
}
@ -1402,7 +1358,6 @@ int SrsServer::on_reload_vhost_added(std::string vhost)
{
int ret = ERROR_SUCCESS;
#ifdef SRS_AUTO_HTTP_SERVER
if (!_srs_config->get_vhost_http_enabled(vhost)) {
return ret;
}
@ -1411,7 +1366,6 @@ int SrsServer::on_reload_vhost_added(std::string vhost)
if ((ret = on_reload_vhost_http_updated()) != ERROR_SUCCESS) {
return ret;
}
#endif
return ret;
}
@ -1420,58 +1374,34 @@ int SrsServer::on_reload_vhost_removed(std::string /*vhost*/)
{
int ret = ERROR_SUCCESS;
#ifdef SRS_AUTO_HTTP_SERVER
// TODO: FIXME: should handle the event in SrsHttpStaticServer
if ((ret = on_reload_vhost_http_updated()) != ERROR_SUCCESS) {
return ret;
}
#endif
return ret;
}
int SrsServer::on_reload_http_api_enabled()
{
int ret = ERROR_SUCCESS;
#ifdef SRS_AUTO_HTTP_API
ret = listen_http_api();
#endif
return ret;
return listen_http_api();
}
int SrsServer::on_reload_http_api_disabled()
{
int ret = ERROR_SUCCESS;
#ifdef SRS_AUTO_HTTP_API
close_listeners(SrsListenerHttpApi);
#endif
return ret;
return ERROR_SUCCESS;
}
int SrsServer::on_reload_http_stream_enabled()
{
int ret = ERROR_SUCCESS;
#ifdef SRS_AUTO_HTTP_SERVER
ret = listen_http_stream();
#endif
return ret;
return listen_http_stream();
}
int SrsServer::on_reload_http_stream_disabled()
{
int ret = ERROR_SUCCESS;
#ifdef SRS_AUTO_HTTP_SERVER
close_listeners(SrsListenerHttpStream);
#endif
return ret;
return ERROR_SUCCESS;
}
// TODO: FIXME: rename to http_remux
@ -1479,7 +1409,6 @@ int SrsServer::on_reload_http_stream_updated()
{
int ret = ERROR_SUCCESS;
#ifdef SRS_AUTO_HTTP_SERVER
if ((ret = on_reload_http_stream_enabled()) != ERROR_SUCCESS) {
return ret;
}
@ -1488,7 +1417,6 @@ int SrsServer::on_reload_http_stream_updated()
if ((ret = on_reload_vhost_http_updated()) != ERROR_SUCCESS) {
return ret;
}
#endif
return ret;
}
@ -1497,19 +1425,15 @@ int SrsServer::on_publish(SrsSource* s, SrsRequest* r)
{
int ret = ERROR_SUCCESS;
#ifdef SRS_AUTO_HTTP_SERVER
if ((ret = http_server->http_mount(s, r)) != ERROR_SUCCESS) {
return ret;
}
#endif
return ret;
}
void SrsServer::on_unpublish(SrsSource* s, SrsRequest* r)
{
#ifdef SRS_AUTO_HTTP_SERVER
http_server->http_unmount(s, r);
#endif
}

View file

@ -241,16 +241,10 @@ class SrsServer : virtual public ISrsReloadHandler
, virtual public IConnectionManager
{
private:
#ifdef SRS_AUTO_HTTP_API
// TODO: FIXME: rename to http_api
SrsHttpServeMux* http_api_mux;
#endif
#ifdef SRS_AUTO_HTTP_SERVER
SrsHttpServer* http_server;
#endif
#ifdef SRS_AUTO_HTTP_CORE
SrsHttpHeartbeat* http_heartbeat;
#endif
#ifdef SRS_AUTO_INGEST
SrsIngester* ingester;
#endif

View file

@ -59,8 +59,6 @@ ISrsThreadContext* _srs_context = new ISrsThreadContext();
// @global config object for app module.
SrsConfig* _srs_config = NULL;
#if defined(SRS_AUTO_HTTP_CORE)
/**
* main entrance.
*/
@ -70,11 +68,6 @@ int main(int argc, char** argv)
srs_assert(srs_is_little_endian());
// directly failed when compile limited.
#if !defined(SRS_AUTO_HTTP_CORE)
srs_error("depends on http-parser.");
exit(-1);
#endif
#if defined(SRS_AUTO_GPERF_MP) || defined(SRS_AUTO_GPERF_MP) \
|| defined(SRS_AUTO_GPERF_MC) || defined(SRS_AUTO_GPERF_MP)
srs_error("donot support gmc/gmp/gcp/gprof");
@ -1326,15 +1319,3 @@ int proxy_hls2rtmp(string hls, string rtmp)
return ret;
}
#else
int main(int argc, char** argv)
{
#ifndef SRS_AUTO_HTTP_CORE
srs_error("ingest requires http-api or http-server");
#endif
return -1;
}
#endif