winlin

fix #160, support forward/edge to flussonic, disable debug_srs_upnode to make fl…

…ussonic happy. 0.9.201.
@@ -208,6 +208,7 @@ Supported operating systems and hardware: @@ -208,6 +208,7 @@ Supported operating systems and hardware:
208 * 2013-10-17, Created.<br/> 208 * 2013-10-17, Created.<br/>
209 209
210 ## History 210 ## History
  211 +* 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.
211 * 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. 212 * 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.
212 * 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. 213 * 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.
213 * v1.0, 2014-08-06, fix [#147](https://github.com/winlinvip/simple-rtmp-server/issues/147), support identify the srs edge. 0.9.190. 214 * v1.0, 2014-08-06, fix [#147](https://github.com/winlinvip/simple-rtmp-server/issues/147), support identify the srs edge. 0.9.190.
@@ -405,6 +405,17 @@ vhost hooks.callback.srs.com { @@ -405,6 +405,17 @@ vhost hooks.callback.srs.com {
405 } 405 }
406 } 406 }
407 407
  408 +# the vhost for srs debug info, whether send args in connect(tcUrl).
  409 +vhost debug.srs.com {
  410 + # when upnode(forward to, edge push to, edge pull from) is srs,
  411 + # it's strongly recommend to open the debug_srs_upnode,
  412 + # when connect to upnode, it will take the debug info,
  413 + # for example, the id, source id, pid.
  414 + # please see: https://github.com/winlinvip/simple-rtmp-server/wiki/SrsLog
  415 + # default: on
  416 + debug_srs_upnode on;
  417 +}
  418 +
