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:
* 2013-10-17, Created.<br/>
## 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.
... ...
... ... @@ -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.
... ...
... ... @@ -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);
... ...
... ... @@ -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.
... ...
... ... @@ -28,6 +28,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <netinet/in.h>
#include <arpa/inet.h>
using namespace std;
#include <srs_kernel_error.hpp>
#include <srs_protocol_rtmp.hpp>
#include <srs_kernel_log.hpp>
... ... @@ -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<std::string> 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;
... ...
... ... @@ -33,6 +33,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_app_st.hpp>
#include <srs_app_thread.hpp>
#include <string>
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);
};
/**
... ...
... ... @@ -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;
}
... ...
... ... @@ -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();
};
... ...
... ... @@ -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"
... ...
... ... @@ -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;
}
... ...
... ... @@ -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();
}
... ...
... ... @@ -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
);
... ...
... ... @@ -1496,6 +1496,17 @@ int SrsProtocol::on_recv_message(SrsMessage* msg)
case RTMP_MSG_SetChunkSize: {
SrsSetChunkSizePacket* pkt = dynamic_cast<SrsSetChunkSizePacket*>(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;
}
... ...
... ... @@ -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) {
... ...