From e9e0cd757cdd1e98b5271230fab0fb19924724e0 Mon Sep 17 00:00:00 2001 From: winlin Date: Tue, 19 Aug 2014 10:59:59 +0800 Subject: [PATCH] fix #160, support forward/edge to flussonic, disable debug_srs_upnode to make flussonic happy. 0.9.201. --- README.md | 1 + trunk/conf/full.conf | 11 ++++ trunk/src/app/srs_app_config.cpp | 19 +++++- trunk/src/app/srs_app_config.hpp | 9 +++ trunk/src/app/srs_app_edge.cpp | 89 ++++++++++++++++++++++++--- trunk/src/app/srs_app_edge.hpp | 9 ++- trunk/src/app/srs_app_forward.cpp | 8 ++- trunk/src/app/srs_app_forward.hpp | 2 + trunk/src/core/srs_core.hpp | 2 +- trunk/src/libs/srs_librtmp.cpp | 2 +- trunk/src/rtmp/srs_protocol_rtmp.cpp | 10 +-- trunk/src/rtmp/srs_protocol_rtmp.hpp | 5 +- trunk/src/rtmp/srs_protocol_stack.cpp | 24 ++++---- trunk/src/utest/srs_utest_config.cpp | 52 ++++++++++++++++ 14 files changed, 207 insertions(+), 36 deletions(-) mode change 100644 => 100755 README.md diff --git a/README.md b/README.md old mode 100644 new mode 100755 index d37a617c8..3e606214b --- a/README.md +++ b/README.md @@ -208,6 +208,7 @@ Supported operating systems and hardware: * 2013-10-17, Created.
## History +* v1.0, 2014-08-19, for [#160](https://github.com/winlinvip/simple-rtmp-server/issues/160), support forward/edge to flussonic, disable debug_srs_upnode to make flussonic happy. 0.9.201. * 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. diff --git a/trunk/conf/full.conf b/trunk/conf/full.conf index d1b8b32f3..044ee24b1 100644 --- a/trunk/conf/full.conf +++ b/trunk/conf/full.conf @@ -405,6 +405,17 @@ vhost hooks.callback.srs.com { } } +# the vhost for srs debug info, whether send args in connect(tcUrl). +vhost debug.srs.com { + # when upnode(forward to, edge push to, edge pull from) is srs, + # it's strongly recommend to open the debug_srs_upnode, + # when connect to upnode, it will take the debug info, + # for example, the id, source id, pid. + # please see: https://github.com/winlinvip/simple-rtmp-server/wiki/SrsLog + # default: on + debug_srs_upnode on; +} + # the vhost for min delay, donot cache any stream. vhost min.delay.com { # whether cache the last gop. diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index 53f8fe46a..1b4f69b15 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -436,7 +436,7 @@ int SrsConfig::reload_conf(SrsConfig* conf) // always support reload without additional code: // chunk_size, ff_log_dir, max_connections, // bandcheck, http_hooks, heartbeat, - // token_traverse + // token_traverse, debug_srs_upnode // merge config: listen if (!srs_directive_equals(root->get("listen"), old_root->get("listen"))) { @@ -1285,6 +1285,7 @@ int SrsConfig::check_config() && n != "forward" && n != "transcode" && n != "bandcheck" && n != "time_jitter" && n != "atc" && n != "atc_auto" + && n != "debug_srs_upnode" ) { ret = ERROR_SYSTEM_CONFIG_INVALID; srs_error("unsupported vhost directive %s, ret=%d", n.c_str(), ret); @@ -1885,6 +1886,22 @@ bool SrsConfig::get_gop_cache(string vhost) return true; } +bool SrsConfig::get_debug_srs_upnode(string vhost) +{ + SrsConfDirective* conf = get_vhost(vhost); + + if (!conf) { + return true; + } + + conf = conf->get("debug_srs_upnode"); + if (conf && conf->arg0() == "off") { + return false; + } + + return true; +} + bool SrsConfig::get_atc(string vhost) { SrsConfDirective* conf = get_vhost(vhost); diff --git a/trunk/src/app/srs_app_config.hpp b/trunk/src/app/srs_app_config.hpp index d3f3d6d46..fe92bb5a8 100644 --- a/trunk/src/app/srs_app_config.hpp +++ b/trunk/src/app/srs_app_config.hpp @@ -467,6 +467,15 @@ public: */ virtual bool get_gop_cache(std::string vhost); /** + * whether debug_srs_upnode is enabled of vhost. + * debug_srs_upnode is very important feature for tracable log, + * but some server, for instance, flussonic donot support it. + * @see https://github.com/winlinvip/simple-rtmp-server/issues/160 + * @return true when debug_srs_upnode is ok; otherwise, false. + * @remark, default true. + */ + virtual bool get_debug_srs_upnode(std::string vhost); + /** * whether atc is enabled of vhost. * atc always use encoder timestamp, SRS never adjust the time. * @return true when atc is ok; otherwise, false. diff --git a/trunk/src/app/srs_app_edge.cpp b/trunk/src/app/srs_app_edge.cpp index cc26d6438..5102909ce 100644 --- a/trunk/src/app/srs_app_edge.cpp +++ b/trunk/src/app/srs_app_edge.cpp @@ -28,6 +28,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include +using namespace std; + #include #include #include @@ -118,7 +120,8 @@ int SrsEdgeIngester::cycle() { int ret = ERROR_SUCCESS; - if ((ret = connect_server()) != ERROR_SUCCESS) { + std::string ep_server, ep_port; + if ((ret = connect_server(ep_server, ep_port)) != ERROR_SUCCESS) { return ret; } srs_assert(client); @@ -132,7 +135,7 @@ int SrsEdgeIngester::cycle() srs_error("handshake with server failed. ret=%d", ret); return ret; } - if ((ret = connect_app()) != ERROR_SUCCESS) { + if ((ret = connect_app(ep_server, ep_port)) != ERROR_SUCCESS) { return ret; } if ((ret = client->create_stream(stream_id)) != ERROR_SUCCESS) { @@ -209,7 +212,7 @@ int SrsEdgeIngester::ingest() return ret; } -int SrsEdgeIngester::connect_app() +int SrsEdgeIngester::connect_app(string ep_server, string ep_port) { int ret = ERROR_SUCCESS; @@ -243,9 +246,16 @@ int SrsEdgeIngester::connect_app() std::string local_ip = ips[_srs_config->get_stats_network()]; data->set("srs_server_ip", SrsAmf0Any::str(local_ip.c_str())); + // generate the tcUrl + std::string param = ""; + std::string tc_url = srs_generate_tc_url(ep_server, req->vhost, req->app, ep_port, param); + // upnode server identity will show in the connect_app of client. - if ((ret = client->connect_app(req->app, req->tcUrl, req)) != ERROR_SUCCESS) { - srs_error("connect with server failed, tcUrl=%s. ret=%d", req->tcUrl.c_str(), ret); + // @see https://github.com/winlinvip/simple-rtmp-server/issues/160 + // the debug_srs_upnode is config in vhost and default to true. + bool debug_srs_upnode = _srs_config->get_debug_srs_upnode(req->vhost); + if ((ret = client->connect_app(req->app, tc_url, req, debug_srs_upnode)) != ERROR_SUCCESS) { + srs_error("connect with server failed, tcUrl=%s. ret=%d", tc_url.c_str(), ret); return ret; } @@ -314,7 +324,7 @@ void SrsEdgeIngester::close_underlayer_socket() srs_close_stfd(stfd); } -int SrsEdgeIngester::connect_server() +int SrsEdgeIngester::connect_server(string& ep_server, string& ep_port) { int ret = ERROR_SUCCESS; @@ -345,6 +355,10 @@ int SrsEdgeIngester::connect_server() port = ::atoi(s_port.c_str()); } + // output the connected server and port. + ep_server = server; + ep_port = s_port; + // open socket. int64_t timeout = SRS_EDGE_INGESTER_TIMEOUT_US; if ((ret = srs_socket_connect(server, port, timeout, &stfd)) != ERROR_SUCCESS) { @@ -414,7 +428,8 @@ int SrsEdgeForwarder::start() send_error_code = ERROR_SUCCESS; - if ((ret = connect_server()) != ERROR_SUCCESS) { + std::string ep_server, ep_port; + if ((ret = connect_server(ep_server, ep_port)) != ERROR_SUCCESS) { return ret; } srs_assert(client); @@ -428,8 +443,8 @@ int SrsEdgeForwarder::start() srs_error("handshake with server failed. ret=%d", ret); return ret; } - if ((ret = client->connect_app(req->app, req->tcUrl)) != ERROR_SUCCESS) { - srs_error("connect with server failed, tcUrl=%s. ret=%d", req->tcUrl.c_str(), ret); + if ((ret = connect_app(ep_server, ep_port)) != ERROR_SUCCESS) { + srs_error("connect with server failed. ret=%d", ret); return ret; } if ((ret = client->create_stream(stream_id)) != ERROR_SUCCESS) { @@ -575,7 +590,7 @@ void SrsEdgeForwarder::close_underlayer_socket() srs_close_stfd(stfd); } -int SrsEdgeForwarder::connect_server() +int SrsEdgeForwarder::connect_server(string& ep_server, string& ep_port) { int ret = ERROR_SUCCESS; @@ -598,6 +613,10 @@ int SrsEdgeForwarder::connect_server() port = ::atoi(s_port.c_str()); } + // output the connected server and port. + ep_server = server; + ep_port = s_port; + // open socket. int64_t timeout = SRS_EDGE_FORWARDER_TIMEOUT_US; if ((ret = srs_socket_connect(server, port, timeout, &stfd)) != ERROR_SUCCESS) { @@ -622,6 +641,56 @@ int SrsEdgeForwarder::connect_server() return ret; } +int SrsEdgeForwarder::connect_app(string ep_server, string ep_port) +{ + int ret = ERROR_SUCCESS; + + SrsRequest* req = _req; + + // args of request takes the srs info. + if (req->args == NULL) { + req->args = SrsAmf0Any::object(); + } + + // notify server the edge identity, + // @see https://github.com/winlinvip/simple-rtmp-server/issues/147 + SrsAmf0Object* data = req->args; + data->set("srs_sig", SrsAmf0Any::str(RTMP_SIG_SRS_KEY)); + data->set("srs_server", SrsAmf0Any::str(RTMP_SIG_SRS_KEY" "RTMP_SIG_SRS_VERSION" ("RTMP_SIG_SRS_URL_SHORT")")); + data->set("srs_license", SrsAmf0Any::str(RTMP_SIG_SRS_LICENSE)); + data->set("srs_role", SrsAmf0Any::str(RTMP_SIG_SRS_ROLE)); + data->set("srs_url", SrsAmf0Any::str(RTMP_SIG_SRS_URL)); + data->set("srs_version", SrsAmf0Any::str(RTMP_SIG_SRS_VERSION)); + data->set("srs_site", SrsAmf0Any::str(RTMP_SIG_SRS_WEB)); + data->set("srs_email", SrsAmf0Any::str(RTMP_SIG_SRS_EMAIL)); + data->set("srs_copyright", SrsAmf0Any::str(RTMP_SIG_SRS_COPYRIGHT)); + data->set("srs_primary_authors", SrsAmf0Any::str(RTMP_SIG_SRS_PRIMARY_AUTHROS)); + // for edge to directly get the id of client. + data->set("srs_pid", SrsAmf0Any::number(getpid())); + data->set("srs_id", SrsAmf0Any::number(_srs_context->get_id())); + + // local ip of edge + std::vector ips = srs_get_local_ipv4_ips(); + assert(_srs_config->get_stats_network() < (int)ips.size()); + std::string local_ip = ips[_srs_config->get_stats_network()]; + data->set("srs_server_ip", SrsAmf0Any::str(local_ip.c_str())); + + // generate the tcUrl + std::string param = ""; + std::string tc_url = srs_generate_tc_url(ep_server, req->vhost, req->app, ep_port, param); + + // upnode server identity will show in the connect_app of client. + // @see https://github.com/winlinvip/simple-rtmp-server/issues/160 + // the debug_srs_upnode is config in vhost and default to true. + bool debug_srs_upnode = _srs_config->get_debug_srs_upnode(req->vhost); + if ((ret = client->connect_app(req->app, tc_url, req, debug_srs_upnode)) != ERROR_SUCCESS) { + srs_error("connect with server failed, tcUrl=%s. ret=%d", tc_url.c_str(), ret); + return ret; + } + + return ret; +} + SrsPlayEdge::SrsPlayEdge() { state = SrsEdgeStateInit; diff --git a/trunk/src/app/srs_app_edge.hpp b/trunk/src/app/srs_app_edge.hpp index 6e3bad6a1..9b0247ca1 100644 --- a/trunk/src/app/srs_app_edge.hpp +++ b/trunk/src/app/srs_app_edge.hpp @@ -33,6 +33,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include +#include + class SrsStSocket; class SrsRtmpServer; class SrsSource; @@ -100,8 +102,8 @@ public: private: virtual int ingest(); virtual void close_underlayer_socket(); - virtual int connect_server(); - virtual int connect_app(); + virtual int connect_server(std::string& ep_server, std::string& ep_port); + virtual int connect_app(std::string ep_server, std::string ep_port); virtual int process_publish_message(SrsMessage* msg); }; @@ -149,7 +151,8 @@ public: virtual int proxy(SrsMessage* msg); private: virtual void close_underlayer_socket(); - virtual int connect_server(); + virtual int connect_server(std::string& ep_server, std::string& ep_port); + virtual int connect_app(std::string ep_server, std::string ep_port); }; /** diff --git a/trunk/src/app/srs_app_forward.cpp b/trunk/src/app/srs_app_forward.cpp index d1c1418e9..0994ffdca 100644 --- a/trunk/src/app/srs_app_forward.cpp +++ b/trunk/src/app/srs_app_forward.cpp @@ -81,8 +81,10 @@ int SrsForwarder::on_publish(SrsRequest* req, std::string forward_server) { int ret = ERROR_SUCCESS; + // TODO: FIXME: directly use the req object. // forward app app = req->app; + vhost = req->vhost; stream_name = req->stream; server = forward_server; @@ -215,7 +217,11 @@ int SrsForwarder::cycle() srs_error("handshake with server failed. ret=%d", ret); return ret; } - if ((ret = client->connect_app(app, tc_url)) != ERROR_SUCCESS) { + // TODO: FIXME: take debug info for srs, @see SrsEdgeForwarder.connect_server. + // @see https://github.com/winlinvip/simple-rtmp-server/issues/160 + // the debug_srs_upnode is config in vhost and default to true. + bool debug_srs_upnode = _srs_config->get_debug_srs_upnode(vhost); + if ((ret = client->connect_app(app, tc_url, NULL, debug_srs_upnode)) != ERROR_SUCCESS) { srs_error("connect with server failed, tcUrl=%s. ret=%d", tc_url.c_str(), ret); return ret; } diff --git a/trunk/src/app/srs_app_forward.hpp b/trunk/src/app/srs_app_forward.hpp index 72ee62f77..aae1b132e 100644 --- a/trunk/src/app/srs_app_forward.hpp +++ b/trunk/src/app/srs_app_forward.hpp @@ -53,6 +53,7 @@ class SrsForwarder : public ISrsThreadHandler private: std::string app; std::string tc_url; + std::string vhost; std::string stream_name; int stream_id; std::string server; @@ -83,6 +84,7 @@ public: virtual int cycle(); private: virtual void close_underlayer_socket(); + // TODO: FIXME: take debug info for srs, @see SrsEdgeForwarder.connect_server. virtual int connect_server(); virtual int forward(); }; diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index 7cd1e0468..78823f874 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 "200" +#define VERSION_REVISION "201" #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION // server info. #define RTMP_SIG_SRS_KEY "SRS" diff --git a/trunk/src/libs/srs_librtmp.cpp b/trunk/src/libs/srs_librtmp.cpp index 10f2a7e68..5a561a3b0 100644 --- a/trunk/src/libs/srs_librtmp.cpp +++ b/trunk/src/libs/srs_librtmp.cpp @@ -283,7 +283,7 @@ int srs_connect_app2(srs_rtmp_t rtmp, std::string sip, sserver, sauthors, sversion; - if ((ret = context->rtmp->connect_app2(context->app, tcUrl, NULL, + if ((ret = context->rtmp->connect_app2(context->app, tcUrl, NULL, true, sip, sserver, sauthors, sversion, *srs_id, *srs_pid)) != ERROR_SUCCESS) { return ret; } diff --git a/trunk/src/rtmp/srs_protocol_rtmp.cpp b/trunk/src/rtmp/srs_protocol_rtmp.cpp index e82712669..4a4b4f76d 100644 --- a/trunk/src/rtmp/srs_protocol_rtmp.cpp +++ b/trunk/src/rtmp/srs_protocol_rtmp.cpp @@ -434,7 +434,7 @@ int SrsRtmpClient::complex_handshake() return ret; } -int SrsRtmpClient::connect_app(string app, string tc_url, SrsRequest* req) +int SrsRtmpClient::connect_app(string app, string tc_url, SrsRequest* req, bool debug_srs_upnode) { std::string srs_server_ip; std::string srs_server; @@ -443,13 +443,13 @@ int SrsRtmpClient::connect_app(string app, string tc_url, SrsRequest* req) int srs_id = 0; int srs_pid = 0; - return connect_app2(app, tc_url, req, + return connect_app2(app, tc_url, req, debug_srs_upnode, srs_server_ip, srs_server, srs_primary_authors, srs_version, srs_id, srs_pid); } int SrsRtmpClient::connect_app2( - string app, string tc_url, SrsRequest* req, + string app, string tc_url, SrsRequest* req, bool debug_srs_upnode, string& srs_server_ip, string& srs_server, string& srs_primary_authors, string& srs_version, int& srs_id, int& srs_pid ){ @@ -479,7 +479,9 @@ int SrsRtmpClient::connect_app2( } pkt->command_object->set("objectEncoding", SrsAmf0Any::number(0)); - if (req && req->args) { + // @see https://github.com/winlinvip/simple-rtmp-server/issues/160 + // the debug_srs_upnode is config in vhost and default to true. + if (debug_srs_upnode && req && req->args) { srs_freep(pkt->args); pkt->args = req->args->copy()->to_object(); } diff --git a/trunk/src/rtmp/srs_protocol_rtmp.hpp b/trunk/src/rtmp/srs_protocol_rtmp.hpp index 71bd95cbb..2a023d864 100644 --- a/trunk/src/rtmp/srs_protocol_rtmp.hpp +++ b/trunk/src/rtmp/srs_protocol_rtmp.hpp @@ -247,7 +247,8 @@ public: * pageUrl and swfUrl for refer antisuck. * args for edge to origin traverse auth, @see SrsRequest.args */ - virtual int connect_app(std::string app, std::string tc_url, SrsRequest* req=NULL); + virtual int connect_app(std::string app, std::string tc_url, + SrsRequest* req=NULL, bool debug_srs_upnode=true); /** * connect to server, get the debug srs info. * @@ -263,7 +264,7 @@ public: * @param srs_pid, int, debug info, server pid in log. */ virtual int connect_app2( - std::string app, std::string tc_url, SrsRequest* req, + std::string app, std::string tc_url, SrsRequest* req, bool debug_srs_upnode, std::string& srs_server_ip, std::string& srs_server, std::string& srs_primary_authors, std::string& srs_version, int& srs_id, int& srs_pid ); diff --git a/trunk/src/rtmp/srs_protocol_stack.cpp b/trunk/src/rtmp/srs_protocol_stack.cpp index 714a3558e..95a4d77c9 100644 --- a/trunk/src/rtmp/srs_protocol_stack.cpp +++ b/trunk/src/rtmp/srs_protocol_stack.cpp @@ -1496,6 +1496,17 @@ int SrsProtocol::on_recv_message(SrsMessage* msg) case RTMP_MSG_SetChunkSize: { SrsSetChunkSizePacket* pkt = dynamic_cast(packet); srs_assert(pkt != NULL); + + // for some server, the actual chunk size can greater than the max value(65536), + // so we just warning the invalid chunk size, and actually use it is ok, + // @see: https://github.com/winlinvip/simple-rtmp-server/issues/160 + if (pkt->chunk_size < SRS_CONSTS_RTMP_MIN_CHUNK_SIZE + || pkt->chunk_size > SRS_CONSTS_RTMP_MAX_CHUNK_SIZE) + { + srs_warn("accept chunk size %d, but should in [%d, %d]", + pkt->chunk_size, SRS_CONSTS_RTMP_MIN_CHUNK_SIZE, + SRS_CONSTS_RTMP_MAX_CHUNK_SIZE); + } in_chunk_size = pkt->chunk_size; @@ -3711,19 +3722,6 @@ int SrsSetChunkSizePacket::decode(SrsStream* stream) chunk_size = stream->read_4bytes(); srs_info("decode chunk size success. chunk_size=%d", chunk_size); - if (chunk_size < SRS_CONSTS_RTMP_MIN_CHUNK_SIZE) { - ret = ERROR_RTMP_CHUNK_SIZE; - srs_error("invalid chunk size. min=%d, actual=%d, ret=%d", - ERROR_RTMP_CHUNK_SIZE, chunk_size, ret); - return ret; - } - if (chunk_size > SRS_CONSTS_RTMP_MAX_CHUNK_SIZE) { - ret = ERROR_RTMP_CHUNK_SIZE; - srs_error("invalid chunk size. max=%d, actual=%d, ret=%d", - SRS_CONSTS_RTMP_MAX_CHUNK_SIZE, chunk_size, ret); - return ret; - } - return ret; } diff --git a/trunk/src/utest/srs_utest_config.cpp b/trunk/src/utest/srs_utest_config.cpp index 232dcf3c3..b92cee3b8 100644 --- a/trunk/src/utest/srs_utest_config.cpp +++ b/trunk/src/utest/srs_utest_config.cpp @@ -491,6 +491,17 @@ std::string __full_conf = "" " queue_length 10; \n" "} \n" " \n" + "# the vhost for srs debug info, whether send args in connect(tcUrl). \n" + "vhost debug.srs.com { \n" + " # when upnode(forward to, edge push to, edge pull from) is srs, \n" + " # it's strongly recommend to open the debug_srs_upnode, \n" + " # when connect to upnode, it will take the debug info, \n" + " # for example, the id, source id, pid. \n" + " # please see: https://github.com/winlinvip/simple-rtmp-server/wiki/SrsLog \n" + " # default: on \n" + " debug_srs_upnode on; \n" + "} \n" + " \n" "# the vhost for antisuck. \n" "vhost refer.anti_suck.com { \n" " # the common refer for play and publish. \n" @@ -1864,6 +1875,7 @@ VOID TEST(ConfigMainTest, ParseFullConf) EXPECT_TRUE(conf.get_vhost_enabled(vhost)); EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); EXPECT_TRUE(conf.get_gop_cache(vhost)); + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost)); EXPECT_FALSE(conf.get_atc(vhost)); EXPECT_TRUE(conf.get_atc_auto(vhost)); EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); @@ -1944,6 +1956,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_same_edge) EXPECT_TRUE(conf.get_vhost_enabled(vhost)); EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); EXPECT_TRUE(conf.get_gop_cache(vhost)); + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost)); EXPECT_FALSE(conf.get_atc(vhost)); EXPECT_TRUE(conf.get_atc_auto(vhost)); EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); @@ -2023,6 +2036,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_change_edge) /*EXPECT_TRUE(conf.get_vhost_enabled(vhost)); EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); EXPECT_TRUE(conf.get_gop_cache(vhost)); + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost)); EXPECT_FALSE(conf.get_atc(vhost)); EXPECT_TRUE(conf.get_atc_auto(vhost)); EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); @@ -2096,6 +2110,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_dvr) EXPECT_TRUE(conf.get_vhost_enabled(vhost)); EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); EXPECT_TRUE(conf.get_gop_cache(vhost)); + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost)); EXPECT_FALSE(conf.get_atc(vhost)); EXPECT_TRUE(conf.get_atc_auto(vhost)); EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); @@ -2169,6 +2184,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_ingest) EXPECT_TRUE(conf.get_vhost_enabled(vhost)); EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); EXPECT_TRUE(conf.get_gop_cache(vhost)); + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost)); EXPECT_FALSE(conf.get_atc(vhost)); EXPECT_TRUE(conf.get_atc_auto(vhost)); EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); @@ -2263,6 +2279,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_http) EXPECT_TRUE(conf.get_vhost_enabled(vhost)); EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); EXPECT_TRUE(conf.get_gop_cache(vhost)); + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost)); EXPECT_FALSE(conf.get_atc(vhost)); EXPECT_TRUE(conf.get_atc_auto(vhost)); EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); @@ -2339,6 +2356,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_hls_enabled) EXPECT_TRUE(conf.get_vhost_enabled(vhost)); EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); EXPECT_TRUE(conf.get_gop_cache(vhost)); + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost)); EXPECT_FALSE(conf.get_atc(vhost)); EXPECT_TRUE(conf.get_atc_auto(vhost)); EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); @@ -2415,6 +2433,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_hls_disabled) EXPECT_TRUE(conf.get_vhost_enabled(vhost)); EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); EXPECT_TRUE(conf.get_gop_cache(vhost)); + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost)); EXPECT_FALSE(conf.get_atc(vhost)); EXPECT_TRUE(conf.get_atc_auto(vhost)); EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); @@ -2491,6 +2510,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_http_hooks) EXPECT_TRUE(conf.get_vhost_enabled(vhost)); EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); EXPECT_TRUE(conf.get_gop_cache(vhost)); + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost)); EXPECT_FALSE(conf.get_atc(vhost)); EXPECT_TRUE(conf.get_atc_auto(vhost)); EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); @@ -2598,6 +2618,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_min_delay) EXPECT_TRUE(conf.get_vhost_enabled(vhost)); EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); EXPECT_FALSE(conf.get_gop_cache(vhost)); + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost)); EXPECT_FALSE(conf.get_atc(vhost)); EXPECT_TRUE(conf.get_atc_auto(vhost)); EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); @@ -2675,6 +2696,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_refer_anti_suck) EXPECT_TRUE(conf.get_vhost_enabled(vhost)); EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); EXPECT_TRUE(conf.get_gop_cache(vhost)); + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost)); EXPECT_FALSE(conf.get_atc(vhost)); EXPECT_TRUE(conf.get_atc_auto(vhost)); EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); @@ -2767,6 +2789,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_forward_same_vhost) EXPECT_TRUE(conf.get_vhost_enabled(vhost)); EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); EXPECT_TRUE(conf.get_gop_cache(vhost)); + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost)); EXPECT_FALSE(conf.get_atc(vhost)); EXPECT_TRUE(conf.get_atc_auto(vhost)); EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); @@ -2850,6 +2873,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_forward_change_vhost) /*EXPECT_TRUE(conf.get_vhost_enabled(vhost)); EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); EXPECT_TRUE(conf.get_gop_cache(vhost)); + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost)); EXPECT_FALSE(conf.get_atc(vhost)); EXPECT_TRUE(conf.get_atc_auto(vhost)); EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); @@ -2927,6 +2951,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_mirror) EXPECT_TRUE(conf.get_vhost_enabled(vhost)); EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); EXPECT_TRUE(conf.get_gop_cache(vhost)); + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost)); EXPECT_FALSE(conf.get_atc(vhost)); EXPECT_TRUE(conf.get_atc_auto(vhost)); EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); @@ -3015,6 +3040,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_crop) EXPECT_TRUE(conf.get_vhost_enabled(vhost)); EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); EXPECT_TRUE(conf.get_gop_cache(vhost)); + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost)); EXPECT_FALSE(conf.get_atc(vhost)); EXPECT_TRUE(conf.get_atc_auto(vhost)); EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); @@ -3103,6 +3129,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_logo) EXPECT_TRUE(conf.get_vhost_enabled(vhost)); EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); EXPECT_TRUE(conf.get_gop_cache(vhost)); + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost)); EXPECT_FALSE(conf.get_atc(vhost)); EXPECT_TRUE(conf.get_atc_auto(vhost)); EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); @@ -3191,6 +3218,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_audio) EXPECT_TRUE(conf.get_vhost_enabled(vhost)); EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); EXPECT_TRUE(conf.get_gop_cache(vhost)); + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost)); EXPECT_FALSE(conf.get_atc(vhost)); EXPECT_TRUE(conf.get_atc_auto(vhost)); EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); @@ -3273,6 +3301,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_vn) EXPECT_TRUE(conf.get_vhost_enabled(vhost)); EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); EXPECT_TRUE(conf.get_gop_cache(vhost)); + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost)); EXPECT_FALSE(conf.get_atc(vhost)); EXPECT_TRUE(conf.get_atc_auto(vhost)); EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); @@ -3355,6 +3384,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_copy) EXPECT_TRUE(conf.get_vhost_enabled(vhost)); EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); EXPECT_TRUE(conf.get_gop_cache(vhost)); + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost)); EXPECT_FALSE(conf.get_atc(vhost)); EXPECT_TRUE(conf.get_atc_auto(vhost)); EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); @@ -3433,6 +3463,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_all) EXPECT_TRUE(conf.get_vhost_enabled(vhost)); EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); EXPECT_TRUE(conf.get_gop_cache(vhost)); + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost)); EXPECT_FALSE(conf.get_atc(vhost)); EXPECT_TRUE(conf.get_atc_auto(vhost)); EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); @@ -3649,6 +3680,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_ffempty) EXPECT_TRUE(conf.get_vhost_enabled(vhost)); EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); EXPECT_TRUE(conf.get_gop_cache(vhost)); + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost)); EXPECT_FALSE(conf.get_atc(vhost)); EXPECT_TRUE(conf.get_atc_auto(vhost)); EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); @@ -3737,6 +3769,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_app) EXPECT_TRUE(conf.get_vhost_enabled(vhost)); EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); EXPECT_TRUE(conf.get_gop_cache(vhost)); + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost)); EXPECT_FALSE(conf.get_atc(vhost)); EXPECT_TRUE(conf.get_atc_auto(vhost)); EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); @@ -3825,6 +3858,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_stream) EXPECT_TRUE(conf.get_vhost_enabled(vhost)); EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); EXPECT_TRUE(conf.get_gop_cache(vhost)); + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost)); EXPECT_FALSE(conf.get_atc(vhost)); EXPECT_TRUE(conf.get_atc_auto(vhost)); EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); @@ -3913,6 +3947,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_bandcheck) EXPECT_TRUE(conf.get_vhost_enabled(vhost)); EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); EXPECT_TRUE(conf.get_gop_cache(vhost)); + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost)); EXPECT_FALSE(conf.get_atc(vhost)); EXPECT_TRUE(conf.get_atc_auto(vhost)); EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); @@ -3990,6 +4025,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_chunksize) EXPECT_TRUE(conf.get_vhost_enabled(vhost)); EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); EXPECT_TRUE(conf.get_gop_cache(vhost)); + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost)); EXPECT_FALSE(conf.get_atc(vhost)); EXPECT_TRUE(conf.get_atc_auto(vhost)); EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); @@ -4067,6 +4103,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_jitter) EXPECT_TRUE(conf.get_vhost_enabled(vhost)); EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); EXPECT_TRUE(conf.get_gop_cache(vhost)); + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost)); EXPECT_FALSE(conf.get_atc(vhost)); EXPECT_TRUE(conf.get_atc_auto(vhost)); EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); @@ -4144,6 +4181,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_atc) EXPECT_TRUE(conf.get_vhost_enabled(vhost)); EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); EXPECT_TRUE(conf.get_gop_cache(vhost)); + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost)); EXPECT_TRUE(conf.get_atc(vhost)); EXPECT_TRUE(conf.get_atc_auto(vhost)); EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); @@ -4221,6 +4259,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_removed) EXPECT_FALSE(conf.get_vhost_enabled(vhost)); EXPECT_FALSE(conf.get_vhost_enabled(conf.get_vhost(vhost))); EXPECT_TRUE(conf.get_gop_cache(vhost)); + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost)); EXPECT_FALSE(conf.get_atc(vhost)); EXPECT_TRUE(conf.get_atc_auto(vhost)); EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); @@ -4973,6 +5012,19 @@ VOID TEST(ConfigMainTest, CheckConf_gop_cache) } } +VOID TEST(ConfigMainTest, CheckConf_debug_srs_upnode) +{ + if (true) { + MockSrsConfig conf; + EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost v{debug_srs_upnode off;}")); + } + + if (true) { + MockSrsConfig conf; + EXPECT_TRUE(ERROR_SUCCESS != conf.parse(_MIN_OK_CONF"vhost v{debug_srs_upnodes off;}")); + } +} + VOID TEST(ConfigMainTest, CheckConf_refer) { if (true) {