408 # the vhost for min delay, donot cache any stream. 419 # the vhost for min delay, donot cache any stream.
409 vhost min.delay.com { 420 vhost min.delay.com {
410 # whether cache the last gop. 421 # whether cache the last gop.
@@ -436,7 +436,7 @@ int SrsConfig::reload_conf(SrsConfig* conf) @@ -436,7 +436,7 @@ int SrsConfig::reload_conf(SrsConfig* conf)
436 // always support reload without additional code: 436 // always support reload without additional code:
437 // chunk_size, ff_log_dir, max_connections, 437 // chunk_size, ff_log_dir, max_connections,
438 // bandcheck, http_hooks, heartbeat, 438 // bandcheck, http_hooks, heartbeat,
439 - // token_traverse 439 + // token_traverse, debug_srs_upnode
440 440
441 // merge config: listen 441 // merge config: listen
442 if (!srs_directive_equals(root->get("listen"), old_root->get("listen"))) { 442 if (!srs_directive_equals(root->get("listen"), old_root->get("listen"))) {
@@ -1285,6 +1285,7 @@ int SrsConfig::check_config() @@ -1285,6 +1285,7 @@ int SrsConfig::check_config()
1285 && n != "forward" && n != "transcode" && n != "bandcheck" 1285 && n != "forward" && n != "transcode" && n != "bandcheck"
1286 && n != "time_jitter" 1286 && n != "time_jitter"
1287 && n != "atc" && n != "atc_auto" 1287 && n != "atc" && n != "atc_auto"
  1288 + && n != "debug_srs_upnode"
1288 ) { 1289 ) {
1289 ret = ERROR_SYSTEM_CONFIG_INVALID; 1290 ret = ERROR_SYSTEM_CONFIG_INVALID;
1290 srs_error("unsupported vhost directive %s, ret=%d", n.c_str(), ret); 1291 srs_error("unsupported vhost directive %s, ret=%d", n.c_str(), ret);
@@ -1885,6 +1886,22 @@ bool SrsConfig::get_gop_cache(string vhost) @@ -1885,6 +1886,22 @@ bool SrsConfig::get_gop_cache(string vhost)
1885 return true; 1886 return true;
1886 } 1887 }
1887 1888
  1889 +bool SrsConfig::get_debug_srs_upnode(string vhost)
  1890 +{
  1891 + SrsConfDirective* conf = get_vhost(vhost);
  1892 +
  1893 + if (!conf) {
  1894 + return true;
  1895 + }
  1896 +
  1897 + conf = conf->get("debug_srs_upnode");
  1898 + if (conf && conf->arg0() == "off") {
  1899 + return false;
  1900 + }
  1901 +
  1902 + return true;
  1903 +}
  1904 +
1888 bool SrsConfig::get_atc(string vhost) 1905 bool SrsConfig::get_atc(string vhost)
1889 { 1906 {
1890 SrsConfDirective* conf = get_vhost(vhost); 1907 SrsConfDirective* conf = get_vhost(vhost);
@@ -467,6 +467,15 @@ public: @@ -467,6 +467,15 @@ public:
467 */ 467 */
468 virtual bool get_gop_cache(std::string vhost); 468 virtual bool get_gop_cache(std::string vhost);
469 /** 469 /**
  470 + * whether debug_srs_upnode is enabled of vhost.
  471 + * debug_srs_upnode is very important feature for tracable log,
  472 + * but some server, for instance, flussonic donot support it.
  473 + * @see https://github.com/winlinvip/simple-rtmp-server/issues/160
  474 + * @return true when debug_srs_upnode is ok; otherwise, false.
  475 + * @remark, default true.
  476 + */
  477 + virtual bool get_debug_srs_upnode(std::string vhost);
  478 + /**
470 * whether atc is enabled of vhost. 479 * whether atc is enabled of vhost.
471 * atc always use encoder timestamp, SRS never adjust the time. 480 * atc always use encoder timestamp, SRS never adjust the time.
472 * @return true when atc is ok; otherwise, false. 481 * @return true when atc is ok; otherwise, false.
@@ -28,6 +28,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -28,6 +28,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 #include <netinet/in.h> 28 #include <netinet/in.h>
29 #include <arpa/inet.h> 29 #include <arpa/inet.h>
30 30
  31 +using namespace std;
  32 +
31 #include <srs_kernel_error.hpp> 33 #include <srs_kernel_error.hpp>
32 #include <srs_protocol_rtmp.hpp> 34 #include <srs_protocol_rtmp.hpp>
33 #include <srs_kernel_log.hpp> 35 #include <srs_kernel_log.hpp>
@@ -118,7 +120,8 @@ int SrsEdgeIngester::cycle() @@ -118,7 +120,8 @@ int SrsEdgeIngester::cycle()
118 { 120 {
119 int ret = ERROR_SUCCESS; 121 int ret = ERROR_SUCCESS;
120 122
121 - if ((ret = connect_server()) != ERROR_SUCCESS) { 123 + std::string ep_server, ep_port;
  124 + if ((ret = connect_server(ep_server, ep_port)) != ERROR_SUCCESS) {
122 return ret; 125 return ret;
123 } 126 }
124 srs_assert(client); 127 srs_assert(client);
@@ -132,7 +135,7 @@ int SrsEdgeIngester::cycle() @@ -132,7 +135,7 @@ int SrsEdgeIngester::cycle()
132 srs_error("handshake with server failed. ret=%d", ret); 135 srs_error("handshake with server failed. ret=%d", ret);
133 return ret; 136 return ret;
134 } 137 }
135 - if ((ret = connect_app()) != ERROR_SUCCESS) { 138 + if ((ret = connect_app(ep_server, ep_port)) != ERROR_SUCCESS) {
136 return ret; 139 return ret;
137 } 140 }
138 if ((ret = client->create_stream(stream_id)) != ERROR_SUCCESS) { 141 if ((ret = client->create_stream(stream_id)) != ERROR_SUCCESS) {
@@ -209,7 +212,7 @@ int SrsEdgeIngester::ingest() @@ -209,7 +212,7 @@ int SrsEdgeIngester::ingest()
209 return ret; 212 return ret;
210 } 213 }
211 214
212 -int SrsEdgeIngester::connect_app() 215 +int SrsEdgeIngester::connect_app(string ep_server, string ep_port)
213 { 216 {
214 int ret = ERROR_SUCCESS; 217 int ret = ERROR_SUCCESS;
215 218
@@ -243,9 +246,16 @@ int SrsEdgeIngester::connect_app() @@ -243,9 +246,16 @@ int SrsEdgeIngester::connect_app()
243 std::string local_ip = ips[_srs_config->get_stats_network()]; 246 std::string local_ip = ips[_srs_config->get_stats_network()];
244 data->set("srs_server_ip", SrsAmf0Any::str(local_ip.c_str())); 247 data->set("srs_server_ip", SrsAmf0Any::str(local_ip.c_str()));
245 248
  249 + // generate the tcUrl
  250 + std::string param = "";
  251 + std::string tc_url = srs_generate_tc_url(ep_server, req->vhost, req->app, ep_port, param);
  252 +
246 // upnode server identity will show in the connect_app of client. 253 // upnode server identity will show in the connect_app of client.
247 - if ((ret = client->connect_app(req->app, req->tcUrl, req)) != ERROR_SUCCESS) {  
248 - srs_error("connect with server failed, tcUrl=%s. ret=%d", req->tcUrl.c_str(), ret); 254 + // @see https://github.com/winlinvip/simple-rtmp-server/issues/160
  255 + // the debug_srs_upnode is config in vhost and default to true.
  256 + bool debug_srs_upnode = _srs_config->get_debug_srs_upnode(req->vhost);
  257 + if ((ret = client->connect_app(req->app, tc_url, req, debug_srs_upnode)) != ERROR_SUCCESS) {
  258 + srs_error("connect with server failed, tcUrl=%s. ret=%d", tc_url.c_str(), ret);
249 return ret; 259 return ret;
250 } 260 }
251 261
@@ -314,7 +324,7 @@ void SrsEdgeIngester::close_underlayer_socket() @@ -314,7 +324,7 @@ void SrsEdgeIngester::close_underlayer_socket()
314 srs_close_stfd(stfd); 324 srs_close_stfd(stfd);
315 } 325 }
316 326
317 -int SrsEdgeIngester::connect_server() 327 +int SrsEdgeIngester::connect_server(string& ep_server, string& ep_port)
318 { 328 {
319 int ret = ERROR_SUCCESS; 329 int ret = ERROR_SUCCESS;
320 330
@@ -345,6 +355,10 @@ int SrsEdgeIngester::connect_server() @@ -345,6 +355,10 @@ int SrsEdgeIngester::connect_server()
345 port = ::atoi(s_port.c_str()); 355 port = ::atoi(s_port.c_str());
346 } 356 }
347 357
  358 + // output the connected server and port.
  359 + ep_server = server;
  360 + ep_port = s_port;
  361 +
348 // open socket. 362 // open socket.
349 int64_t timeout = SRS_EDGE_INGESTER_TIMEOUT_US; 363 int64_t timeout = SRS_EDGE_INGESTER_TIMEOUT_US;
350 if ((ret = srs_socket_connect(server, port, timeout, &stfd)) != ERROR_SUCCESS) { 364 if ((ret = srs_socket_connect(server, port, timeout, &stfd)) != ERROR_SUCCESS) {
@@ -414,7 +428,8 @@ int SrsEdgeForwarder::start() @@ -414,7 +428,8 @@ int SrsEdgeForwarder::start()
414 428
415 send_error_code = ERROR_SUCCESS; 429 send_error_code = ERROR_SUCCESS;
416 430
417 - if ((ret = connect_server()) != ERROR_SUCCESS) { 431 + std::string ep_server, ep_port;
  432 + if ((ret = connect_server(ep_server, ep_port)) != ERROR_SUCCESS) {
418 return ret; 433 return ret;
419 } 434 }
420 srs_assert(client); 435 srs_assert(client);
@@ -428,8 +443,8 @@ int SrsEdgeForwarder::start() @@ -428,8 +443,8 @@ int SrsEdgeForwarder::start()
428 srs_error("handshake with server failed. ret=%d", ret); 443 srs_error("handshake with server failed. ret=%d", ret);
429 return ret; 444 return ret;
430 } 445 }
431 - if ((ret = client->connect_app(req->app, req->tcUrl)) != ERROR_SUCCESS) {  
432 - srs_error("connect with server failed, tcUrl=%s. ret=%d", req->tcUrl.c_str(), ret); 446 + if ((ret = connect_app(ep_server, ep_port)) != ERROR_SUCCESS) {
  447 + srs_error("connect with server failed. ret=%d", ret);
433 return ret; 448 return ret;
434 } 449 }
435 if ((ret = client->create_stream(stream_id)) != ERROR_SUCCESS) { 450 if ((ret = client->create_stream(stream_id)) != ERROR_SUCCESS) {
@@ -575,7 +590,7 @@ void SrsEdgeForwarder::close_underlayer_socket() @@ -575,7 +590,7 @@ void SrsEdgeForwarder::close_underlayer_socket()
575 srs_close_stfd(stfd); 590 srs_close_stfd(stfd);
576 } 591 }
577 592
578 -int SrsEdgeForwarder::connect_server() 593 +int SrsEdgeForwarder::connect_server(string& ep_server, string& ep_port)
579 { 594 {
580 int ret = ERROR_SUCCESS; 595 int ret = ERROR_SUCCESS;
581 596
@@ -598,6 +613,10 @@ int SrsEdgeForwarder::connect_server() @@ -598,6 +613,10 @@ int SrsEdgeForwarder::connect_server()
598 port = ::atoi(s_port.c_str()); 613 port = ::atoi(s_port.c_str());
599 } 614 }
600 615
  616 + // output the connected server and port.
  617 + ep_server = server;
  618 + ep_port = s_port;
  619 +
601 // open socket. 620 // open socket.
602 int64_t timeout = SRS_EDGE_FORWARDER_TIMEOUT_US; 621 int64_t timeout = SRS_EDGE_FORWARDER_TIMEOUT_US;
603 if ((ret = srs_socket_connect(server, port, timeout, &stfd)) != ERROR_SUCCESS) { 622 if ((ret = srs_socket_connect(server, port, timeout, &stfd)) != ERROR_SUCCESS) {
@@ -622,6 +641,56 @@ int SrsEdgeForwarder::connect_server() @@ -622,6 +641,56 @@ int SrsEdgeForwarder::connect_server()
622 return ret; 641 return ret;
623 } 642 }
624 643
  644 +int SrsEdgeForwarder::connect_app(string ep_server, string ep_port)
  645 +{
  646 + int ret = ERROR_SUCCESS;
  647 +
  648 + SrsRequest* req = _req;
  649 +
  650 + // args of request takes the srs info.
  651 + if (req->args == NULL) {
  652 + req->args = SrsAmf0Any::object();
  653 + }
  654 +
  655 + // notify server the edge identity,
  656 + // @see https://github.com/winlinvip/simple-rtmp-server/issues/147
  657 + SrsAmf0Object* data = req->args;
  658 + data->set("srs_sig", SrsAmf0Any::str(RTMP_SIG_SRS_KEY));
  659 + data->set("srs_server", SrsAmf0Any::str(RTMP_SIG_SRS_KEY" "RTMP_SIG_SRS_VERSION" ("RTMP_SIG_SRS_URL_SHORT")"));
  660 + data->set("srs_license", SrsAmf0Any::str(RTMP_SIG_SRS_LICENSE));
  661 + data->set("srs_role", SrsAmf0Any::str(RTMP_SIG_SRS_ROLE));
  662 + data->set("srs_url", SrsAmf0Any::str(RTMP_SIG_SRS_URL));
  663 + data->set("srs_version", SrsAmf0Any::str(RTMP_SIG_SRS_VERSION));
  664 + data->set("srs_site", SrsAmf0Any::str(RTMP_SIG_SRS_WEB));
  665 + data->set("srs_email", SrsAmf0Any::str(RTMP_SIG_SRS_EMAIL));
  666 + data->set("srs_copyright", SrsAmf0Any::str(RTMP_SIG_SRS_COPYRIGHT));
  667 + data->set("srs_primary_authors", SrsAmf0Any::str(RTMP_SIG_SRS_PRIMARY_AUTHROS));
  668 + // for edge to directly get the id of client.
  669 + data->set("srs_pid", SrsAmf0Any::number(getpid()));
  670 + data->set("srs_id", SrsAmf0Any::number(_srs_context->get_id()));
  671 +
  672 + // local ip of edge
  673 + std::vector<std::string> ips = srs_get_local_ipv4_ips();
  674 + assert(_srs_config->get_stats_network() < (int)ips.size());
  675 + std::string local_ip = ips[_srs_config->get_stats_network()];
  676 + data->set("srs_server_ip", SrsAmf0Any::str(local_ip.c_str()));
  677 +
  678 + // generate the tcUrl
  679 + std::string param = "";
  680 + std::string tc_url = srs_generate_tc_url(ep_server, req->vhost, req->app, ep_port, param);
  681 +
  682 + // upnode server identity will show in the connect_app of client.
  683 + // @see https://github.com/winlinvip/simple-rtmp-server/issues/160
  684 + // the debug_srs_upnode is config in vhost and default to true.
  685 + bool debug_srs_upnode = _srs_config->get_debug_srs_upnode(req->vhost);
  686 + if ((ret = client->connect_app(req->app, tc_url, req, debug_srs_upnode)) != ERROR_SUCCESS) {
  687 + srs_error("connect with server failed, tcUrl=%s. ret=%d", tc_url.c_str(), ret);
  688 + return ret;
  689 + }
  690 +
  691 + return ret;
  692 +}
  693 +
625 SrsPlayEdge::SrsPlayEdge() 694 SrsPlayEdge::SrsPlayEdge()
626 { 695 {
627 state = SrsEdgeStateInit; 696 state = SrsEdgeStateInit;
@@ -33,6 +33,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -33,6 +33,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 #include <srs_app_st.hpp> 33 #include <srs_app_st.hpp>
34 #include <srs_app_thread.hpp> 34 #include <srs_app_thread.hpp>
35 35
  36 +#include <string>
  37 +
36 class SrsStSocket; 38 class SrsStSocket;
37 class SrsRtmpServer; 39 class SrsRtmpServer;
38 class SrsSource; 40 class SrsSource;
@@ -100,8 +102,8 @@ public: @@ -100,8 +102,8 @@ public:
100 private: 102 private:
101 virtual int ingest(); 103 virtual int ingest();
102 virtual void close_underlayer_socket(); 104 virtual void close_underlayer_socket();
103 - virtual int connect_server();  
104 - virtual int connect_app(); 105 + virtual int connect_server(std::string& ep_server, std::string& ep_port);
  106 + virtual int connect_app(std::string ep_server, std::string ep_port);
105 virtual int process_publish_message(SrsMessage* msg); 107 virtual int process_publish_message(SrsMessage* msg);
106 }; 108 };
107 109
@@ -149,7 +151,8 @@ public: @@ -149,7 +151,8 @@ public:
149 virtual int proxy(SrsMessage* msg); 151 virtual int proxy(SrsMessage* msg);
150 private: 152 private:
151 virtual void close_underlayer_socket(); 153 virtual void close_underlayer_socket();
152 - virtual int connect_server(); 154 + virtual int connect_server(std::string& ep_server, std::string& ep_port);
  155 + virtual int connect_app(std::string ep_server, std::string ep_port);
153 }; 156 };
154 157
155 /** 158 /**
@@ -81,8 +81,10 @@ int SrsForwarder::on_publish(SrsRequest* req, std::string forward_server) @@ -81,8 +81,10 @@ int SrsForwarder::on_publish(SrsRequest* req, std::string forward_server)
81 { 81 {
82 int ret = ERROR_SUCCESS; 82 int ret = ERROR_SUCCESS;
83 83
  84 + // TODO: FIXME: directly use the req object.
84 // forward app 85 // forward app
85 app = req->app; 86 app = req->app;
  87 + vhost = req->vhost;
86 88
87 stream_name = req->stream; 89 stream_name = req->stream;
88 server = forward_server; 90 server = forward_server;
@@ -215,7 +217,11 @@ int SrsForwarder::cycle() @@ -215,7 +217,11 @@ int SrsForwarder::cycle()
215 srs_error("handshake with server failed. ret=%d", ret); 217 srs_error("handshake with server failed. ret=%d", ret);
216 return ret; 218 return ret;
217 } 219 }
218 - if ((ret = client->connect_app(app, tc_url)) != ERROR_SUCCESS) { 220 + // TODO: FIXME: take debug info for srs, @see SrsEdgeForwarder.connect_server.
  221 + // @see https://github.com/winlinvip/simple-rtmp-server/issues/160
  222 + // the debug_srs_upnode is config in vhost and default to true.
  223 + bool debug_srs_upnode = _srs_config->get_debug_srs_upnode(vhost);
  224 + if ((ret = client->connect_app(app, tc_url, NULL, debug_srs_upnode)) != ERROR_SUCCESS) {
219 srs_error("connect with server failed, tcUrl=%s. ret=%d", tc_url.c_str(), ret); 225 srs_error("connect with server failed, tcUrl=%s. ret=%d", tc_url.c_str(), ret);
220 return ret; 226 return ret;
221 } 227 }
@@ -53,6 +53,7 @@ class SrsForwarder : public ISrsThreadHandler @@ -53,6 +53,7 @@ class SrsForwarder : public ISrsThreadHandler
53 private: 53 private:
54 std::string app; 54 std::string app;
55 std::string tc_url; 55 std::string tc_url;
  56 + std::string vhost;
56 std::string stream_name; 57 std::string stream_name;
57 int stream_id; 58 int stream_id;
58 std::string server; 59 std::string server;
@@ -83,6 +84,7 @@ public: @@ -83,6 +84,7 @@ public:
83 virtual int cycle(); 84 virtual int cycle();
84 private: 85 private:
85 virtual void close_underlayer_socket(); 86 virtual void close_underlayer_socket();
  87 + // TODO: FIXME: take debug info for srs, @see SrsEdgeForwarder.connect_server.
86 virtual int connect_server(); 88 virtual int connect_server();
87 virtual int forward(); 89 virtual int forward();
88 }; 90 };
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 // current release version 31 // current release version
32 #define VERSION_MAJOR "0" 32 #define VERSION_MAJOR "0"
33 #define VERSION_MINOR "9" 33 #define VERSION_MINOR "9"
34 -#define VERSION_REVISION "200" 34 +#define VERSION_REVISION "201"
35 #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION 35 #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
36 // server info. 36 // server info.
37 #define RTMP_SIG_SRS_KEY "SRS" 37 #define RTMP_SIG_SRS_KEY "SRS"
@@ -283,7 +283,7 @@ int srs_connect_app2(srs_rtmp_t rtmp, @@ -283,7 +283,7 @@ int srs_connect_app2(srs_rtmp_t rtmp,
283 283
284 std::string sip, sserver, sauthors, sversion; 284 std::string sip, sserver, sauthors, sversion;
285 285
286 - if ((ret = context->rtmp->connect_app2(context->app, tcUrl, NULL, 286 + if ((ret = context->rtmp->connect_app2(context->app, tcUrl, NULL, true,
287 sip, sserver, sauthors, sversion, *srs_id, *srs_pid)) != ERROR_SUCCESS) { 287 sip, sserver, sauthors, sversion, *srs_id, *srs_pid)) != ERROR_SUCCESS) {
288 return ret; 288 return ret;
289 } 289 }
@@ -434,7 +434,7 @@ int SrsRtmpClient::complex_handshake() @@ -434,7 +434,7 @@ int SrsRtmpClient::complex_handshake()
434 return ret; 434 return ret;
435 } 435 }
436 436
437 -int SrsRtmpClient::connect_app(string app, string tc_url, SrsRequest* req) 437 +int SrsRtmpClient::connect_app(string app, string tc_url, SrsRequest* req, bool debug_srs_upnode)
438 { 438 {
439 std::string srs_server_ip; 439 std::string srs_server_ip;
440 std::string srs_server; 440 std::string srs_server;
@@ -443,13 +443,13 @@ int SrsRtmpClient::connect_app(string app, string tc_url, SrsRequest* req) @@ -443,13 +443,13 @@ int SrsRtmpClient::connect_app(string app, string tc_url, SrsRequest* req)
443 int srs_id = 0; 443 int srs_id = 0;
444 int srs_pid = 0; 444 int srs_pid = 0;
445 445
446 - return connect_app2(app, tc_url, req, 446 + return connect_app2(app, tc_url, req, debug_srs_upnode,
447 srs_server_ip, srs_server, srs_primary_authors, 447 srs_server_ip, srs_server, srs_primary_authors,
448 srs_version, srs_id, srs_pid); 448 srs_version, srs_id, srs_pid);
449 } 449 }
450 450
451 int SrsRtmpClient::connect_app2( 451 int SrsRtmpClient::connect_app2(
452 - string app, string tc_url, SrsRequest* req, 452 + string app, string tc_url, SrsRequest* req, bool debug_srs_upnode,
453 string& srs_server_ip, string& srs_server, string& srs_primary_authors, 453 string& srs_server_ip, string& srs_server, string& srs_primary_authors,
454 string& srs_version, int& srs_id, int& srs_pid 454 string& srs_version, int& srs_id, int& srs_pid
455 ){ 455 ){
@@ -479,7 +479,9 @@ int SrsRtmpClient::connect_app2( @@ -479,7 +479,9 @@ int SrsRtmpClient::connect_app2(
479 } 479 }
480 pkt->command_object->set("objectEncoding", SrsAmf0Any::number(0)); 480 pkt->command_object->set("objectEncoding", SrsAmf0Any::number(0));
481 481
482 - if (req && req->args) { 482 + // @see https://github.com/winlinvip/simple-rtmp-server/issues/160
  483 + // the debug_srs_upnode is config in vhost and default to true.
  484 + if (debug_srs_upnode && req && req->args) {
483 srs_freep(pkt->args); 485 srs_freep(pkt->args);
484 pkt->args = req->args->copy()->to_object(); 486 pkt->args = req->args->copy()->to_object();
485 } 487 }
@@ -247,7 +247,8 @@ public: @@ -247,7 +247,8 @@ public:
247 * pageUrl and swfUrl for refer antisuck. 247 * pageUrl and swfUrl for refer antisuck.
248 * args for edge to origin traverse auth, @see SrsRequest.args 248 * args for edge to origin traverse auth, @see SrsRequest.args
249 */ 249 */
250 - virtual int connect_app(std::string app, std::string tc_url, SrsRequest* req=NULL); 250 + virtual int connect_app(std::string app, std::string tc_url,
  251 + SrsRequest* req=NULL, bool debug_srs_upnode=true);
251 /** 252 /**
252 * connect to server, get the debug srs info. 253 * connect to server, get the debug srs info.
253 * 254 *
@@ -263,7 +264,7 @@ public: @@ -263,7 +264,7 @@ public:
263 * @param srs_pid, int, debug info, server pid in log. 264 * @param srs_pid, int, debug info, server pid in log.
264 */ 265 */
265 virtual int connect_app2( 266 virtual int connect_app2(
266 - std::string app, std::string tc_url, SrsRequest* req, 267 + std::string app, std::string tc_url, SrsRequest* req, bool debug_srs_upnode,
267 std::string& srs_server_ip, std::string& srs_server, std::string& srs_primary_authors, 268 std::string& srs_server_ip, std::string& srs_server, std::string& srs_primary_authors,
268 std::string& srs_version, int& srs_id, int& srs_pid 269 std::string& srs_version, int& srs_id, int& srs_pid
269 ); 270 );
@@ -1496,6 +1496,17 @@ int SrsProtocol::on_recv_message(SrsMessage* msg) @@ -1496,6 +1496,17 @@ int SrsProtocol::on_recv_message(SrsMessage* msg)
1496 case RTMP_MSG_SetChunkSize: { 1496 case RTMP_MSG_SetChunkSize: {
1497 SrsSetChunkSizePacket* pkt = dynamic_cast<SrsSetChunkSizePacket*>(packet); 1497 SrsSetChunkSizePacket* pkt = dynamic_cast<SrsSetChunkSizePacket*>(packet);
1498 srs_assert(pkt != NULL); 1498 srs_assert(pkt != NULL);
  1499 +
  1500 + // for some server, the actual chunk size can greater than the max value(65536),
  1501 + // so we just warning the invalid chunk size, and actually use it is ok,
  1502 + // @see: https://github.com/winlinvip/simple-rtmp-server/issues/160
  1503 + if (pkt->chunk_size < SRS_CONSTS_RTMP_MIN_CHUNK_SIZE
  1504 + || pkt->chunk_size > SRS_CONSTS_RTMP_MAX_CHUNK_SIZE)
  1505 + {
  1506 + srs_warn("accept chunk size %d, but should in [%d, %d]",
  1507 + pkt->chunk_size, SRS_CONSTS_RTMP_MIN_CHUNK_SIZE,
  1508 + SRS_CONSTS_RTMP_MAX_CHUNK_SIZE);
  1509 + }
1499 1510
1500 in_chunk_size = pkt->chunk_size; 1511 in_chunk_size = pkt->chunk_size;
1501 1512
@@ -3711,19 +3722,6 @@ int SrsSetChunkSizePacket::decode(SrsStream* stream) @@ -3711,19 +3722,6 @@ int SrsSetChunkSizePacket::decode(SrsStream* stream)
3711 chunk_size = stream->read_4bytes(); 3722 chunk_size = stream->read_4bytes();
3712 srs_info("decode chunk size success. chunk_size=%d", chunk_size); 3723 srs_info("decode chunk size success. chunk_size=%d", chunk_size);
3713 3724
3714 - if (chunk_size < SRS_CONSTS_RTMP_MIN_CHUNK_SIZE) {  
3715 - ret = ERROR_RTMP_CHUNK_SIZE;  
3716 - srs_error("invalid chunk size. min=%d, actual=%d, ret=%d",  
3717 - ERROR_RTMP_CHUNK_SIZE, chunk_size, ret);  
3718 - return ret;  
3719 - }  
3720 - if (chunk_size > SRS_CONSTS_RTMP_MAX_CHUNK_SIZE) {  
3721 - ret = ERROR_RTMP_CHUNK_SIZE;  
3722 - srs_error("invalid chunk size. max=%d, actual=%d, ret=%d",  
3723 - SRS_CONSTS_RTMP_MAX_CHUNK_SIZE, chunk_size, ret);  
3724 - return ret;  
3725 - }  
3726 -  
3727 return ret; 3725 return ret;
3728 } 3726 }
3729 3727
@@ -491,6 +491,17 @@ std::string __full_conf = "" @@ -491,6 +491,17 @@ std::string __full_conf = ""
491 " queue_length 10; \n" 491 " queue_length 10; \n"
492 "} \n" 492 "} \n"
493 " \n" 493 " \n"
  494 + "# the vhost for srs debug info, whether send args in connect(tcUrl). \n"
  495 + "vhost debug.srs.com { \n"
  496 + " # when upnode(forward to, edge push to, edge pull from) is srs, \n"
  497 + " # it's strongly recommend to open the debug_srs_upnode, \n"
  498 + " # when connect to upnode, it will take the debug info, \n"
  499 + " # for example, the id, source id, pid. \n"
  500 + " # please see: https://github.com/winlinvip/simple-rtmp-server/wiki/SrsLog \n"
  501 + " # default: on \n"
  502 + " debug_srs_upnode on; \n"
  503 + "} \n"
  504 + " \n"
494 "# the vhost for antisuck. \n" 505 "# the vhost for antisuck. \n"
495 "vhost refer.anti_suck.com { \n" 506 "vhost refer.anti_suck.com { \n"
496 " # the common refer for play and publish. \n" 507 " # the common refer for play and publish. \n"
@@ -1864,6 +1875,7 @@ VOID TEST(ConfigMainTest, ParseFullConf) @@ -1864,6 +1875,7 @@ VOID TEST(ConfigMainTest, ParseFullConf)
1864 EXPECT_TRUE(conf.get_vhost_enabled(vhost)); 1875 EXPECT_TRUE(conf.get_vhost_enabled(vhost));
1865 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); 1876 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost)));
1866 EXPECT_TRUE(conf.get_gop_cache(vhost)); 1877 EXPECT_TRUE(conf.get_gop_cache(vhost));
  1878 + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost));
