diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index a62765a38..ebebf9e4d 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -55,11 +55,98 @@ using namespace _srs_internal; #define SRS_CONF_PERFER_FALSE(conf_arg) conf_arg == "on" #define SRS_CONF_PERFER_TRUE(conf_arg) conf_arg != "off" +/////////////////////////////////////////////////////////// +// default consts values +/////////////////////////////////////////////////////////// +#define SRS_CONF_DEFAULT_PID_FILE "./objs/srs.pid" +#define SRS_CONF_DEFAULT_LOG_FILE "./objs/srs.log" +#define SRS_CONF_DEFAULT_LOG_LEVEL "trace" +#define SRS_CONF_DEFAULT_LOG_TANK_CONSOLE "console" +#define SRS_CONF_DEFAULT_COFNIG_FILE "conf/srs.conf" +#define SRS_CONF_DEFAULT_FF_LOG_DIR "./objs" +#define SRS_CONF_DEFAULT_UTC_TIME false + +#define SRS_CONF_DEFAULT_MAX_CONNECTIONS 1000 +#define SRS_CONF_DEFAULT_HLS_PATH "./objs/nginx/html" +#define SRS_CONF_DEFAULT_HLS_M3U8_FILE "[app]/[stream].m3u8" +#define SRS_CONF_DEFAULT_HLS_TS_FILE "[app]/[stream]-[seq].ts" +#define SRS_CONF_DEFAULT_HLS_TS_FLOOR false +#define SRS_CONF_DEFAULT_HLS_FRAGMENT 10 +#define SRS_CONF_DEFAULT_HLS_TD_RATIO 1.5 +#define SRS_CONF_DEFAULT_HLS_AOF_RATIO 2.0 +#define SRS_CONF_DEFAULT_HLS_WINDOW 60 +#define SRS_CONF_DEFAULT_HLS_ON_ERROR_IGNORE "ignore" +#define SRS_CONF_DEFAULT_HLS_ON_ERROR_DISCONNECT "disconnect" +#define SRS_CONF_DEFAULT_HLS_ON_ERROR_CONTINUE "continue" +#define SRS_CONF_DEFAULT_HLS_ON_ERROR SRS_CONF_DEFAULT_HLS_ON_ERROR_IGNORE +#define SRS_CONF_DEFAULT_HLS_STORAGE "disk" +#define SRS_CONF_DEFAULT_HLS_MOUNT "[vhost]/[app]/[stream].m3u8" +#define SRS_CONF_DEFAULT_HLS_ACODEC "aac" +#define SRS_CONF_DEFAULT_HLS_VCODEC "h264" +#define SRS_CONF_DEFAULT_HLS_CLEANUP true +#define SRS_CONF_DEFAULT_HLS_WAIT_KEYFRAME true +#define SRS_CONF_DEFAULT_HLS_NB_NOTIFY 64 +#define SRS_CONF_DEFAULT_DVR_PATH "./objs/nginx/html/[app]/[stream].[timestamp].flv" +#define SRS_CONF_DEFAULT_DVR_PLAN_SESSION "session" +#define SRS_CONF_DEFAULT_DVR_PLAN_SEGMENT "segment" +#define SRS_CONF_DEFAULT_DVR_PLAN_APPEND "append" +#define SRS_CONF_DEFAULT_DVR_PLAN SRS_CONF_DEFAULT_DVR_PLAN_SESSION +#define SRS_CONF_DEFAULT_DVR_DURATION 30 +#define SRS_CONF_DEFAULT_TIME_JITTER "full" +#define SRS_CONF_DEFAULT_ATC_AUTO true +#define SRS_CONF_DEFAULT_MIX_CORRECT false +// in seconds, the paused queue length. +#define SRS_CONF_DEFAULT_PAUSED_LENGTH 10 +// the interval in seconds for bandwidth check +#define SRS_CONF_DEFAULT_BANDWIDTH_INTERVAL 30 +// the interval in seconds for bandwidth check +#define SRS_CONF_DEFAULT_BANDWIDTH_LIMIT_KBPS 1000 + +#define SRS_CONF_DEFAULT_HTTP_MOUNT "[vhost]/" +#define SRS_CONF_DEFAULT_HTTP_REMUX_MOUNT "[vhost]/[app]/[stream].flv" +#define SRS_CONF_DEFAULT_HTTP_DIR SRS_CONF_DEFAULT_HLS_PATH +#define SRS_CONF_DEFAULT_HTTP_AUDIO_FAST_CACHE 0 + +#define SRS_CONF_DEFAULT_HTTP_STREAM_PORT "8080" +#define SRS_CONF_DEFAULT_HTTP_API_PORT "1985" +#define SRS_CONF_DEFAULT_HTTP_API_CROSSDOMAIN true + +#define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_ENABLED false +#define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_INTERVAL 9.9 +#define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_URL "http://"SRS_CONSTS_LOCALHOST":8085/api/v1/servers" +#define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_SUMMARIES false + +#define SRS_CONF_DEFAULT_SECURITY_ENABLED false + +#define SRS_CONF_DEFAULT_STREAM_CASTER_ENABLED false +#define SRS_CONF_DEFAULT_STREAM_CASTER_MPEGTS_OVER_UDP "mpegts_over_udp" +#define SRS_CONF_DEFAULT_STREAM_CASTER_RTSP "rtsp" +#define SRS_CONF_DEFAULT_STREAM_CASTER_FLV "flv" + +#define SRS_CONF_DEFAULT_STATS_NETWORK_DEVICE_INDEX 0 + +#define SRS_CONF_DEFAULT_PITHY_PRINT_MS 10000 + +#define SRS_CONF_DEFAULT_INGEST_TYPE_FILE "file" +#define SRS_CONF_DEFAULT_INGEST_TYPE_STREAM "stream" + +#define SRS_CONF_DEFAULT_TRANSCODE_IFORMAT "flv" +#define SRS_CONF_DEFAULT_TRANSCODE_OFORMAT "flv" + +#define SRS_CONF_DEFAULT_EDGE_MODE false +#define SRS_CONF_DEFAULT_EDGE_TOKEN_TRAVERSE false +#define SRS_CONF_DEFAULT_EDGE_TRANSFORM_VHOST "[vhost]" + +// hds default value +#define SRS_CONF_DEFAULT_HDS_PATH "./objs/nginx/html" +#define SRS_CONF_DEFAULT_HDS_WINDOW (60) +#define SRS_CONF_DEFAULT_HDS_FRAGMENT (10) + // '\n' -#define SRS_LF (char)0x0a +#define SRS_LF (char)SRS_CONSTS_LF // '\r' -#define SRS_CR (char)0x0d +#define SRS_CR (char)SRS_CONSTS_CR bool is_common_space(char ch) { @@ -4284,3 +4371,37 @@ bool srs_directive_equals(SrsConfDirective* a, SrsConfDirective* b) return true; } +bool srs_config_hls_is_on_error_ignore(string strategy) +{ + return strategy == SRS_CONF_DEFAULT_HLS_ON_ERROR_IGNORE; +} + +bool srs_config_hls_is_on_error_continue(string strategy) +{ + return strategy == SRS_CONF_DEFAULT_HLS_ON_ERROR_CONTINUE; +} + +bool srs_config_ingest_is_file(string type) +{ + return type == SRS_CONF_DEFAULT_INGEST_TYPE_FILE; +} + +bool srs_config_ingest_is_stream(string type) +{ + return type == SRS_CONF_DEFAULT_INGEST_TYPE_STREAM; +} + +bool srs_config_dvr_is_plan_segment(string plan) +{ + return plan == SRS_CONF_DEFAULT_DVR_PLAN_SEGMENT; +} + +bool srs_config_dvr_is_plan_session(string plan) +{ + return plan == SRS_CONF_DEFAULT_DVR_PLAN_SESSION; +} + +bool srs_config_dvr_is_plan_append(string plan) +{ + return plan == SRS_CONF_DEFAULT_DVR_PLAN_APPEND; +} diff --git a/trunk/src/app/srs_app_config.hpp b/trunk/src/app/srs_app_config.hpp index c80e82bcf..8b7f5b854 100644 --- a/trunk/src/app/srs_app_config.hpp +++ b/trunk/src/app/srs_app_config.hpp @@ -34,93 +34,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include -/////////////////////////////////////////////////////////// -// default consts values -/////////////////////////////////////////////////////////// -#define SRS_CONF_DEFAULT_PID_FILE "./objs/srs.pid" -#define SRS_CONF_DEFAULT_LOG_FILE "./objs/srs.log" -#define SRS_CONF_DEFAULT_LOG_LEVEL "trace" -#define SRS_CONF_DEFAULT_LOG_TANK_CONSOLE "console" -#define SRS_CONF_DEFAULT_COFNIG_FILE "conf/srs.conf" -#define SRS_CONF_DEFAULT_FF_LOG_DIR "./objs" -#define SRS_CONF_DEFAULT_UTC_TIME false - -#define SRS_CONF_DEFAULT_MAX_CONNECTIONS 1000 -#define SRS_CONF_DEFAULT_HLS_PATH "./objs/nginx/html" -#define SRS_CONF_DEFAULT_HLS_M3U8_FILE "[app]/[stream].m3u8" -#define SRS_CONF_DEFAULT_HLS_TS_FILE "[app]/[stream]-[seq].ts" -#define SRS_CONF_DEFAULT_HLS_TS_FLOOR false -#define SRS_CONF_DEFAULT_HLS_FRAGMENT 10 -#define SRS_CONF_DEFAULT_HLS_TD_RATIO 1.5 -#define SRS_CONF_DEFAULT_HLS_AOF_RATIO 2.0 -#define SRS_CONF_DEFAULT_HLS_WINDOW 60 -#define SRS_CONF_DEFAULT_HLS_ON_ERROR_IGNORE "ignore" -#define SRS_CONF_DEFAULT_HLS_ON_ERROR_DISCONNECT "disconnect" -#define SRS_CONF_DEFAULT_HLS_ON_ERROR_CONTINUE "continue" -#define SRS_CONF_DEFAULT_HLS_ON_ERROR SRS_CONF_DEFAULT_HLS_ON_ERROR_IGNORE -#define SRS_CONF_DEFAULT_HLS_STORAGE "disk" -#define SRS_CONF_DEFAULT_HLS_MOUNT "[vhost]/[app]/[stream].m3u8" -#define SRS_CONF_DEFAULT_HLS_ACODEC "aac" -#define SRS_CONF_DEFAULT_HLS_VCODEC "h264" -#define SRS_CONF_DEFAULT_HLS_CLEANUP true -#define SRS_CONF_DEFAULT_HLS_WAIT_KEYFRAME true -#define SRS_CONF_DEFAULT_HLS_NB_NOTIFY 64 -#define SRS_CONF_DEFAULT_DVR_PATH "./objs/nginx/html/[app]/[stream].[timestamp].flv" -#define SRS_CONF_DEFAULT_DVR_PLAN_SESSION "session" -#define SRS_CONF_DEFAULT_DVR_PLAN_SEGMENT "segment" -#define SRS_CONF_DEFAULT_DVR_PLAN_APPEND "append" -#define SRS_CONF_DEFAULT_DVR_PLAN SRS_CONF_DEFAULT_DVR_PLAN_SESSION -#define SRS_CONF_DEFAULT_DVR_DURATION 30 -#define SRS_CONF_DEFAULT_TIME_JITTER "full" -#define SRS_CONF_DEFAULT_ATC_AUTO true -#define SRS_CONF_DEFAULT_MIX_CORRECT false -// in seconds, the paused queue length. -#define SRS_CONF_DEFAULT_PAUSED_LENGTH 10 -// the interval in seconds for bandwidth check -#define SRS_CONF_DEFAULT_BANDWIDTH_INTERVAL 30 -// the interval in seconds for bandwidth check -#define SRS_CONF_DEFAULT_BANDWIDTH_LIMIT_KBPS 1000 - -#define SRS_CONF_DEFAULT_HTTP_MOUNT "[vhost]/" -#define SRS_CONF_DEFAULT_HTTP_REMUX_MOUNT "[vhost]/[app]/[stream].flv" -#define SRS_CONF_DEFAULT_HTTP_DIR SRS_CONF_DEFAULT_HLS_PATH -#define SRS_CONF_DEFAULT_HTTP_AUDIO_FAST_CACHE 0 - -#define SRS_CONF_DEFAULT_HTTP_STREAM_PORT "8080" -#define SRS_CONF_DEFAULT_HTTP_API_PORT "1985" -#define SRS_CONF_DEFAULT_HTTP_API_CROSSDOMAIN true - -#define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_ENABLED false -#define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_INTERVAL 9.9 -#define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_URL "http://"SRS_CONSTS_LOCALHOST":8085/api/v1/servers" -#define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_SUMMARIES false - -#define SRS_CONF_DEFAULT_SECURITY_ENABLED false - -#define SRS_CONF_DEFAULT_STREAM_CASTER_ENABLED false -#define SRS_CONF_DEFAULT_STREAM_CASTER_MPEGTS_OVER_UDP "mpegts_over_udp" -#define SRS_CONF_DEFAULT_STREAM_CASTER_RTSP "rtsp" -#define SRS_CONF_DEFAULT_STREAM_CASTER_FLV "flv" - -#define SRS_CONF_DEFAULT_STATS_NETWORK_DEVICE_INDEX 0 - -#define SRS_CONF_DEFAULT_PITHY_PRINT_MS 10000 - -#define SRS_CONF_DEFAULT_INGEST_TYPE_FILE "file" -#define SRS_CONF_DEFAULT_INGEST_TYPE_STREAM "stream" - -#define SRS_CONF_DEFAULT_TRANSCODE_IFORMAT "flv" -#define SRS_CONF_DEFAULT_TRANSCODE_OFORMAT "flv" - -#define SRS_CONF_DEFAULT_EDGE_MODE false -#define SRS_CONF_DEFAULT_EDGE_TOKEN_TRAVERSE false -#define SRS_CONF_DEFAULT_EDGE_TRANSFORM_VHOST "[vhost]" - -// hds default value -#define SRS_CONF_DEFAULT_HDS_PATH "./objs/nginx/html" -#define SRS_CONF_DEFAULT_HDS_WINDOW (60) -#define SRS_CONF_DEFAULT_HDS_FRAGMENT (10) - namespace _srs_internal { class SrsConfigBuffer; @@ -1218,7 +1131,18 @@ namespace _srs_internal /** * deep compare directive. */ -bool srs_directive_equals(SrsConfDirective* a, SrsConfDirective* b); +extern bool srs_directive_equals(SrsConfDirective* a, SrsConfDirective* b); + +/** + * helper utilities, used for compare the consts values. + */ +extern bool srs_config_hls_is_on_error_ignore(std::string strategy); +extern bool srs_config_hls_is_on_error_continue(std::string strategy); +extern bool srs_config_ingest_is_file(std::string type); +extern bool srs_config_ingest_is_stream(std::string type); +extern bool srs_config_dvr_is_plan_segment(std::string plan); +extern bool srs_config_dvr_is_plan_session(std::string plan); +extern bool srs_config_dvr_is_plan_append(std::string plan); // global config extern SrsConfig* _srs_config; diff --git a/trunk/src/app/srs_app_dvr.cpp b/trunk/src/app/srs_app_dvr.cpp index d7963bfba..ad1330bb9 100644 --- a/trunk/src/app/srs_app_dvr.cpp +++ b/trunk/src/app/srs_app_dvr.cpp @@ -639,11 +639,11 @@ int SrsDvrPlan::on_reap_segment() SrsDvrPlan* SrsDvrPlan::create_plan(string vhost) { std::string plan = _srs_config->get_dvr_plan(vhost); - if (plan == SRS_CONF_DEFAULT_DVR_PLAN_SEGMENT) { + if (srs_config_dvr_is_plan_segment(plan)) { return new SrsDvrSegmentPlan(); - } else if (plan == SRS_CONF_DEFAULT_DVR_PLAN_SESSION) { + } else if (srs_config_dvr_is_plan_session(plan)) { return new SrsDvrSessionPlan(); - } else if (plan == SRS_CONF_DEFAULT_DVR_PLAN_APPEND) { + } else if (srs_config_dvr_is_plan_append(plan)) { return new SrsDvrAppendPlan(); } else { srs_error("invalid dvr plan=%s, vhost=%s", plan.c_str(), vhost.c_str()); diff --git a/trunk/src/app/srs_app_edge.cpp b/trunk/src/app/srs_app_edge.cpp old mode 100644 new mode 100755 index ef57a237b..a1d52011d --- a/trunk/src/app/srs_app_edge.cpp +++ b/trunk/src/app/srs_app_edge.cpp @@ -94,6 +94,13 @@ int SrsEdgeIngester::initialize(SrsSource* source, SrsPlayEdge* edge, SrsRequest int SrsEdgeIngester::start() { + int ret = ERROR_SUCCESS; + + if ((ret = _source->on_publish()) != ERROR_SUCCESS) { + srs_error("edge pull stream then publish to edge failed. ret=%d", ret); + return ret; + } + return pthread->start(); } @@ -114,7 +121,9 @@ void SrsEdgeIngester::stop() int SrsEdgeIngester::cycle() { int ret = ERROR_SUCCESS; - + + _source->on_source_id_changed(_srs_context->get_id()); + std::string ep_server, ep_port; if ((ret = connect_server(ep_server, ep_port)) != ERROR_SUCCESS) { return ret; @@ -144,11 +153,6 @@ int SrsEdgeIngester::cycle() return ret; } - if ((ret = _source->on_publish()) != ERROR_SUCCESS) { - srs_error("edge pull stream then publish to edge failed. ret=%d", ret); - return ret; - } - if ((ret = _edge->on_ingest_play()) != ERROR_SUCCESS) { return ret; } @@ -381,8 +385,8 @@ int SrsEdgeIngester::connect_server(string& ep_server, string& ep_port) kbps->set_io(io, io); - srs_trace("edge pull connected, can_publish=%d, url=%s/%s, server=%s:%d", - _source->can_publish(), _req->tcUrl.c_str(), _req->stream.c_str(), server.c_str(), port); + srs_trace("edge pull connected, url=%s/%s, server=%s:%d", + _req->tcUrl.c_str(), _req->stream.c_str(), server.c_str(), port); return ret; } @@ -803,6 +807,11 @@ int SrsPublishEdge::initialize(SrsSource* source, SrsRequest* req) return ret; } +bool SrsPublishEdge::can_publish() +{ + return state != SrsEdgeStatePublish; +} + int SrsPublishEdge::on_client_publish() { int ret = ERROR_SUCCESS; diff --git a/trunk/src/app/srs_app_edge.hpp b/trunk/src/app/srs_app_edge.hpp old mode 100644 new mode 100755 index aa0cfc82d..ef3046512 --- a/trunk/src/app/srs_app_edge.hpp +++ b/trunk/src/app/srs_app_edge.hpp @@ -207,6 +207,7 @@ public: virtual void set_queue_size(double queue_size); public: virtual int initialize(SrsSource* source, SrsRequest* req); + virtual bool can_publish(); /** * when client publish stream on edge. */ diff --git a/trunk/src/app/srs_app_ingest.cpp b/trunk/src/app/srs_app_ingest.cpp index 51803c05d..43527bbed 100644 --- a/trunk/src/app/srs_app_ingest.cpp +++ b/trunk/src/app/srs_app_ingest.cpp @@ -369,7 +369,7 @@ int SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* vhost, S return ret; } - if (input_type == SRS_CONF_DEFAULT_INGEST_TYPE_FILE) { + if (srs_config_ingest_is_file(input_type)) { std::string input_url = _srs_config->get_ingest_input_url(ingest); if (input_url.empty()) { ret = ERROR_ENCODER_NO_INPUT; @@ -383,7 +383,7 @@ int SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* vhost, S if ((ret = ffmpeg->initialize(input_url, output, log_file)) != ERROR_SUCCESS) { return ret; } - } else if (input_type == SRS_CONF_DEFAULT_INGEST_TYPE_STREAM) { + } else if (srs_config_ingest_is_stream(input_type)) { std::string input_url = _srs_config->get_ingest_input_url(ingest); if (input_url.empty()) { ret = ERROR_ENCODER_NO_INPUT; diff --git a/trunk/src/app/srs_app_rtmp_conn.cpp b/trunk/src/app/srs_app_rtmp_conn.cpp index 6239a8872..3ff909724 100755 --- a/trunk/src/app/srs_app_rtmp_conn.cpp +++ b/trunk/src/app/srs_app_rtmp_conn.cpp @@ -206,6 +206,7 @@ int SrsRtmpConn::do_cycle() } ret = service_cycle(); + http_hooks_on_close(); SrsStatistic* stat = SrsStatistic::instance(); stat->on_disconnect(_srs_context->get_id()); @@ -432,10 +433,9 @@ int SrsRtmpConn::stream_service_cycle() } // check ASAP, to fail it faster if invalid. - if (type != SrsRtmpConnPlay && !vhost_is_edge) { + if (type != SrsRtmpConnPlay) { // check publish available - // for edge, never check it, for edge use proxy mode. - if (!source->can_publish()) { + if (!source->can_publish(vhost_is_edge)) { ret = ERROR_SYSTEM_STREAM_BUSY; srs_warn("stream %s is already publishing. ret=%d", req->get_stream_url().c_str(), ret); diff --git a/trunk/src/app/srs_app_rtmp_conn.hpp b/trunk/src/app/srs_app_rtmp_conn.hpp old mode 100644 new mode 100755 diff --git a/trunk/src/app/srs_app_source.cpp b/trunk/src/app/srs_app_source.cpp index dfac100d1..d63154fe2 100755 --- a/trunk/src/app/srs_app_source.cpp +++ b/trunk/src/app/srs_app_source.cpp @@ -1350,8 +1350,12 @@ int SrsSource::source_id() return _source_id; } -bool SrsSource::can_publish() +bool SrsSource::can_publish(bool is_edge) { + if (is_edge) { + return publish_edge->can_publish(); + } + return _can_publish; } @@ -1522,7 +1526,7 @@ int SrsSource::on_audio_imp(SrsSharedPtrMessage* msg) // apply the error strategy for hls. // @see https://github.com/simple-rtmp-server/srs/issues/264 std::string hls_error_strategy = _srs_config->get_hls_on_error(_req->vhost); - if (hls_error_strategy == SRS_CONF_DEFAULT_HLS_ON_ERROR_IGNORE) { + if (srs_config_hls_is_on_error_ignore(hls_error_strategy)) { srs_warn("hls process audio message failed, ignore and disable hls. ret=%d", ret); // unpublish, ignore ret. @@ -1530,7 +1534,7 @@ int SrsSource::on_audio_imp(SrsSharedPtrMessage* msg) // ignore. ret = ERROR_SUCCESS; - } else if (hls_error_strategy == SRS_CONF_DEFAULT_HLS_ON_ERROR_CONTINUE) { + } else if (srs_config_hls_is_on_error_continue(hls_error_strategy)) { // compare the sequence header with audio, continue when it's actually an sequence header. if (ret == ERROR_HLS_DECODE_ERROR && cache_sh_audio && cache_sh_audio->size == msg->size) { srs_warn("the audio is actually a sequence header, ignore this packet."); @@ -1726,7 +1730,7 @@ int SrsSource::on_video_imp(SrsSharedPtrMessage* msg) // apply the error strategy for hls. // @see https://github.com/simple-rtmp-server/srs/issues/264 std::string hls_error_strategy = _srs_config->get_hls_on_error(_req->vhost); - if (hls_error_strategy == SRS_CONF_DEFAULT_HLS_ON_ERROR_IGNORE) { + if (srs_config_hls_is_on_error_ignore(hls_error_strategy)) { srs_warn("hls process video message failed, ignore and disable hls. ret=%d", ret); // unpublish, ignore ret. @@ -1734,7 +1738,7 @@ int SrsSource::on_video_imp(SrsSharedPtrMessage* msg) // ignore. ret = ERROR_SUCCESS; - } else if (hls_error_strategy == SRS_CONF_DEFAULT_HLS_ON_ERROR_CONTINUE) { + } else if (srs_config_hls_is_on_error_continue(hls_error_strategy)) { // compare the sequence header with video, continue when it's actually an sequence header. if (ret == ERROR_HLS_DECODE_ERROR && cache_sh_video && cache_sh_video->size == msg->size) { srs_warn("the video is actually a sequence header, ignore this packet."); diff --git a/trunk/src/app/srs_app_source.hpp b/trunk/src/app/srs_app_source.hpp old mode 100644 new mode 100755 index b654668d5..86661b190 --- a/trunk/src/app/srs_app_source.hpp +++ b/trunk/src/app/srs_app_source.hpp @@ -537,7 +537,7 @@ public: virtual int source_id(); // logic data methods public: - virtual bool can_publish(); + virtual bool can_publish(bool is_edge); virtual int on_meta_data(SrsCommonMessage* msg, SrsOnMetaDataPacket* metadata); public: virtual int on_audio(SrsCommonMessage* audio); diff --git a/trunk/src/app/srs_app_statistic.hpp b/trunk/src/app/srs_app_statistic.hpp index 8c6c108a4..949bd0633 100644 --- a/trunk/src/app/srs_app_statistic.hpp +++ b/trunk/src/app/srs_app_statistic.hpp @@ -154,14 +154,17 @@ public: virtual void on_stream_close(SrsRequest* req); public: /** - * when got a client to publish/play stream, - * @param id, the client srs id. - * @param req, the client request object. - */ + * when got a client to publish/play stream, + * @param id, the client srs id. + * @param req, the client request object. + */ virtual int on_client(int id, SrsRequest* req); /** - * client disconnect - */ + * client disconnect + * @remark the on_disconnect always call, while the on_client is call when + * only got the request object, so the client specified by id maybe not + * exists in stat. + */ virtual void on_disconnect(int id); /** * sample the kbps, add delta bytes of conn.