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

for #324, refine code, add hstrs config.

This commit is contained in:
winlin 2015-03-14 09:52:47 +08:00
parent 2adc069df0
commit 6d15d0ea99
15 changed files with 97 additions and 50 deletions

View file

@ -514,7 +514,7 @@ function apply_user_presets() {
SRS_HTTP_PARSER=YES SRS_HTTP_PARSER=YES
SRS_HTTP_CALLBACK=YES SRS_HTTP_CALLBACK=YES
SRS_HTTP_SERVER=YES SRS_HTTP_SERVER=YES
SRS_STREAM_CASTER=YES SRS_STREAM_CASTER=NO
SRS_HTTP_API=YES SRS_HTTP_API=YES
SRS_LIBRTMP=YES SRS_LIBRTMP=YES
SRS_RESEARCH=NO SRS_RESEARCH=NO
@ -542,7 +542,7 @@ function apply_user_presets() {
SRS_HTTP_PARSER=YES SRS_HTTP_PARSER=YES
SRS_HTTP_CALLBACK=YES SRS_HTTP_CALLBACK=YES
SRS_HTTP_SERVER=YES SRS_HTTP_SERVER=YES
SRS_STREAM_CASTER=YES SRS_STREAM_CASTER=NO
SRS_HTTP_API=YES SRS_HTTP_API=YES
SRS_LIBRTMP=YES SRS_LIBRTMP=YES
SRS_RESEARCH=NO SRS_RESEARCH=NO
@ -569,7 +569,7 @@ function apply_user_presets() {
SRS_HTTP_PARSER=YES SRS_HTTP_PARSER=YES
SRS_HTTP_CALLBACK=YES SRS_HTTP_CALLBACK=YES
SRS_HTTP_SERVER=YES SRS_HTTP_SERVER=YES
SRS_STREAM_CASTER=YES SRS_STREAM_CASTER=NO
SRS_HTTP_API=YES SRS_HTTP_API=YES
SRS_LIBRTMP=YES SRS_LIBRTMP=YES
SRS_RESEARCH=NO SRS_RESEARCH=NO
@ -596,7 +596,7 @@ function apply_user_presets() {
SRS_HTTP_PARSER=YES SRS_HTTP_PARSER=YES
SRS_HTTP_CALLBACK=YES SRS_HTTP_CALLBACK=YES
SRS_HTTP_SERVER=YES SRS_HTTP_SERVER=YES
SRS_STREAM_CASTER=YES SRS_STREAM_CASTER=NO
SRS_HTTP_API=NO SRS_HTTP_API=NO
SRS_LIBRTMP=YES SRS_LIBRTMP=YES
SRS_RESEARCH=NO SRS_RESEARCH=NO
@ -623,7 +623,7 @@ function apply_user_presets() {
SRS_HTTP_PARSER=YES SRS_HTTP_PARSER=YES
SRS_HTTP_CALLBACK=YES SRS_HTTP_CALLBACK=YES
SRS_HTTP_SERVER=YES SRS_HTTP_SERVER=YES
SRS_STREAM_CASTER=YES SRS_STREAM_CASTER=NO
SRS_HTTP_API=YES SRS_HTTP_API=YES
SRS_LIBRTMP=YES SRS_LIBRTMP=YES
SRS_RESEARCH=YES SRS_RESEARCH=YES
@ -650,7 +650,7 @@ function apply_user_presets() {
SRS_HTTP_PARSER=YES SRS_HTTP_PARSER=YES
SRS_HTTP_CALLBACK=YES SRS_HTTP_CALLBACK=YES
SRS_HTTP_SERVER=YES SRS_HTTP_SERVER=YES
SRS_STREAM_CASTER=YES SRS_STREAM_CASTER=NO
SRS_HTTP_API=YES SRS_HTTP_API=YES
SRS_LIBRTMP=NO SRS_LIBRTMP=NO
SRS_RESEARCH=NO SRS_RESEARCH=NO
@ -677,7 +677,7 @@ function apply_user_presets() {
SRS_HTTP_PARSER=YES SRS_HTTP_PARSER=YES
SRS_HTTP_CALLBACK=YES SRS_HTTP_CALLBACK=YES
SRS_HTTP_SERVER=YES SRS_HTTP_SERVER=YES
SRS_STREAM_CASTER=YES SRS_STREAM_CASTER=NO
SRS_HTTP_API=YES SRS_HTTP_API=YES
SRS_LIBRTMP=YES SRS_LIBRTMP=YES
SRS_RESEARCH=NO SRS_RESEARCH=NO
@ -704,7 +704,7 @@ function apply_user_presets() {
SRS_HTTP_PARSER=YES SRS_HTTP_PARSER=YES
SRS_HTTP_CALLBACK=YES SRS_HTTP_CALLBACK=YES
SRS_HTTP_SERVER=YES SRS_HTTP_SERVER=YES
SRS_STREAM_CASTER=YES SRS_STREAM_CASTER=NO
SRS_HTTP_API=YES SRS_HTTP_API=YES
SRS_LIBRTMP=YES SRS_LIBRTMP=YES
SRS_RESEARCH=NO SRS_RESEARCH=NO
@ -731,7 +731,7 @@ function apply_user_presets() {
SRS_HTTP_PARSER=YES SRS_HTTP_PARSER=YES
SRS_HTTP_CALLBACK=YES SRS_HTTP_CALLBACK=YES
SRS_HTTP_SERVER=YES SRS_HTTP_SERVER=YES
SRS_STREAM_CASTER=YES SRS_STREAM_CASTER=NO
SRS_HTTP_API=YES SRS_HTTP_API=YES
SRS_LIBRTMP=YES SRS_LIBRTMP=YES
SRS_RESEARCH=NO SRS_RESEARCH=NO

View file

@ -11,6 +11,7 @@ SrsIngestSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_INGEST = YES ]; then Sr
SrsHttpCallbackSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_CALLBACK = YES ]; then SrsHttpCallbackSummaryColor="\${GREEN}"; fi SrsHttpCallbackSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_CALLBACK = YES ]; then SrsHttpCallbackSummaryColor="\${GREEN}"; fi
SrsHttpServerSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_SERVER = YES ]; then SrsHttpServerSummaryColor="\${GREEN}"; fi SrsHttpServerSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_SERVER = YES ]; then SrsHttpServerSummaryColor="\${GREEN}"; fi
SrsHttpApiSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_API = YES ]; then SrsHttpApiSummaryColor="\${GREEN}"; fi SrsHttpApiSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_API = YES ]; then SrsHttpApiSummaryColor="\${GREEN}"; fi
SrsStreamCasterSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_STREAM_CASTER = YES ]; then SrsStreamCasterSummaryColor="\${GREEN}"; fi
SrsLibrtmpSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_LIBRTMP = YES ]; then SrsLibrtmpSummaryColor="\${GREEN}"; fi SrsLibrtmpSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_LIBRTMP = YES ]; then SrsLibrtmpSummaryColor="\${GREEN}"; fi
SrsLibrtmpSSLSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_LIBRTMP = YES ]; then if [ $SRS_SSL = YES ]; then SrsLibrtmpSSLSummaryColor="\${GREEN}"; fi fi SrsLibrtmpSSLSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_LIBRTMP = YES ]; then if [ $SRS_SSL = YES ]; then SrsLibrtmpSSLSummaryColor="\${GREEN}"; fi fi
SrsResearchSummaryColor="\${GREEN}{disabled} "; if [ $SRS_RESEARCH = YES ]; then SrsResearchSummaryColor="\${GREEN}"; fi SrsResearchSummaryColor="\${GREEN}{disabled} "; if [ $SRS_RESEARCH = YES ]; then SrsResearchSummaryColor="\${GREEN}"; fi
@ -71,11 +72,11 @@ echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/
echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/objs/srs_bandwidth_check\${BLACK}" echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/objs/srs_bandwidth_check\${BLACK}"
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}" echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
echo -e " |\${GREEN}server: ./objs/srs -c conf/srs.conf, start the srs server\${BLACK}" echo -e " |\${GREEN}server: ./objs/srs -c conf/srs.conf, start the srs server\${BLACK}"
echo -e " | ${SrsHlsSummaryColor}hls @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DeliveryHLS\${BLACK}" echo -e " | ${SrsHlsSummaryColor}hls @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_DeliveryHLS\${BLACK}"
echo -e " | ${SrsHlsSummaryColor}hls: generate m3u8 and ts from rtmp stream\${BLACK}" echo -e " | ${SrsHlsSummaryColor}hls: generate m3u8 and ts from rtmp stream\${BLACK}"
echo -e " | ${SrsDvrSummaryColor}dvr @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DVR\${BLACK}" echo -e " | ${SrsDvrSummaryColor}dvr @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_DVR\${BLACK}"
echo -e " | ${SrsDvrSummaryColor}dvr: record RTMP stream to flv files.\${BLACK}" echo -e " | ${SrsDvrSummaryColor}dvr: record RTMP stream to flv files.\${BLACK}"
echo -e " | ${SrsNginxSummaryColor}nginx @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DeliveryHLS\${BLACK}" echo -e " | ${SrsNginxSummaryColor}nginx @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_DeliveryHLS\${BLACK}"
echo -e " | ${SrsNginxSummaryColor}nginx: delivery HLS stream by nginx\${BLACK}" echo -e " | ${SrsNginxSummaryColor}nginx: delivery HLS stream by nginx\${BLACK}"
echo -e " | ${SrsNginxSummaryColor}nginx: sudo ./objs/nginx/sbin/nginx\${BLACK}" echo -e " | ${SrsNginxSummaryColor}nginx: sudo ./objs/nginx/sbin/nginx\${BLACK}"
echo -e " | ${SrsSslSummaryColor}ssl @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_RTMPHandshake\${BLACK}" echo -e " | ${SrsSslSummaryColor}ssl @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_RTMPHandshake\${BLACK}"
@ -87,14 +88,16 @@ echo -e " | ${SrsTranscodeSummaryColor}transcode @see: https://github.co
echo -e " | ${SrsTranscodeSummaryColor}transcode: support transcoding RTMP stream\${BLACK}" echo -e " | ${SrsTranscodeSummaryColor}transcode: support transcoding RTMP stream\${BLACK}"
echo -e " | ${SrsIngestSummaryColor}ingest @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Ingest\${BLACK}" echo -e " | ${SrsIngestSummaryColor}ingest @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Ingest\${BLACK}"
echo -e " | ${SrsIngestSummaryColor}ingest: support ingest file/stream/device then push to SRS by RTMP stream\${BLACK}" echo -e " | ${SrsIngestSummaryColor}ingest: support ingest file/stream/device then push to SRS by RTMP stream\${BLACK}"
echo -e " | ${SrsHttpCallbackSummaryColor}http-callback @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_HTTPCallback\${BLACK}" echo -e " | ${SrsHttpCallbackSummaryColor}http-callback @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_HTTPCallback\${BLACK}"
echo -e " | ${SrsHttpCallbackSummaryColor}http-callback: support http callback for authentication and event injection\${BLACK}" echo -e " | ${SrsHttpCallbackSummaryColor}http-callback: support http callback for authentication and event injection\${BLACK}"
echo -e " | ${SrsHttpServerSummaryColor}http-server @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_HTTPServer\${BLACK}" echo -e " | ${SrsHttpServerSummaryColor}http-server @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_HTTPServer\${BLACK}"
echo -e " | ${SrsHttpServerSummaryColor}http-server: support http server to delivery http stream\${BLACK}" echo -e " | ${SrsHttpServerSummaryColor}http-server: support http server to delivery http stream\${BLACK}"
echo -e " | ${SrsHttpApiSummaryColor}http-api @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_HTTPApi\${BLACK}" echo -e " | ${SrsHttpApiSummaryColor}http-api @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_HTTPApi\${BLACK}"
echo -e " | ${SrsHttpApiSummaryColor}http-api: support http api to manage server\${BLACK}" echo -e " | ${SrsHttpApiSummaryColor}http-api: support http api to manage server\${BLACK}"
echo -e " | ${SrsStreamCasterSummaryColor}stream-caster @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_Streamer\${BLACK}"
echo -e " | ${SrsStreamCasterSummaryColor}stream-caster: start server to cast stream over other protocols.\${BLACK}"
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}" echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
echo -e "\${GREEN}binaries @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Build\${BLACK}" echo -e "\${GREEN}binaries @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_Build\${BLACK}"
echo "You can:" echo "You can:"
echo " ./objs/srs -c conf/srs.conf" echo " ./objs/srs -c conf/srs.conf"

