mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
add consts to kernel
This commit is contained in:
parent
24a041266c
commit
073d900674
13 changed files with 337 additions and 29 deletions
5
trunk/configure
vendored
5
trunk/configure
vendored
|
@ -422,7 +422,8 @@ MODULE_ID="KERNEL"
|
||||||
MODULE_DEPENDS=("CORE")
|
MODULE_DEPENDS=("CORE")
|
||||||
ModuleLibIncs=(${SRS_OBJS})
|
ModuleLibIncs=(${SRS_OBJS})
|
||||||
MODULE_FILES=("srs_kernel_error" "srs_kernel_log" "srs_kernel_stream" "srs_kernel_buffer"
|
MODULE_FILES=("srs_kernel_error" "srs_kernel_log" "srs_kernel_stream" "srs_kernel_buffer"
|
||||||
"srs_kernel_utility" "srs_kernel_flv" "srs_kernel_codec" "srs_kernel_file")
|
"srs_kernel_utility" "srs_kernel_flv" "srs_kernel_codec" "srs_kernel_file"
|
||||||
|
"srs_kernel_consts")
|
||||||
KERNEL_INCS="src/kernel"; MODULE_DIR=${KERNEL_INCS} . auto/modules.sh
|
KERNEL_INCS="src/kernel"; MODULE_DIR=${KERNEL_INCS} . auto/modules.sh
|
||||||
KERNEL_OBJS="${MODULE_OBJS[@]}"
|
KERNEL_OBJS="${MODULE_OBJS[@]}"
|
||||||
#
|
#
|
||||||
|
@ -488,7 +489,7 @@ fi
|
||||||
#
|
#
|
||||||
# utest, the unit-test cases of srs, base on gtest1.6
|
# utest, the unit-test cases of srs, base on gtest1.6
|
||||||
MODULE_FILES=("srs_utest" "srs_utest_amf0" "srs_utest_protocol"
|
MODULE_FILES=("srs_utest" "srs_utest_amf0" "srs_utest_protocol"
|
||||||
"srs_utest_kernel" "srs_utest_core")
|
"srs_utest_kernel" "srs_utest_core" "srs_utest_config")
|
||||||
ModuleLibIncs=(${SRS_OBJS} ${LibSTRoot})
|
ModuleLibIncs=(${SRS_OBJS} ${LibSTRoot})
|
||||||
ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile} ${LibSSLfile})
|
ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile} ${LibSSLfile})
|
||||||
MODULE_DEPENDS=("CORE" "KERNEL" "RTMP" "APP")
|
MODULE_DEPENDS=("CORE" "KERNEL" "RTMP" "APP")
|
||||||
|
|
|
@ -1143,8 +1143,8 @@ void SrsConfig::print_help(char** argv)
|
||||||
"\n"
|
"\n"
|
||||||
"For example:\n"
|
"For example:\n"
|
||||||
" %s -v\n"
|
" %s -v\n"
|
||||||
" %s -t -c "SRS_DEFAULT_CONF"\n"
|
" %s -t -c "SRS_CONF_DEFAULT_COFNIG_FILE"\n"
|
||||||
" %s -c "SRS_DEFAULT_CONF"\n",
|
" %s -c "SRS_CONF_DEFAULT_COFNIG_FILE"\n",
|
||||||
argv[0], argv[0], argv[0], argv[0]);
|
argv[0], argv[0], argv[0], argv[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1968,12 +1968,12 @@ bool SrsConfig::get_engine_enabled(SrsConfDirective* engine)
|
||||||
string SrsConfig::get_engine_iformat(SrsConfDirective* engine)
|
string SrsConfig::get_engine_iformat(SrsConfDirective* engine)
|
||||||
{
|
{
|
||||||
if (!engine) {
|
if (!engine) {
|
||||||
return "flv";
|
return SRS_CONF_DEFAULT_TRANSCODE_IFORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
SrsConfDirective* conf = engine->get("iformat");
|
SrsConfDirective* conf = engine->get("iformat");
|
||||||
if (!conf) {
|
if (!conf) {
|
||||||
return "flv";
|
return SRS_CONF_DEFAULT_TRANSCODE_IFORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
return conf->arg0();
|
return conf->arg0();
|
||||||
|
@ -2228,12 +2228,12 @@ vector<string> SrsConfig::get_engine_aparams(SrsConfDirective* engine)
|
||||||
string SrsConfig::get_engine_oformat(SrsConfDirective* engine)
|
string SrsConfig::get_engine_oformat(SrsConfDirective* engine)
|
||||||
{
|
{
|
||||||
if (!engine) {
|
if (!engine) {
|
||||||
return "flv";
|
return SRS_CONF_DEFAULT_TRANSCODE_OFORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
SrsConfDirective* conf = engine->get("oformat");
|
SrsConfDirective* conf = engine->get("oformat");
|
||||||
if (!conf) {
|
if (!conf) {
|
||||||
return "flv";
|
return SRS_CONF_DEFAULT_TRANSCODE_OFORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
return conf->arg0();
|
return conf->arg0();
|
||||||
|
@ -2346,7 +2346,7 @@ string SrsConfig::get_log_file()
|
||||||
|
|
||||||
SrsConfDirective* conf = root->get("srs_log_file");
|
SrsConfDirective* conf = root->get("srs_log_file");
|
||||||
if (!conf || conf->arg0().empty()) {
|
if (!conf || conf->arg0().empty()) {
|
||||||
return "./objs/srs.log";
|
return SRS_CONF_DEFAULT_LOG_FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return conf->arg0();
|
return conf->arg0();
|
||||||
|
@ -2355,7 +2355,7 @@ string SrsConfig::get_log_file()
|
||||||
bool SrsConfig::get_ffmpeg_log_enabled()
|
bool SrsConfig::get_ffmpeg_log_enabled()
|
||||||
{
|
{
|
||||||
string log = get_ffmpeg_log_dir();
|
string log = get_ffmpeg_log_dir();
|
||||||
return log != "/dev/null";
|
return log != SRS_CONSTS_NULL_FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
string SrsConfig::get_ffmpeg_log_dir()
|
string SrsConfig::get_ffmpeg_log_dir()
|
||||||
|
@ -2364,7 +2364,7 @@ string SrsConfig::get_ffmpeg_log_dir()
|
||||||
|
|
||||||
SrsConfDirective* conf = root->get("ff_log_dir");
|
SrsConfDirective* conf = root->get("ff_log_dir");
|
||||||
if (!conf || conf->arg0().empty()) {
|
if (!conf || conf->arg0().empty()) {
|
||||||
return "./objs";
|
return SRS_CONF_DEFAULT_FF_LOG_DIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
return conf->arg0();
|
return conf->arg0();
|
||||||
|
@ -2376,7 +2376,7 @@ string SrsConfig::get_log_level()
|
||||||
|
|
||||||
SrsConfDirective* conf = root->get("srs_log_level");
|
SrsConfDirective* conf = root->get("srs_log_level");
|
||||||
if (!conf || conf->arg0().empty()) {
|
if (!conf || conf->arg0().empty()) {
|
||||||
return "trace";
|
return SRS_CONF_DEFAULT_LOG_LEVEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return conf->arg0();
|
return conf->arg0();
|
||||||
|
@ -2387,7 +2387,7 @@ bool SrsConfig::get_log_tank_file()
|
||||||
srs_assert(root);
|
srs_assert(root);
|
||||||
|
|
||||||
SrsConfDirective* conf = root->get("srs_log_tank");
|
SrsConfDirective* conf = root->get("srs_log_tank");
|
||||||
if (conf && conf->arg0() == "console") {
|
if (conf && conf->arg0() == SRS_CONF_DEFAULT_LOG_TANK_CONSOLE) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,9 +34,21 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
#include <srs_app_reload.hpp>
|
#include <srs_app_reload.hpp>
|
||||||
|
|
||||||
#define SRS_LOCALHOST "127.0.0.1"
|
///////////////////////////////////////////////////////////
|
||||||
|
// the value consts
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
#define SRS_CONSTS_NULL_FILE "/dev/null"
|
||||||
|
#define SRS_CONSTS_LOCALHOST "127.0.0.1"
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// default consts values
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
#define SRS_CONF_DEFAULT_PID_FILE "./objs/srs.pid"
|
#define SRS_CONF_DEFAULT_PID_FILE "./objs/srs.pid"
|
||||||
#define SRS_DEFAULT_CONF "conf/srs.conf"
|
#define SRS_CONF_DEFAULT_LOG_FILE "./objs/srs.log"
|
||||||
|
#define SRS_CONF_DEFAULT_LOG_LEVEL "trace"
|
||||||
|
#define SRS_CONF_DEFAULT_LOG_TANK_CONSOLE "console"
|
||||||
|
#define SRS_CONF_DEFAULT_COFNIG_FILE "conf/srs.conf"
|
||||||
|
#define SRS_CONF_DEFAULT_FF_LOG_DIR "./objs"
|
||||||
|
|
||||||
#define SRS_CONF_DEFAULT_MAX_CONNECTIONS 12345
|
#define SRS_CONF_DEFAULT_MAX_CONNECTIONS 12345
|
||||||
#define SRS_CONF_DEFAULT_HLS_PATH "./objs/nginx/html"
|
#define SRS_CONF_DEFAULT_HLS_PATH "./objs/nginx/html"
|
||||||
|
@ -67,7 +79,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
#define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_ENABLED false
|
#define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_ENABLED false
|
||||||
#define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_INTERVAL 9.9
|
#define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_INTERVAL 9.9
|
||||||
#define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_URL "http://127.0.0.1:8085/api/v1/servers"
|
#define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_URL "http://"SRS_CONSTS_LOCALHOST":8085/api/v1/servers"
|
||||||
#define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_INDEX 0
|
#define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_INDEX 0
|
||||||
#define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_SUMMARIES false
|
#define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_SUMMARIES false
|
||||||
|
|
||||||
|
@ -82,6 +94,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#define SRS_AUTO_INGEST_TYPE_FILE "file"
|
#define SRS_AUTO_INGEST_TYPE_FILE "file"
|
||||||
#define SRS_AUTO_INGEST_TYPE_STREAM "stream"
|
#define SRS_AUTO_INGEST_TYPE_STREAM "stream"
|
||||||
|
|
||||||
|
#define SRS_CONF_DEFAULT_TRANSCODE_IFORMAT "flv"
|
||||||
|
#define SRS_CONF_DEFAULT_TRANSCODE_OFORMAT "flv"
|
||||||
|
|
||||||
namespace _srs_internal
|
namespace _srs_internal
|
||||||
{
|
{
|
||||||
class SrsConfigBuffer;
|
class SrsConfigBuffer;
|
||||||
|
@ -687,7 +702,7 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual std::string get_engine_oformat(SrsConfDirective* engine);
|
virtual std::string get_engine_oformat(SrsConfDirective* engine);
|
||||||
/**
|
/**
|
||||||
* get the output of engine, for example, rtmp://127.0.0.1/live/livestream,
|
* get the output of engine, for example, rtmp://localhost/live/livestream,
|
||||||
* @remark, we will use some variable, for instance, [vhost] to substitude with vhost.
|
* @remark, we will use some variable, for instance, [vhost] to substitude with vhost.
|
||||||
*/
|
*/
|
||||||
virtual std::string get_engine_output(SrsConfDirective* engine);
|
virtual std::string get_engine_output(SrsConfDirective* engine);
|
||||||
|
|
|
@ -261,8 +261,10 @@ int SrsEncoder::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsRequest* req, SrsConfDir
|
||||||
|
|
||||||
std::string input;
|
std::string input;
|
||||||
// input stream, from local.
|
// input stream, from local.
|
||||||
// ie. rtmp://127.0.0.1:1935/live/livestream
|
// ie. rtmp://localhost:1935/live/livestream
|
||||||
input = "rtmp://127.0.0.1:";
|
input = "rtmp://";
|
||||||
|
input += SRS_CONSTS_LOCALHOST;
|
||||||
|
input += ":";
|
||||||
input += req->port;
|
input += req->port;
|
||||||
input += "/";
|
input += "/";
|
||||||
input += req->app;
|
input += req->app;
|
||||||
|
@ -280,14 +282,14 @@ int SrsEncoder::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsRequest* req, SrsConfDir
|
||||||
|
|
||||||
std::string output = _srs_config->get_engine_output(engine);
|
std::string output = _srs_config->get_engine_output(engine);
|
||||||
// output stream, to other/self server
|
// output stream, to other/self server
|
||||||
// ie. rtmp://127.0.0.1:1935/live/livestream_sd
|
// ie. rtmp://localhost:1935/live/livestream_sd
|
||||||
output = srs_string_replace(output, "[vhost]", req->vhost);
|
output = srs_string_replace(output, "[vhost]", req->vhost);
|
||||||
output = srs_string_replace(output, "[port]", req->port);
|
output = srs_string_replace(output, "[port]", req->port);
|
||||||
output = srs_string_replace(output, "[app]", req->app);
|
output = srs_string_replace(output, "[app]", req->app);
|
||||||
output = srs_string_replace(output, "[stream]", req->stream);
|
output = srs_string_replace(output, "[stream]", req->stream);
|
||||||
output = srs_string_replace(output, "[engine]", engine->arg0());
|
output = srs_string_replace(output, "[engine]", engine->arg0());
|
||||||
|
|
||||||
std::string log_file = "/dev/null"; // disabled
|
std::string log_file = SRS_CONSTS_NULL_FILE; // disabled
|
||||||
// write ffmpeg info to log file.
|
// write ffmpeg info to log file.
|
||||||
if (_srs_config->get_ffmpeg_log_enabled()) {
|
if (_srs_config->get_ffmpeg_log_enabled()) {
|
||||||
log_file = _srs_config->get_ffmpeg_log_dir();
|
log_file = _srs_config->get_ffmpeg_log_dir();
|
||||||
|
|
|
@ -111,7 +111,7 @@ int SrsForwarder::on_publish(SrsRequest* req, std::string forward_server)
|
||||||
source_ep += req->vhost;
|
source_ep += req->vhost;
|
||||||
|
|
||||||
std::string dest_ep = "rtmp://";
|
std::string dest_ep = "rtmp://";
|
||||||
if (forward_server == "127.0.0.1") {
|
if (forward_server == SRS_CONSTS_LOCALHOST) {
|
||||||
dest_ep += req->host;
|
dest_ep += req->host;
|
||||||
} else {
|
} else {
|
||||||
dest_ep += forward_server;
|
dest_ep += forward_server;
|
||||||
|
|
|
@ -235,7 +235,7 @@ int SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* vhost, S
|
||||||
|
|
||||||
std::string output = _srs_config->get_engine_output(engine);
|
std::string output = _srs_config->get_engine_output(engine);
|
||||||
// output stream, to other/self server
|
// output stream, to other/self server
|
||||||
// ie. rtmp://127.0.0.1:1935/live/livestream_sd
|
// ie. rtmp://localhost:1935/live/livestream_sd
|
||||||
output = srs_string_replace(output, "[vhost]", vhost->arg0());
|
output = srs_string_replace(output, "[vhost]", vhost->arg0());
|
||||||
output = srs_string_replace(output, "[port]", port);
|
output = srs_string_replace(output, "[port]", port);
|
||||||
if (output.empty()) {
|
if (output.empty()) {
|
||||||
|
@ -260,7 +260,7 @@ int SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* vhost, S
|
||||||
app = app.substr(0, pos);
|
app = app.substr(0, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string log_file = "/dev/null"; // disabled
|
std::string log_file = SRS_CONSTS_NULL_FILE; // disabled
|
||||||
// write ffmpeg info to log file.
|
// write ffmpeg info to log file.
|
||||||
if (_srs_config->get_ffmpeg_log_enabled()) {
|
if (_srs_config->get_ffmpeg_log_enabled()) {
|
||||||
log_file = _srs_config->get_ffmpeg_log_dir();
|
log_file = _srs_config->get_ffmpeg_log_dir();
|
||||||
|
|
|
@ -37,8 +37,6 @@ using namespace std;
|
||||||
#include <srs_app_kbps.hpp>
|
#include <srs_app_kbps.hpp>
|
||||||
#include <srs_app_json.hpp>
|
#include <srs_app_json.hpp>
|
||||||
|
|
||||||
#define SRS_LOCAL_LOOP_IP "127.0.0.1"
|
|
||||||
|
|
||||||
int srs_socket_connect(std::string server, int port, int64_t timeout, st_netfd_t* pstfd)
|
int srs_socket_connect(std::string server, int port, int64_t timeout, st_netfd_t* pstfd)
|
||||||
{
|
{
|
||||||
int ret = ERROR_SUCCESS;
|
int ret = ERROR_SUCCESS;
|
||||||
|
@ -707,7 +705,7 @@ void retrieve_local_ipv4_ips()
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ip = buf;
|
std::string ip = buf;
|
||||||
if (ip != SRS_LOCAL_LOOP_IP) {
|
if (ip != SRS_CONSTS_LOCALHOST) {
|
||||||
srs_trace("retrieve local ipv4 addresses: %s", ip.c_str());
|
srs_trace("retrieve local ipv4 addresses: %s", ip.c_str());
|
||||||
ips.push_back(ip);
|
ips.push_back(ip);
|
||||||
}
|
}
|
||||||
|
|
25
trunk/src/kernel/srs_kernel_consts.cpp
Normal file
25
trunk/src/kernel/srs_kernel_consts.cpp
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2013-2014 winlin
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <srs_kernel_consts.hpp>
|
||||||
|
|
33
trunk/src/kernel/srs_kernel_consts.hpp
Normal file
33
trunk/src/kernel/srs_kernel_consts.hpp
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2013-2014 winlin
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SRS_KERNEL_CONSTS_HPP
|
||||||
|
#define SRS_KERNEL_CONSTS_HPP
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <srs_kernel_consts.hpp>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <srs_core.hpp>
|
||||||
|
|
||||||
|
#endif
|
|
@ -48,14 +48,14 @@ typedef void* srs_rtmp_t;
|
||||||
/**
|
/**
|
||||||
* create/destroy a rtmp protocol stack.
|
* create/destroy a rtmp protocol stack.
|
||||||
* @url rtmp url, for example:
|
* @url rtmp url, for example:
|
||||||
* rtmp://127.0.0.1/live/livestream
|
* rtmp://localhost/live/livestream
|
||||||
* @return a rtmp handler, or NULL if error occured.
|
* @return a rtmp handler, or NULL if error occured.
|
||||||
*/
|
*/
|
||||||
srs_rtmp_t srs_rtmp_create(const char* url);
|
srs_rtmp_t srs_rtmp_create(const char* url);
|
||||||
/**
|
/**
|
||||||
* create rtmp with url, used for connection specified application.
|
* create rtmp with url, used for connection specified application.
|
||||||
* @param url the tcUrl, for exmple:
|
* @param url the tcUrl, for exmple:
|
||||||
* rtmp://127.0.0.1/live
|
* rtmp://localhost/live
|
||||||
* @remark this is used to create application connection-oriented,
|
* @remark this is used to create application connection-oriented,
|
||||||
* for example, the bandwidth client used this, no stream specified.
|
* for example, the bandwidth client used this, no stream specified.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -20,6 +20,8 @@ file
|
||||||
..\kernel\srs_kernel_buffer.cpp,
|
..\kernel\srs_kernel_buffer.cpp,
|
||||||
..\kernel\srs_kernel_codec.hpp,
|
..\kernel\srs_kernel_codec.hpp,
|
||||||
..\kernel\srs_kernel_codec.cpp,
|
..\kernel\srs_kernel_codec.cpp,
|
||||||
|
..\kernel\srs_kernel_consts.hpp,
|
||||||
|
..\kernel\srs_kernel_consts.cpp,
|
||||||
..\kernel\srs_kernel_error.hpp,
|
..\kernel\srs_kernel_error.hpp,
|
||||||
..\kernel\srs_kernel_error.cpp,
|
..\kernel\srs_kernel_error.cpp,
|
||||||
..\kernel\srs_kernel_file.hpp,
|
..\kernel\srs_kernel_file.hpp,
|
||||||
|
@ -115,6 +117,8 @@ file
|
||||||
..\utest\srs_utest.cpp,
|
..\utest\srs_utest.cpp,
|
||||||
..\utest\srs_utest_amf0.hpp,
|
..\utest\srs_utest_amf0.hpp,
|
||||||
..\utest\srs_utest_amf0.cpp,
|
..\utest\srs_utest_amf0.cpp,
|
||||||
|
..\utest\srs_utest_config.hpp,
|
||||||
|
..\utest\srs_utest_config.cpp,
|
||||||
..\utest\srs_utest_core.hpp,
|
..\utest\srs_utest_core.hpp,
|
||||||
..\utest\srs_utest_core.cpp,
|
..\utest\srs_utest_core.cpp,
|
||||||
..\utest\srs_utest_kernel.hpp,
|
..\utest\srs_utest_kernel.hpp,
|
||||||
|
|
196
trunk/src/utest/srs_utest_config.cpp
Normal file
196
trunk/src/utest/srs_utest_config.cpp
Normal file
|
@ -0,0 +1,196 @@
|
||||||
|
/*
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2013-2014 winlin
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
#include <srs_utest_config.hpp>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#include <srs_app_config.hpp>
|
||||||
|
|
||||||
|
VOID TEST(ConfigTest, CheckMacros)
|
||||||
|
{
|
||||||
|
#ifndef SRS_CONSTS_LOCALHOST
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_PID_FILE
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_COFNIG_FILE
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_MAX_CONNECTIONS
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_HLS_PATH
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_HLS_FRAGMENT
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_HLS_WINDOW
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_DVR_PATH
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_DVR_PLAN_SESSION
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_DVR_PLAN_SEGMENT
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_DVR_PLAN_HSS
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_DVR_PLAN
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_DVR_DURATION
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_TIME_JITTER
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_QUEUE_LENGTH
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_PAUSED_LENGTH
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_BANDWIDTH_INTERVAL
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_BANDWIDTH_LIMIT_KBPS
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_HTTP_MOUNT
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_HTTP_DIR
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_HTTP_STREAM_PORT
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_HTTP_API_PORT
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_HTTP_HEAETBEAT_ENABLED
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_HTTP_HEAETBEAT_INTERVAL
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_HTTP_HEAETBEAT_URL
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_HTTP_HEAETBEAT_INDEX
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_HTTP_HEAETBEAT_SUMMARIES
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_STAGE_PLAY_USER_INTERVAL_MS
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_STAGE_PUBLISH_USER_INTERVAL_MS
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_STAGE_FORWARDER_INTERVAL_MS
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_STAGE_ENCODER_INTERVAL_MS
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_STAGE_INGESTER_INTERVAL_MS
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_STAGE_HLS_INTERVAL_MS
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_STAGE_EDGE_INTERVAL_MS
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_AUTO_INGEST_TYPE_FILE
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_AUTO_INGEST_TYPE_STREAM
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_TRANSCODE_IFORMAT
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_TRANSCODE_OFORMAT
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_LOG_FILE
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONSTS_NULL_FILE
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_FF_LOG_DIR
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_LOG_LEVEL
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef SRS_CONF_DEFAULT_LOG_TANK_CONSOLE
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef xxxxxxxxxxxxxxxxxxxxxxxx
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef xxxxxxxxxxxxxxxxxxxxxxxx
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef xxxxxxxxxxxxxxxxxxxxxxxx
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef xxxxxxxxxxxxxxxxxxxxxxxx
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef xxxxxxxxxxxxxxxxxxxxxxxx
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef xxxxxxxxxxxxxxxxxxxxxxxx
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef xxxxxxxxxxxxxxxxxxxxxxxx
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef xxxxxxxxxxxxxxxxxxxxxxxx
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef xxxxxxxxxxxxxxxxxxxxxxxx
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef xxxxxxxxxxxxxxxxxxxxxxxx
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef xxxxxxxxxxxxxxxxxxxxxxxx
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
#ifndef xxxxxxxxxxxxxxxxxxxxxxxx
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
#endif
|
||||||
|
}
|
34
trunk/src/utest/srs_utest_config.hpp
Normal file
34
trunk/src/utest/srs_utest_config.hpp
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2013-2014 winlin
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SRS_UTEST_CONFIG_HPP
|
||||||
|
#define SRS_UTEST_CONFIG_HPP
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <srs_utest_config.hpp>
|
||||||
|
*/
|
||||||
|
#include <srs_utest.hpp>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#endif
|
Loading…
Add table
Add a link
Reference in a new issue