1867 EXPECT_FALSE(conf.get_atc(vhost)); 1879 EXPECT_FALSE(conf.get_atc(vhost));
1868 EXPECT_TRUE(conf.get_atc_auto(vhost)); 1880 EXPECT_TRUE(conf.get_atc_auto(vhost));
1869 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); 1881 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL);
@@ -1944,6 +1956,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_same_edge) @@ -1944,6 +1956,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_same_edge)
1944 EXPECT_TRUE(conf.get_vhost_enabled(vhost)); 1956 EXPECT_TRUE(conf.get_vhost_enabled(vhost));
1945 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); 1957 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost)));
1946 EXPECT_TRUE(conf.get_gop_cache(vhost)); 1958 EXPECT_TRUE(conf.get_gop_cache(vhost));
  1959 + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost));
1947 EXPECT_FALSE(conf.get_atc(vhost)); 1960 EXPECT_FALSE(conf.get_atc(vhost));
1948 EXPECT_TRUE(conf.get_atc_auto(vhost)); 1961 EXPECT_TRUE(conf.get_atc_auto(vhost));
1949 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); 1962 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL);
@@ -2023,6 +2036,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_change_edge) @@ -2023,6 +2036,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_change_edge)
2023 /*EXPECT_TRUE(conf.get_vhost_enabled(vhost)); 2036 /*EXPECT_TRUE(conf.get_vhost_enabled(vhost));
2024 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); 2037 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost)));
2025 EXPECT_TRUE(conf.get_gop_cache(vhost)); 2038 EXPECT_TRUE(conf.get_gop_cache(vhost));
  2039 + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost));
2026 EXPECT_FALSE(conf.get_atc(vhost)); 2040 EXPECT_FALSE(conf.get_atc(vhost));
2027 EXPECT_TRUE(conf.get_atc_auto(vhost)); 2041 EXPECT_TRUE(conf.get_atc_auto(vhost));
2028 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); 2042 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL);
@@ -2096,6 +2110,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_dvr) @@ -2096,6 +2110,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_dvr)
2096 EXPECT_TRUE(conf.get_vhost_enabled(vhost)); 2110 EXPECT_TRUE(conf.get_vhost_enabled(vhost));
2097 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); 2111 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost)));
2098 EXPECT_TRUE(conf.get_gop_cache(vhost)); 2112 EXPECT_TRUE(conf.get_gop_cache(vhost));
  2113 + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost));
2099 EXPECT_FALSE(conf.get_atc(vhost)); 2114 EXPECT_FALSE(conf.get_atc(vhost));
2100 EXPECT_TRUE(conf.get_atc_auto(vhost)); 2115 EXPECT_TRUE(conf.get_atc_auto(vhost));
2101 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); 2116 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL);
@@ -2169,6 +2184,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_ingest) @@ -2169,6 +2184,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_ingest)
2169 EXPECT_TRUE(conf.get_vhost_enabled(vhost)); 2184 EXPECT_TRUE(conf.get_vhost_enabled(vhost));
2170 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); 2185 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost)));
2171 EXPECT_TRUE(conf.get_gop_cache(vhost)); 2186 EXPECT_TRUE(conf.get_gop_cache(vhost));
  2187 + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost));
2172 EXPECT_FALSE(conf.get_atc(vhost)); 2188 EXPECT_FALSE(conf.get_atc(vhost));
2173 EXPECT_TRUE(conf.get_atc_auto(vhost)); 2189 EXPECT_TRUE(conf.get_atc_auto(vhost));
2174 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); 2190 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL);
@@ -2263,6 +2279,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_http) @@ -2263,6 +2279,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_http)
2263 EXPECT_TRUE(conf.get_vhost_enabled(vhost)); 2279 EXPECT_TRUE(conf.get_vhost_enabled(vhost));
2264 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); 2280 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost)));
2265 EXPECT_TRUE(conf.get_gop_cache(vhost)); 2281 EXPECT_TRUE(conf.get_gop_cache(vhost));
  2282 + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost));
2266 EXPECT_FALSE(conf.get_atc(vhost)); 2283 EXPECT_FALSE(conf.get_atc(vhost));
2267 EXPECT_TRUE(conf.get_atc_auto(vhost)); 2284 EXPECT_TRUE(conf.get_atc_auto(vhost));
2268 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); 2285 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL);
@@ -2339,6 +2356,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_hls_enabled) @@ -2339,6 +2356,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_hls_enabled)
2339 EXPECT_TRUE(conf.get_vhost_enabled(vhost)); 2356 EXPECT_TRUE(conf.get_vhost_enabled(vhost));
2340 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); 2357 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost)));
2341 EXPECT_TRUE(conf.get_gop_cache(vhost)); 2358 EXPECT_TRUE(conf.get_gop_cache(vhost));
  2359 + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost));
2342 EXPECT_FALSE(conf.get_atc(vhost)); 2360 EXPECT_FALSE(conf.get_atc(vhost));
2343 EXPECT_TRUE(conf.get_atc_auto(vhost)); 2361 EXPECT_TRUE(conf.get_atc_auto(vhost));
2344 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); 2362 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL);
@@ -2415,6 +2433,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_hls_disabled) @@ -2415,6 +2433,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_hls_disabled)
2415 EXPECT_TRUE(conf.get_vhost_enabled(vhost)); 2433 EXPECT_TRUE(conf.get_vhost_enabled(vhost));
2416 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); 2434 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost)));
2417 EXPECT_TRUE(conf.get_gop_cache(vhost)); 2435 EXPECT_TRUE(conf.get_gop_cache(vhost));
  2436 + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost));
2418 EXPECT_FALSE(conf.get_atc(vhost)); 2437 EXPECT_FALSE(conf.get_atc(vhost));
2419 EXPECT_TRUE(conf.get_atc_auto(vhost)); 2438 EXPECT_TRUE(conf.get_atc_auto(vhost));
2420 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); 2439 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL);
@@ -2491,6 +2510,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_http_hooks) @@ -2491,6 +2510,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_http_hooks)
2491 EXPECT_TRUE(conf.get_vhost_enabled(vhost)); 2510 EXPECT_TRUE(conf.get_vhost_enabled(vhost));
2492 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); 2511 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost)));
2493 EXPECT_TRUE(conf.get_gop_cache(vhost)); 2512 EXPECT_TRUE(conf.get_gop_cache(vhost));
  2513 + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost));
2494 EXPECT_FALSE(conf.get_atc(vhost)); 2514 EXPECT_FALSE(conf.get_atc(vhost));
2495 EXPECT_TRUE(conf.get_atc_auto(vhost)); 2515 EXPECT_TRUE(conf.get_atc_auto(vhost));
2496 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); 2516 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL);
@@ -2598,6 +2618,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_min_delay) @@ -2598,6 +2618,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_min_delay)
2598 EXPECT_TRUE(conf.get_vhost_enabled(vhost)); 2618 EXPECT_TRUE(conf.get_vhost_enabled(vhost));
2599 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); 2619 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost)));
2600 EXPECT_FALSE(conf.get_gop_cache(vhost)); 2620 EXPECT_FALSE(conf.get_gop_cache(vhost));
  2621 + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost));
2601 EXPECT_FALSE(conf.get_atc(vhost)); 2622 EXPECT_FALSE(conf.get_atc(vhost));
2602 EXPECT_TRUE(conf.get_atc_auto(vhost)); 2623 EXPECT_TRUE(conf.get_atc_auto(vhost));
2603 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); 2624 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL);
@@ -2675,6 +2696,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_refer_anti_suck) @@ -2675,6 +2696,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_refer_anti_suck)
2675 EXPECT_TRUE(conf.get_vhost_enabled(vhost)); 2696 EXPECT_TRUE(conf.get_vhost_enabled(vhost));
2676 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); 2697 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost)));
2677 EXPECT_TRUE(conf.get_gop_cache(vhost)); 2698 EXPECT_TRUE(conf.get_gop_cache(vhost));
  2699 + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost));
2678 EXPECT_FALSE(conf.get_atc(vhost)); 2700 EXPECT_FALSE(conf.get_atc(vhost));
2679 EXPECT_TRUE(conf.get_atc_auto(vhost)); 2701 EXPECT_TRUE(conf.get_atc_auto(vhost));
2680 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); 2702 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL);
@@ -2767,6 +2789,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_forward_same_vhost) @@ -2767,6 +2789,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_forward_same_vhost)
2767 EXPECT_TRUE(conf.get_vhost_enabled(vhost)); 2789 EXPECT_TRUE(conf.get_vhost_enabled(vhost));
2768 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); 2790 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost)));
2769 EXPECT_TRUE(conf.get_gop_cache(vhost)); 2791 EXPECT_TRUE(conf.get_gop_cache(vhost));
  2792 + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost));
2770 EXPECT_FALSE(conf.get_atc(vhost)); 2793 EXPECT_FALSE(conf.get_atc(vhost));
2771 EXPECT_TRUE(conf.get_atc_auto(vhost)); 2794 EXPECT_TRUE(conf.get_atc_auto(vhost));
2772 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); 2795 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL);
@@ -2850,6 +2873,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_forward_change_vhost) @@ -2850,6 +2873,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_forward_change_vhost)
2850 /*EXPECT_TRUE(conf.get_vhost_enabled(vhost)); 2873 /*EXPECT_TRUE(conf.get_vhost_enabled(vhost));
2851 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); 2874 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost)));
2852 EXPECT_TRUE(conf.get_gop_cache(vhost)); 2875 EXPECT_TRUE(conf.get_gop_cache(vhost));
  2876 + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost));
2853 EXPECT_FALSE(conf.get_atc(vhost)); 2877 EXPECT_FALSE(conf.get_atc(vhost));
2854 EXPECT_TRUE(conf.get_atc_auto(vhost)); 2878 EXPECT_TRUE(conf.get_atc_auto(vhost));
2855 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); 2879 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL);
@@ -2927,6 +2951,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_mirror) @@ -2927,6 +2951,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_mirror)
2927 EXPECT_TRUE(conf.get_vhost_enabled(vhost)); 2951 EXPECT_TRUE(conf.get_vhost_enabled(vhost));
2928 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); 2952 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost)));
2929 EXPECT_TRUE(conf.get_gop_cache(vhost)); 2953 EXPECT_TRUE(conf.get_gop_cache(vhost));
  2954 + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost));
2930 EXPECT_FALSE(conf.get_atc(vhost)); 2955 EXPECT_FALSE(conf.get_atc(vhost));
2931 EXPECT_TRUE(conf.get_atc_auto(vhost)); 2956 EXPECT_TRUE(conf.get_atc_auto(vhost));
2932 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); 2957 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL);
@@ -3015,6 +3040,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_crop) @@ -3015,6 +3040,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_crop)
3015 EXPECT_TRUE(conf.get_vhost_enabled(vhost)); 3040 EXPECT_TRUE(conf.get_vhost_enabled(vhost));
3016 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); 3041 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost)));
3017 EXPECT_TRUE(conf.get_gop_cache(vhost)); 3042 EXPECT_TRUE(conf.get_gop_cache(vhost));
  3043 + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost));
3018 EXPECT_FALSE(conf.get_atc(vhost)); 3044 EXPECT_FALSE(conf.get_atc(vhost));
3019 EXPECT_TRUE(conf.get_atc_auto(vhost)); 3045 EXPECT_TRUE(conf.get_atc_auto(vhost));
3020 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); 3046 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL);
@@ -3103,6 +3129,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_logo) @@ -3103,6 +3129,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_logo)
3103 EXPECT_TRUE(conf.get_vhost_enabled(vhost)); 3129 EXPECT_TRUE(conf.get_vhost_enabled(vhost));
3104 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); 3130 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost)));
3105 EXPECT_TRUE(conf.get_gop_cache(vhost)); 3131 EXPECT_TRUE(conf.get_gop_cache(vhost));
  3132 + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost));
3106 EXPECT_FALSE(conf.get_atc(vhost)); 3133 EXPECT_FALSE(conf.get_atc(vhost));
3107 EXPECT_TRUE(conf.get_atc_auto(vhost)); 3134 EXPECT_TRUE(conf.get_atc_auto(vhost));
3108 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); 3135 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL);
@@ -3191,6 +3218,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_audio) @@ -3191,6 +3218,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_audio)
3191 EXPECT_TRUE(conf.get_vhost_enabled(vhost)); 3218 EXPECT_TRUE(conf.get_vhost_enabled(vhost));
3192 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); 3219 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost)));
3193 EXPECT_TRUE(conf.get_gop_cache(vhost)); 3220 EXPECT_TRUE(conf.get_gop_cache(vhost));
  3221 + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost));
3194 EXPECT_FALSE(conf.get_atc(vhost)); 3222 EXPECT_FALSE(conf.get_atc(vhost));
3195 EXPECT_TRUE(conf.get_atc_auto(vhost)); 3223 EXPECT_TRUE(conf.get_atc_auto(vhost));
3196 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); 3224 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL);
@@ -3273,6 +3301,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_vn) @@ -3273,6 +3301,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_vn)
3273 EXPECT_TRUE(conf.get_vhost_enabled(vhost)); 3301 EXPECT_TRUE(conf.get_vhost_enabled(vhost));
3274 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); 3302 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost)));
3275 EXPECT_TRUE(conf.get_gop_cache(vhost)); 3303 EXPECT_TRUE(conf.get_gop_cache(vhost));
  3304 + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost));
3276 EXPECT_FALSE(conf.get_atc(vhost)); 3305 EXPECT_FALSE(conf.get_atc(vhost));
3277 EXPECT_TRUE(conf.get_atc_auto(vhost)); 3306 EXPECT_TRUE(conf.get_atc_auto(vhost));
3278 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); 3307 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL);
@@ -3355,6 +3384,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_copy) @@ -3355,6 +3384,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_copy)
3355 EXPECT_TRUE(conf.get_vhost_enabled(vhost)); 3384 EXPECT_TRUE(conf.get_vhost_enabled(vhost));
3356 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); 3385 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost)));
3357 EXPECT_TRUE(conf.get_gop_cache(vhost)); 3386 EXPECT_TRUE(conf.get_gop_cache(vhost));
  3387 + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost));
3358 EXPECT_FALSE(conf.get_atc(vhost)); 3388 EXPECT_FALSE(conf.get_atc(vhost));
3359 EXPECT_TRUE(conf.get_atc_auto(vhost)); 3389 EXPECT_TRUE(conf.get_atc_auto(vhost));
3360 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); 3390 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL);
@@ -3433,6 +3463,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_all) @@ -3433,6 +3463,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_all)
3433 EXPECT_TRUE(conf.get_vhost_enabled(vhost)); 3463 EXPECT_TRUE(conf.get_vhost_enabled(vhost));
3434 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); 3464 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost)));
3435 EXPECT_TRUE(conf.get_gop_cache(vhost)); 3465 EXPECT_TRUE(conf.get_gop_cache(vhost));
  3466 + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost));
3436 EXPECT_FALSE(conf.get_atc(vhost)); 3467 EXPECT_FALSE(conf.get_atc(vhost));
3437 EXPECT_TRUE(conf.get_atc_auto(vhost)); 3468 EXPECT_TRUE(conf.get_atc_auto(vhost));
3438 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); 3469 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL);
@@ -3649,6 +3680,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_ffempty) @@ -3649,6 +3680,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_ffempty)
3649 EXPECT_TRUE(conf.get_vhost_enabled(vhost)); 3680 EXPECT_TRUE(conf.get_vhost_enabled(vhost));
3650 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); 3681 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost)));
3651 EXPECT_TRUE(conf.get_gop_cache(vhost)); 3682 EXPECT_TRUE(conf.get_gop_cache(vhost));
  3683 + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost));
3652 EXPECT_FALSE(conf.get_atc(vhost)); 3684 EXPECT_FALSE(conf.get_atc(vhost));
3653 EXPECT_TRUE(conf.get_atc_auto(vhost)); 3685 EXPECT_TRUE(conf.get_atc_auto(vhost));
3654 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); 3686 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL);
@@ -3737,6 +3769,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_app) @@ -3737,6 +3769,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_app)
3737 EXPECT_TRUE(conf.get_vhost_enabled(vhost)); 3769 EXPECT_TRUE(conf.get_vhost_enabled(vhost));
3738 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); 3770 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost)));
3739 EXPECT_TRUE(conf.get_gop_cache(vhost)); 3771 EXPECT_TRUE(conf.get_gop_cache(vhost));
  3772 + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost));
3740 EXPECT_FALSE(conf.get_atc(vhost)); 3773 EXPECT_FALSE(conf.get_atc(vhost));
3741 EXPECT_TRUE(conf.get_atc_auto(vhost)); 3774 EXPECT_TRUE(conf.get_atc_auto(vhost));
3742 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); 3775 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL);
@@ -3825,6 +3858,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_stream) @@ -3825,6 +3858,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_stream)
3825 EXPECT_TRUE(conf.get_vhost_enabled(vhost)); 3858 EXPECT_TRUE(conf.get_vhost_enabled(vhost));
3826 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); 3859 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost)));
3827 EXPECT_TRUE(conf.get_gop_cache(vhost)); 3860 EXPECT_TRUE(conf.get_gop_cache(vhost));
  3861 + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost));
3828 EXPECT_FALSE(conf.get_atc(vhost)); 3862 EXPECT_FALSE(conf.get_atc(vhost));
3829 EXPECT_TRUE(conf.get_atc_auto(vhost)); 3863 EXPECT_TRUE(conf.get_atc_auto(vhost));
3830 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); 3864 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL);
@@ -3913,6 +3947,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_bandcheck) @@ -3913,6 +3947,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_bandcheck)
3913 EXPECT_TRUE(conf.get_vhost_enabled(vhost)); 3947 EXPECT_TRUE(conf.get_vhost_enabled(vhost));
3914 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); 3948 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost)));
3915 EXPECT_TRUE(conf.get_gop_cache(vhost)); 3949 EXPECT_TRUE(conf.get_gop_cache(vhost));
  3950 + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost));
3916 EXPECT_FALSE(conf.get_atc(vhost)); 3951 EXPECT_FALSE(conf.get_atc(vhost));
3917 EXPECT_TRUE(conf.get_atc_auto(vhost)); 3952 EXPECT_TRUE(conf.get_atc_auto(vhost));
3918 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); 3953 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL);
@@ -3990,6 +4025,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_chunksize) @@ -3990,6 +4025,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_chunksize)
3990 EXPECT_TRUE(conf.get_vhost_enabled(vhost)); 4025 EXPECT_TRUE(conf.get_vhost_enabled(vhost));
3991 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); 4026 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost)));
3992 EXPECT_TRUE(conf.get_gop_cache(vhost)); 4027 EXPECT_TRUE(conf.get_gop_cache(vhost));
  4028 + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost));
3993 EXPECT_FALSE(conf.get_atc(vhost)); 4029 EXPECT_FALSE(conf.get_atc(vhost));
3994 EXPECT_TRUE(conf.get_atc_auto(vhost)); 4030 EXPECT_TRUE(conf.get_atc_auto(vhost));
3995 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); 4031 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL);
@@ -4067,6 +4103,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_jitter) @@ -4067,6 +4103,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_jitter)
4067 EXPECT_TRUE(conf.get_vhost_enabled(vhost)); 4103 EXPECT_TRUE(conf.get_vhost_enabled(vhost));
4068 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); 4104 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost)));
4069 EXPECT_TRUE(conf.get_gop_cache(vhost)); 4105 EXPECT_TRUE(conf.get_gop_cache(vhost));
  4106 + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost));
4070 EXPECT_FALSE(conf.get_atc(vhost)); 4107 EXPECT_FALSE(conf.get_atc(vhost));
4071 EXPECT_TRUE(conf.get_atc_auto(vhost)); 4108 EXPECT_TRUE(conf.get_atc_auto(vhost));
4072 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); 4109 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL);
@@ -4144,6 +4181,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_atc) @@ -4144,6 +4181,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_atc)
4144 EXPECT_TRUE(conf.get_vhost_enabled(vhost)); 4181 EXPECT_TRUE(conf.get_vhost_enabled(vhost));
4145 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost))); 4182 EXPECT_TRUE(conf.get_vhost_enabled(conf.get_vhost(vhost)));
4146 EXPECT_TRUE(conf.get_gop_cache(vhost)); 4183 EXPECT_TRUE(conf.get_gop_cache(vhost));
  4184 + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost));
4147 EXPECT_TRUE(conf.get_atc(vhost)); 4185 EXPECT_TRUE(conf.get_atc(vhost));
4148 EXPECT_TRUE(conf.get_atc_auto(vhost)); 4186 EXPECT_TRUE(conf.get_atc_auto(vhost));
4149 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); 4187 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL);
@@ -4221,6 +4259,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_removed) @@ -4221,6 +4259,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_removed)
4221 EXPECT_FALSE(conf.get_vhost_enabled(vhost)); 4259 EXPECT_FALSE(conf.get_vhost_enabled(vhost));
4222 EXPECT_FALSE(conf.get_vhost_enabled(conf.get_vhost(vhost))); 4260 EXPECT_FALSE(conf.get_vhost_enabled(conf.get_vhost(vhost)));
4223 EXPECT_TRUE(conf.get_gop_cache(vhost)); 4261 EXPECT_TRUE(conf.get_gop_cache(vhost));
  4262 + EXPECT_TRUE(conf.get_debug_srs_upnode(vhost));
4224 EXPECT_FALSE(conf.get_atc(vhost)); 4263 EXPECT_FALSE(conf.get_atc(vhost));
4225 EXPECT_TRUE(conf.get_atc_auto(vhost)); 4264 EXPECT_TRUE(conf.get_atc_auto(vhost));
4226 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL); 4265 EXPECT_TRUE(conf.get_time_jitter(vhost) == SrsRtmpJitterAlgorithmFULL);
@@ -4973,6 +5012,19 @@ VOID TEST(ConfigMainTest, CheckConf_gop_cache) @@ -4973,6 +5012,19 @@ VOID TEST(ConfigMainTest, CheckConf_gop_cache)
4973 } 5012 }
4974 } 5013 }
4975 5014
  5015 +VOID TEST(ConfigMainTest, CheckConf_debug_srs_upnode)
  5016 +{
  5017 + if (true) {
  5018 + MockSrsConfig conf;
  5019 + EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost v{debug_srs_upnode off;}"));
  5020 + }
  5021 +
  5022 + if (true) {
  5023 + MockSrsConfig conf;
  5024 + EXPECT_TRUE(ERROR_SUCCESS != conf.parse(_MIN_OK_CONF"vhost v{debug_srs_upnodes off;}"));
  5025 + }
  5026 +}
  5027 +
4976 VOID TEST(ConfigMainTest, CheckConf_refer) 5028 VOID TEST(ConfigMainTest, CheckConf_refer)
4977 { 5029 {
4978 if (true) { 5030 if (true) {