View file

@ -474,6 +474,12 @@ vhost http.remux.srs.com {
# @remark the port of http is specified by http_server section. # @remark the port of http is specified by http_server section.
# default: [vhost]/[app]/[stream].flv # default: [vhost]/[app]/[stream].flv
mount [vhost]/[app]/[stream].flv; mount [vhost]/[app]/[stream].flv;
# whether http stream trigger rtmp stream source when no stream available,
# for example, when encoder has not publish stream yet,
# user can play the http flv stream and wait for stream.
# TODO: FIXME: for edge vhost, automatically trigger the backsource connection.
# default: on
hstrs on;
} }
} }

View file

@ -14,5 +14,7 @@ vhost __defaultVhost__ {
enabled on; enabled on;
fast_cache 30; fast_cache 30;
mount [vhost]/[app]/[stream].aac; mount [vhost]/[app]/[stream].aac;
hstrs on;
} }
} }

View file

@ -13,5 +13,6 @@ vhost __defaultVhost__ {
http_remux { http_remux {
enabled on; enabled on;
mount [vhost]/[app]/[stream].flv; mount [vhost]/[app]/[stream].flv;
hstrs on;
} }
} }

View file

@ -14,5 +14,7 @@ vhost __defaultVhost__ {
enabled on; enabled on;
fast_cache 30; fast_cache 30;
mount [vhost]/[app]/[stream].mp3; mount [vhost]/[app]/[stream].mp3;
hstrs on;
} }
} }

View file

@ -13,5 +13,6 @@ vhost __defaultVhost__ {
http_remux { http_remux {
enabled on; enabled on;
mount [vhost]/[app]/[stream].ts; mount [vhost]/[app]/[stream].ts;
hstrs on;
} }
} }

22
trunk/configure vendored
View file

@ -15,17 +15,6 @@ GREEN="\\033[32m"
YELLOW="\\033[33m" YELLOW="\\033[33m"
BLACK="\\033[0m" BLACK="\\033[0m"
# clean the exists, when not export srs-librtmp.
# do this only when the options is ok.
if [[ -f Makefile ]]; then
make clean
fi
# remove makefile
rm -f ${SRS_WORKDIR}/${SRS_MAKEFILE}
# create objs
mkdir -p ${SRS_OBJS}
##################################################################################### #####################################################################################
# parse user options, set the variables like: # parse user options, set the variables like:
# srs features: SRS_SSL/SRS_HLS/SRS_NGINX/SRS_FFMPEG_TOOL/SRS_HTTP_CALLBACK/...... # srs features: SRS_SSL/SRS_HLS/SRS_NGINX/SRS_FFMPEG_TOOL/SRS_HTTP_CALLBACK/......
@ -34,6 +23,17 @@ mkdir -p ${SRS_OBJS}
# parse options, exit with error when parse options invalid. # parse options, exit with error when parse options invalid.
. auto/options.sh . auto/options.sh
# clean the exists, when not export srs-librtmp.
# do this only when the options is ok.
if [[ -f Makefile ]]; then
make clean
fi
# remove makefile
rm -f ${SRS_WORKDIR}/${SRS_MAKEFILE}
# create objs
mkdir -p ${SRS_OBJS}
# for export srs-librtmp, change target to it. # for export srs-librtmp, change target to it.
. auto/generate-srs-librtmp-project.sh . auto/generate-srs-librtmp-project.sh

View file

@ -1471,7 +1471,7 @@ int SrsConfig::check_config()
} else if (n == "http_remux") { } else if (n == "http_remux") {
for (int j = 0; j < (int)conf->directives.size(); j++) { for (int j = 0; j < (int)conf->directives.size(); j++) {
string m = conf->at(j)->name.c_str(); string m = conf->at(j)->name.c_str();
if (m != "enabled" && m != "mount" && m != "fast_cache") { if (m != "enabled" && m != "mount" && m != "fast_cache" && m != "crss") {
ret = ERROR_SYSTEM_CONFIG_INVALID; ret = ERROR_SYSTEM_CONFIG_INVALID;
srs_error("unsupported vhost http_remux directive %s, ret=%d", m.c_str(), ret); srs_error("unsupported vhost http_remux directive %s, ret=%d", m.c_str(), ret);
return ret; return ret;
@ -3751,6 +3751,30 @@ string SrsConfig::get_vhost_http_remux_mount(string vhost)
return conf->arg0(); return conf->arg0();
} }
bool SrsConfig::get_vhost_http_remux_hstrs(string vhost)
{
SrsConfDirective* conf = get_vhost(vhost);
if (!conf) {
return false;
}
conf = conf->get("http_remux");
if (!conf) {
return false;
}
conf = conf->get("hstrs");
if (!conf) {
return false;
}
if (conf->arg0() == "on") {
return true;
}
return false;
}
SrsConfDirective* SrsConfig::get_heartbeart() SrsConfDirective* SrsConfig::get_heartbeart()
{ {
return root->get("heartbeat"); return root->get("heartbeat");

View file

@ -1041,6 +1041,10 @@ public:
* used to generate the flv stream mount path. * used to generate the flv stream mount path.
*/ */
virtual std::string get_vhost_http_remux_mount(std::string vhost); virtual std::string get_vhost_http_remux_mount(std::string vhost);
/**
* get whether the hstrs(http stream trigger rtmp source) enabled.
*/
virtual bool get_vhost_http_remux_hstrs(std::string vhost);
// http heartbeart section // http heartbeart section
private: private:
/** /**

View file

@ -1269,9 +1269,9 @@ int SrsHttpParser::parse_message(SrsStSocket* skt, SrsHttpMessage** ppmsg)
int ret = ERROR_SUCCESS; int ret = ERROR_SUCCESS;
// reset request data. // reset request data.
filed_name = ""; field_name = "";
field_value = ""; field_value = "";
expect_filed_name = true; expect_field_name = true;
state = SrsHttpParseStateInit; state = SrsHttpParseStateInit;
header = http_parser(); header = http_parser();
url = ""; url = "";
@ -1339,8 +1339,8 @@ int SrsHttpParser::parse_message_imp(SrsStSocket* skt)
} }
// parse last header. // parse last header.
if (!filed_name.empty() && !field_value.empty()) { if (!field_name.empty() && !field_value.empty()) {
headers.push_back(std::make_pair(filed_name, field_value)); headers.push_back(std::make_pair(field_name, field_value));
} }
return ret; return ret;
@ -1406,17 +1406,17 @@ int SrsHttpParser::on_header_field(http_parser* parser, const char* at, size_t l
srs_assert(obj); srs_assert(obj);
// field value=>name, reap the field. // field value=>name, reap the field.
if (!obj->expect_filed_name) { if (!obj->expect_field_name) {
obj->headers.push_back(std::make_pair(obj->filed_name, obj->field_value)); obj->headers.push_back(std::make_pair(obj->field_name, obj->field_value));
// reset the field name when parsed. // reset the field name when parsed.
obj->filed_name = ""; obj->field_name = "";
obj->field_value = ""; obj->field_value = "";
} }
obj->expect_filed_name = true; obj->expect_field_name = true;
if (length > 0) { if (length > 0) {
obj->filed_name.append(at, (int)length); obj->field_name.append(at, (int)length);
} }
srs_info("Header field(%d bytes): %.*s", (int)length, (int)length, at); srs_info("Header field(%d bytes): %.*s", (int)length, (int)length, at);
@ -1431,7 +1431,7 @@ int SrsHttpParser::on_header_value(http_parser* parser, const char* at, size_t l
if (length > 0) { if (length > 0) {
obj->field_value.append(at, (int)length); obj->field_value.append(at, (int)length);
} }
obj->expect_filed_name = false; obj->expect_field_name = false;
srs_info("Header value(%d bytes): %.*s", (int)length, (int)length, at); srs_info("Header value(%d bytes): %.*s", (int)length, (int)length, at);
return 0; return 0;

View file

@ -330,9 +330,13 @@ public:
class SrsHttpServeMux class SrsHttpServeMux
{ {
private: private:
// the pattern handler. // the pattern handler, to handle the http request.
std::map<std::string, SrsHttpMuxEntry*> entries; std::map<std::string, SrsHttpMuxEntry*> entries;
// the vhost handler. // the vhost handler.
// when find the handler to process the request,
// append the matched vhost when pattern not starts with /,
// for example, for pattern /live/livestream.flv of vhost ossrs.net,
// the path will rewrite to ossrs.net/live/livestream.flv
std::map<std::string, ISrsHttpHandler*> vhosts; std::map<std::string, ISrsHttpHandler*> vhosts;
public: public:
SrsHttpServeMux(); SrsHttpServeMux();
@ -544,8 +548,8 @@ private:
SrsFastBuffer* buffer; SrsFastBuffer* buffer;
private: private:
// http parse data, reset before parse message. // http parse data, reset before parse message.
bool expect_filed_name; bool expect_field_name;
std::string filed_name; std::string field_name;
std::string field_value; std::string field_value;
SrsHttpParseState state; SrsHttpParseState state;
http_parser header; http_parser header;

View file

@ -826,7 +826,7 @@ int SrsHttpServer::initialize()
return ret; return ret;
} }
int SrsHttpServer::mount(SrsSource* s, SrsRequest* r) int SrsHttpServer::http_mount(SrsSource* s, SrsRequest* r)
{ {
int ret = ERROR_SUCCESS; int ret = ERROR_SUCCESS;
@ -886,7 +886,7 @@ int SrsHttpServer::mount(SrsSource* s, SrsRequest* r)
return ret; return ret;
} }
void SrsHttpServer::unmount(SrsSource* s, SrsRequest* r) void SrsHttpServer::http_unmount(SrsSource* s, SrsRequest* r)
{ {
std::string sid = r->get_stream_url(); std::string sid = r->get_stream_url();
@ -1185,7 +1185,7 @@ SrsHttpConn::SrsHttpConn(SrsServer* svr, st_netfd_t fd, SrsHttpServer* m)
: SrsConnection(svr, fd) : SrsConnection(svr, fd)
{ {
parser = new SrsHttpParser(); parser = new SrsHttpParser();
mux = m; http_server = m;
} }
SrsHttpConn::~SrsHttpConn() SrsHttpConn::~SrsHttpConn()
@ -1271,7 +1271,7 @@ int SrsHttpConn::process_request(ISrsHttpResponseWriter* w, SrsHttpMessage* r)
r->method_str().c_str(), r->url().c_str(), r->content_length()); r->method_str().c_str(), r->url().c_str(), r->content_length());
// use default server mux to serve http request. // use default server mux to serve http request.
if ((ret = mux->mux.serve_http(w, r)) != ERROR_SUCCESS) { if ((ret = http_server->mux.serve_http(w, r)) != ERROR_SUCCESS) {
if (!srs_is_client_gracefully_close(ret)) { if (!srs_is_client_gracefully_close(ret)) {
srs_error("serve http msg failed. ret=%d", ret); srs_error("serve http msg failed. ret=%d", ret);
} }

View file

@ -333,8 +333,8 @@ public:
virtual int initialize(); virtual int initialize();
// http flv/ts/mp3/aac stream // http flv/ts/mp3/aac stream
public: public:
virtual int mount(SrsSource* s, SrsRequest* r); virtual int http_mount(SrsSource* s, SrsRequest* r);
virtual void unmount(SrsSource* s, SrsRequest* r); virtual void http_unmount(SrsSource* s, SrsRequest* r);
// hls stream // hls stream
public: public:
virtual int mount_hls(SrsRequest* r); virtual int mount_hls(SrsRequest* r);
@ -356,7 +356,7 @@ class SrsHttpConn : public SrsConnection
{ {
private: private:
SrsHttpParser* parser; SrsHttpParser* parser;
SrsHttpServer* mux; SrsHttpServer* http_server;
public: public:
SrsHttpConn(SrsServer* svr, st_netfd_t fd, SrsHttpServer* m); SrsHttpConn(SrsServer* svr, st_netfd_t fd, SrsHttpServer* m);
virtual ~SrsHttpConn(); virtual ~SrsHttpConn();

View file

@ -1195,7 +1195,7 @@ int SrsServer::on_publish(SrsSource* s, SrsRequest* r)
int ret = ERROR_SUCCESS; int ret = ERROR_SUCCESS;
#ifdef SRS_AUTO_HTTP_SERVER #ifdef SRS_AUTO_HTTP_SERVER
if ((ret = http_stream_mux->mount(s, r)) != ERROR_SUCCESS) { if ((ret = http_stream_mux->http_mount(s, r)) != ERROR_SUCCESS) {
return ret; return ret;
} }
#endif #endif
@ -1206,7 +1206,7 @@ int SrsServer::on_publish(SrsSource* s, SrsRequest* r)
void SrsServer::on_unpublish(SrsSource* s, SrsRequest* r) void SrsServer::on_unpublish(SrsSource* s, SrsRequest* r)
{ {
#ifdef SRS_AUTO_HTTP_SERVER #ifdef SRS_AUTO_HTTP_SERVER
http_stream_mux->unmount(s, r); http_stream_mux->http_unmount(s, r);
#endif #endif
} }