正在显示
13 个修改的文件
包含
337 行增加
和
29 行删除
| @@ -422,7 +422,8 @@ MODULE_ID="KERNEL" | @@ -422,7 +422,8 @@ MODULE_ID="KERNEL" | ||
| 422 | MODULE_DEPENDS=("CORE") | 422 | MODULE_DEPENDS=("CORE") |
| 423 | ModuleLibIncs=(${SRS_OBJS}) | 423 | ModuleLibIncs=(${SRS_OBJS}) |
| 424 | MODULE_FILES=("srs_kernel_error" "srs_kernel_log" "srs_kernel_stream" "srs_kernel_buffer" | 424 | MODULE_FILES=("srs_kernel_error" "srs_kernel_log" "srs_kernel_stream" "srs_kernel_buffer" |
| 425 | - "srs_kernel_utility" "srs_kernel_flv" "srs_kernel_codec" "srs_kernel_file") | 425 | + "srs_kernel_utility" "srs_kernel_flv" "srs_kernel_codec" "srs_kernel_file" |
| 426 | + "srs_kernel_consts") | ||
| 426 | KERNEL_INCS="src/kernel"; MODULE_DIR=${KERNEL_INCS} . auto/modules.sh | 427 | KERNEL_INCS="src/kernel"; MODULE_DIR=${KERNEL_INCS} . auto/modules.sh |
| 427 | KERNEL_OBJS="${MODULE_OBJS[@]}" | 428 | KERNEL_OBJS="${MODULE_OBJS[@]}" |
| 428 | # | 429 | # |
| @@ -488,7 +489,7 @@ fi | @@ -488,7 +489,7 @@ fi | ||
| 488 | # | 489 | # |
| 489 | # utest, the unit-test cases of srs, base on gtest1.6 | 490 | # utest, the unit-test cases of srs, base on gtest1.6 |
| 490 | MODULE_FILES=("srs_utest" "srs_utest_amf0" "srs_utest_protocol" | 491 | MODULE_FILES=("srs_utest" "srs_utest_amf0" "srs_utest_protocol" |
| 491 | - "srs_utest_kernel" "srs_utest_core") | 492 | + "srs_utest_kernel" "srs_utest_core" "srs_utest_config") |
| 492 | ModuleLibIncs=(${SRS_OBJS} ${LibSTRoot}) | 493 | ModuleLibIncs=(${SRS_OBJS} ${LibSTRoot}) |
| 493 | ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile} ${LibSSLfile}) | 494 | ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile} ${LibSSLfile}) |
| 494 | MODULE_DEPENDS=("CORE" "KERNEL" "RTMP" "APP") | 495 | MODULE_DEPENDS=("CORE" "KERNEL" "RTMP" "APP") |
| @@ -1143,8 +1143,8 @@ void SrsConfig::print_help(char** argv) | @@ -1143,8 +1143,8 @@ void SrsConfig::print_help(char** argv) | ||
| 1143 | "\n" | 1143 | "\n" |
| 1144 | "For example:\n" | 1144 | "For example:\n" |
| 1145 | " %s -v\n" | 1145 | " %s -v\n" |
| 1146 | - " %s -t -c "SRS_DEFAULT_CONF"\n" | ||
| 1147 | - " %s -c "SRS_DEFAULT_CONF"\n", | 1146 | + " %s -t -c "SRS_CONF_DEFAULT_COFNIG_FILE"\n" |
| 1147 | + " %s -c "SRS_CONF_DEFAULT_COFNIG_FILE"\n", | ||
| 1148 | argv[0], argv[0], argv[0], argv[0]); | 1148 | argv[0], argv[0], argv[0], argv[0]); |
| 1149 | } | 1149 | } |
| 1150 | 1150 | ||
| @@ -1968,12 +1968,12 @@ bool SrsConfig::get_engine_enabled(SrsConfDirective* engine) | @@ -1968,12 +1968,12 @@ bool SrsConfig::get_engine_enabled(SrsConfDirective* engine) | ||
| 1968 | string SrsConfig::get_engine_iformat(SrsConfDirective* engine) | 1968 | string SrsConfig::get_engine_iformat(SrsConfDirective* engine) |
| 1969 | { | 1969 | { |
| 1970 | if (!engine) { | 1970 | if (!engine) { |
| 1971 | - return "flv"; | 1971 | + return SRS_CONF_DEFAULT_TRANSCODE_IFORMAT; |
| 1972 | } | 1972 | } |
| 1973 | 1973 | ||
| 1974 | SrsConfDirective* conf = engine->get("iformat"); | 1974 | SrsConfDirective* conf = engine->get("iformat"); |
| 1975 | if (!conf) { | 1975 | if (!conf) { |
| 1976 | - return "flv"; | 1976 | + return SRS_CONF_DEFAULT_TRANSCODE_IFORMAT; |
| 1977 | } | 1977 | } |
| 1978 | 1978 | ||
| 1979 | return conf->arg0(); | 1979 | return conf->arg0(); |
| @@ -2228,12 +2228,12 @@ vector<string> SrsConfig::get_engine_aparams(SrsConfDirective* engine) | @@ -2228,12 +2228,12 @@ vector<string> SrsConfig::get_engine_aparams(SrsConfDirective* engine) | ||
| 2228 | string SrsConfig::get_engine_oformat(SrsConfDirective* engine) | 2228 | string SrsConfig::get_engine_oformat(SrsConfDirective* engine) |
| 2229 | { | 2229 | { |
| 2230 | if (!engine) { | 2230 | if (!engine) { |
| 2231 | - return "flv"; | 2231 | + return SRS_CONF_DEFAULT_TRANSCODE_OFORMAT; |
| 2232 | } | 2232 | } |
| 2233 | 2233 | ||
| 2234 | SrsConfDirective* conf = engine->get("oformat"); | 2234 | SrsConfDirective* conf = engine->get("oformat"); |
| 2235 | if (!conf) { | 2235 | if (!conf) { |
| 2236 | - return "flv"; | 2236 | + return SRS_CONF_DEFAULT_TRANSCODE_OFORMAT; |
| 2237 | } | 2237 | } |
| 2238 | 2238 | ||
| 2239 | return conf->arg0(); | 2239 | return conf->arg0(); |
| @@ -2346,7 +2346,7 @@ string SrsConfig::get_log_file() | @@ -2346,7 +2346,7 @@ string SrsConfig::get_log_file() | ||
| 2346 | 2346 | ||
| 2347 | SrsConfDirective* conf = root->get("srs_log_file"); | 2347 | SrsConfDirective* conf = root->get("srs_log_file"); |
| 2348 | if (!conf || conf->arg0().empty()) { | 2348 | if (!conf || conf->arg0().empty()) { |
| 2349 | - return "./objs/srs.log"; | 2349 | + return SRS_CONF_DEFAULT_LOG_FILE; |
| 2350 | } | 2350 | } |
| 2351 | 2351 | ||
| 2352 | return conf->arg0(); | 2352 | return conf->arg0(); |
| @@ -2355,7 +2355,7 @@ string SrsConfig::get_log_file() | @@ -2355,7 +2355,7 @@ string SrsConfig::get_log_file() | ||
| 2355 | bool SrsConfig::get_ffmpeg_log_enabled() | 2355 | bool SrsConfig::get_ffmpeg_log_enabled() |
| 2356 | { | 2356 | { |
| 2357 | string log = get_ffmpeg_log_dir(); | 2357 | string log = get_ffmpeg_log_dir(); |
| 2358 | - return log != "/dev/null"; | 2358 | + return log != SRS_CONSTS_NULL_FILE; |
| 2359 | } | 2359 | } |
| 2360 | 2360 | ||
| 2361 | string SrsConfig::get_ffmpeg_log_dir() | 2361 | string SrsConfig::get_ffmpeg_log_dir() |
| @@ -2364,7 +2364,7 @@ string SrsConfig::get_ffmpeg_log_dir() | @@ -2364,7 +2364,7 @@ string SrsConfig::get_ffmpeg_log_dir() | ||
| 2364 | 2364 | ||
| 2365 | SrsConfDirective* conf = root->get("ff_log_dir"); | 2365 | SrsConfDirective* conf = root->get("ff_log_dir"); |
| 2366 | if (!conf || conf->arg0().empty()) { | 2366 | if (!conf || conf->arg0().empty()) { |
| 2367 | - return "./objs"; | 2367 | + return SRS_CONF_DEFAULT_FF_LOG_DIR; |
| 2368 | } | 2368 | } |
| 2369 | 2369 | ||
| 2370 | return conf->arg0(); | 2370 | return conf->arg0(); |
| @@ -2376,7 +2376,7 @@ string SrsConfig::get_log_level() | @@ -2376,7 +2376,7 @@ string SrsConfig::get_log_level() | ||
| 2376 | 2376 | ||
| 2377 | SrsConfDirective* conf = root->get("srs_log_level"); | 2377 | SrsConfDirective* conf = root->get("srs_log_level"); |
| 2378 | if (!conf || conf->arg0().empty()) { | 2378 | if (!conf || conf->arg0().empty()) { |
| 2379 | - return "trace"; | 2379 | + return SRS_CONF_DEFAULT_LOG_LEVEL; |
| 2380 | } | 2380 | } |
| 2381 | 2381 | ||
| 2382 | return conf->arg0(); | 2382 | return conf->arg0(); |
| @@ -2387,7 +2387,7 @@ bool SrsConfig::get_log_tank_file() | @@ -2387,7 +2387,7 @@ bool SrsConfig::get_log_tank_file() | ||
| 2387 | srs_assert(root); | 2387 | srs_assert(root); |
| 2388 | 2388 | ||
| 2389 | SrsConfDirective* conf = root->get("srs_log_tank"); | 2389 | SrsConfDirective* conf = root->get("srs_log_tank"); |
| 2390 | - if (conf && conf->arg0() == "console") { | 2390 | + if (conf && conf->arg0() == SRS_CONF_DEFAULT_LOG_TANK_CONSOLE) { |
| 2391 | return false; | 2391 | return false; |
| 2392 | } | 2392 | } |
| 2393 | 2393 |
| @@ -34,9 +34,21 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -34,9 +34,21 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 34 | 34 | ||
| 35 | #include <srs_app_reload.hpp> | 35 | #include <srs_app_reload.hpp> |
| 36 | 36 | ||
| 37 | -#define SRS_LOCALHOST "127.0.0.1" | 37 | +/////////////////////////////////////////////////////////// |
| 38 | +// the value consts | ||
| 39 | +/////////////////////////////////////////////////////////// | ||
| 40 | +#define SRS_CONSTS_NULL_FILE "/dev/null" | ||
| 41 | +#define SRS_CONSTS_LOCALHOST "127.0.0.1" | ||
| 42 | + | ||
| 43 | +/////////////////////////////////////////////////////////// | ||
| 44 | +// default consts values | ||
| 45 | +/////////////////////////////////////////////////////////// | ||
| 38 | #define SRS_CONF_DEFAULT_PID_FILE "./objs/srs.pid" | 46 | #define SRS_CONF_DEFAULT_PID_FILE "./objs/srs.pid" |
| 39 | -#define SRS_DEFAULT_CONF "conf/srs.conf" | 47 | +#define SRS_CONF_DEFAULT_LOG_FILE "./objs/srs.log" |
| 48 | +#define SRS_CONF_DEFAULT_LOG_LEVEL "trace" | ||
| 49 | +#define SRS_CONF_DEFAULT_LOG_TANK_CONSOLE "console" | ||
| 50 | +#define SRS_CONF_DEFAULT_COFNIG_FILE "conf/srs.conf" | ||
| 51 | +#define SRS_CONF_DEFAULT_FF_LOG_DIR "./objs" | ||
| 40 | 52 | ||
| 41 | #define SRS_CONF_DEFAULT_MAX_CONNECTIONS 12345 | 53 | #define SRS_CONF_DEFAULT_MAX_CONNECTIONS 12345 |
| 42 | #define SRS_CONF_DEFAULT_HLS_PATH "./objs/nginx/html" | 54 | #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. | @@ -67,7 +79,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 67 | 79 | ||
| 68 | #define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_ENABLED false | 80 | #define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_ENABLED false |
| 69 | #define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_INTERVAL 9.9 | 81 | #define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_INTERVAL 9.9 |
| 70 | -#define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_URL "http://127.0.0.1:8085/api/v1/servers" | 82 | +#define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_URL "http://"SRS_CONSTS_LOCALHOST":8085/api/v1/servers" |
| 71 | #define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_INDEX 0 | 83 | #define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_INDEX 0 |
| 72 | #define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_SUMMARIES false | 84 | #define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_SUMMARIES false |
| 73 | 85 | ||
| @@ -82,6 +94,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -82,6 +94,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 82 | #define SRS_AUTO_INGEST_TYPE_FILE "file" | 94 | #define SRS_AUTO_INGEST_TYPE_FILE "file" |
| 83 | #define SRS_AUTO_INGEST_TYPE_STREAM "stream" | 95 | #define SRS_AUTO_INGEST_TYPE_STREAM "stream" |
| 84 | 96 | ||
| 97 | +#define SRS_CONF_DEFAULT_TRANSCODE_IFORMAT "flv" | ||
| 98 | +#define SRS_CONF_DEFAULT_TRANSCODE_OFORMAT "flv" | ||
| 99 | + | ||
| 85 | namespace _srs_internal | 100 | namespace _srs_internal |
| 86 | { | 101 | { |
| 87 | class SrsConfigBuffer; | 102 | class SrsConfigBuffer; |
| @@ -687,7 +702,7 @@ public: | @@ -687,7 +702,7 @@ public: | ||
| 687 | */ | 702 | */ |
| 688 | virtual std::string get_engine_oformat(SrsConfDirective* engine); | 703 | virtual std::string get_engine_oformat(SrsConfDirective* engine); |
| 689 | /** | 704 | /** |
| 690 | - * get the output of engine, for example, rtmp://127.0.0.1/live/livestream, | 705 | + * get the output of engine, for example, rtmp://localhost/live/livestream, |
| 691 | * @remark, we will use some variable, for instance, [vhost] to substitude with vhost. | 706 | * @remark, we will use some variable, for instance, [vhost] to substitude with vhost. |
| 692 | */ | 707 | */ |
| 693 | virtual std::string get_engine_output(SrsConfDirective* engine); | 708 | virtual std::string get_engine_output(SrsConfDirective* engine); |
| @@ -261,8 +261,10 @@ int SrsEncoder::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsRequest* req, SrsConfDir | @@ -261,8 +261,10 @@ int SrsEncoder::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsRequest* req, SrsConfDir | ||
| 261 | 261 | ||
| 262 | std::string input; | 262 | std::string input; |
| 263 | // input stream, from local. | 263 | // input stream, from local. |
| 264 | - // ie. rtmp://127.0.0.1:1935/live/livestream | ||
| 265 | - input = "rtmp://127.0.0.1:"; | 264 | + // ie. rtmp://localhost:1935/live/livestream |
| 265 | + input = "rtmp://"; | ||
| 266 | + input += SRS_CONSTS_LOCALHOST; | ||
| 267 | + input += ":"; | ||
| 266 | input += req->port; | 268 | input += req->port; |
| 267 | input += "/"; | 269 | input += "/"; |
| 268 | input += req->app; | 270 | input += req->app; |
| @@ -280,14 +282,14 @@ int SrsEncoder::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsRequest* req, SrsConfDir | @@ -280,14 +282,14 @@ int SrsEncoder::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsRequest* req, SrsConfDir | ||
| 280 | 282 | ||
| 281 | std::string output = _srs_config->get_engine_output(engine); | 283 | std::string output = _srs_config->get_engine_output(engine); |
| 282 | // output stream, to other/self server | 284 | // output stream, to other/self server |
| 283 | - // ie. rtmp://127.0.0.1:1935/live/livestream_sd | 285 | + // ie. rtmp://localhost:1935/live/livestream_sd |
| 284 | output = srs_string_replace(output, "[vhost]", req->vhost); | 286 | output = srs_string_replace(output, "[vhost]", req->vhost); |
| 285 | output = srs_string_replace(output, "[port]", req->port); | 287 | output = srs_string_replace(output, "[port]", req->port); |
| 286 | output = srs_string_replace(output, "[app]", req->app); | 288 | output = srs_string_replace(output, "[app]", req->app); |
| 287 | output = srs_string_replace(output, "[stream]", req->stream); | 289 | output = srs_string_replace(output, "[stream]", req->stream); |
| 288 | output = srs_string_replace(output, "[engine]", engine->arg0()); | 290 | output = srs_string_replace(output, "[engine]", engine->arg0()); |
| 289 | 291 | ||
| 290 | - std::string log_file = "/dev/null"; // disabled | 292 | + std::string log_file = SRS_CONSTS_NULL_FILE; // disabled |
| 291 | // write ffmpeg info to log file. | 293 | // write ffmpeg info to log file. |
| 292 | if (_srs_config->get_ffmpeg_log_enabled()) { | 294 | if (_srs_config->get_ffmpeg_log_enabled()) { |
| 293 | log_file = _srs_config->get_ffmpeg_log_dir(); | 295 | log_file = _srs_config->get_ffmpeg_log_dir(); |
| @@ -111,7 +111,7 @@ int SrsForwarder::on_publish(SrsRequest* req, std::string forward_server) | @@ -111,7 +111,7 @@ int SrsForwarder::on_publish(SrsRequest* req, std::string forward_server) | ||
| 111 | source_ep += req->vhost; | 111 | source_ep += req->vhost; |
| 112 | 112 | ||
| 113 | std::string dest_ep = "rtmp://"; | 113 | std::string dest_ep = "rtmp://"; |
| 114 | - if (forward_server == "127.0.0.1") { | 114 | + if (forward_server == SRS_CONSTS_LOCALHOST) { |
| 115 | dest_ep += req->host; | 115 | dest_ep += req->host; |
| 116 | } else { | 116 | } else { |
| 117 | dest_ep += forward_server; | 117 | dest_ep += forward_server; |
| @@ -235,7 +235,7 @@ int SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* vhost, S | @@ -235,7 +235,7 @@ int SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* vhost, S | ||
| 235 | 235 | ||
| 236 | std::string output = _srs_config->get_engine_output(engine); | 236 | std::string output = _srs_config->get_engine_output(engine); |
| 237 | // output stream, to other/self server | 237 | // output stream, to other/self server |
| 238 | - // ie. rtmp://127.0.0.1:1935/live/livestream_sd | 238 | + // ie. rtmp://localhost:1935/live/livestream_sd |
| 239 | output = srs_string_replace(output, "[vhost]", vhost->arg0()); | 239 | output = srs_string_replace(output, "[vhost]", vhost->arg0()); |
| 240 | output = srs_string_replace(output, "[port]", port); | 240 | output = srs_string_replace(output, "[port]", port); |
| 241 | if (output.empty()) { | 241 | if (output.empty()) { |
| @@ -260,7 +260,7 @@ int SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* vhost, S | @@ -260,7 +260,7 @@ int SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* vhost, S | ||
| 260 | app = app.substr(0, pos); | 260 | app = app.substr(0, pos); |
| 261 | } | 261 | } |
| 262 | 262 | ||
| 263 | - std::string log_file = "/dev/null"; // disabled | 263 | + std::string log_file = SRS_CONSTS_NULL_FILE; // disabled |
| 264 | // write ffmpeg info to log file. | 264 | // write ffmpeg info to log file. |
| 265 | if (_srs_config->get_ffmpeg_log_enabled()) { | 265 | if (_srs_config->get_ffmpeg_log_enabled()) { |
| 266 | log_file = _srs_config->get_ffmpeg_log_dir(); | 266 | log_file = _srs_config->get_ffmpeg_log_dir(); |
| @@ -37,8 +37,6 @@ using namespace std; | @@ -37,8 +37,6 @@ using namespace std; | ||
| 37 | #include <srs_app_kbps.hpp> | 37 | #include <srs_app_kbps.hpp> |
| 38 | #include <srs_app_json.hpp> | 38 | #include <srs_app_json.hpp> |
| 39 | 39 | ||
| 40 | -#define SRS_LOCAL_LOOP_IP "127.0.0.1" | ||
| 41 | - | ||
| 42 | int srs_socket_connect(std::string server, int port, int64_t timeout, st_netfd_t* pstfd) | 40 | int srs_socket_connect(std::string server, int port, int64_t timeout, st_netfd_t* pstfd) |
| 43 | { | 41 | { |
| 44 | int ret = ERROR_SUCCESS; | 42 | int ret = ERROR_SUCCESS; |
| @@ -707,7 +705,7 @@ void retrieve_local_ipv4_ips() | @@ -707,7 +705,7 @@ void retrieve_local_ipv4_ips() | ||
| 707 | } | 705 | } |
| 708 | 706 | ||
| 709 | std::string ip = buf; | 707 | std::string ip = buf; |
| 710 | - if (ip != SRS_LOCAL_LOOP_IP) { | 708 | + if (ip != SRS_CONSTS_LOCALHOST) { |
| 711 | srs_trace("retrieve local ipv4 addresses: %s", ip.c_str()); | 709 | srs_trace("retrieve local ipv4 addresses: %s", ip.c_str()); |
| 712 | ips.push_back(ip); | 710 | ips.push_back(ip); |
| 713 | } | 711 | } |
trunk/src/kernel/srs_kernel_consts.cpp
0 → 100644
| 1 | +/* | ||
| 2 | +The MIT License (MIT) | ||
| 3 | + | ||
| 4 | +Copyright (c) 2013-2014 winlin | ||
| 5 | + | ||
| 6 | +Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
| 7 | +this software and associated documentation files (the "Software"), to deal in | ||
| 8 | +the Software without restriction, including without limitation the rights to | ||
| 9 | +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
| 10 | +the Software, and to permit persons to whom the Software is furnished to do so, | ||
| 11 | +subject to the following conditions: | ||
| 12 | + | ||
| 13 | +The above copyright notice and this permission notice shall be included in all | ||
| 14 | +copies or substantial portions of the Software. | ||
| 15 | + | ||
| 16 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 17 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| 18 | +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| 19 | +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| 20 | +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| 21 | +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 22 | +*/ | ||
| 23 | + | ||
| 24 | +#include <srs_kernel_consts.hpp> | ||
| 25 | + |
trunk/src/kernel/srs_kernel_consts.hpp
0 → 100644
| 1 | +/* | ||
| 2 | +The MIT License (MIT) | ||
| 3 | + | ||
| 4 | +Copyright (c) 2013-2014 winlin | ||
| 5 | + | ||
| 6 | +Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
| 7 | +this software and associated documentation files (the "Software"), to deal in | ||
| 8 | +the Software without restriction, including without limitation the rights to | ||
| 9 | +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
| 10 | +the Software, and to permit persons to whom the Software is furnished to do so, | ||
| 11 | +subject to the following conditions: | ||
| 12 | + | ||
| 13 | +The above copyright notice and this permission notice shall be included in all | ||
| 14 | +copies or substantial portions of the Software. | ||
| 15 | + | ||
| 16 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 17 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| 18 | +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| 19 | +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| 20 | +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| 21 | +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 22 | +*/ | ||
| 23 | + | ||
| 24 | +#ifndef SRS_KERNEL_CONSTS_HPP | ||
| 25 | +#define SRS_KERNEL_CONSTS_HPP | ||
| 26 | + | ||
| 27 | +/* | ||
| 28 | +#include <srs_kernel_consts.hpp> | ||
| 29 | +*/ | ||
| 30 | + | ||
| 31 | +#include <srs_core.hpp> | ||
| 32 | + | ||
| 33 | +#endif |
| @@ -48,14 +48,14 @@ typedef void* srs_rtmp_t; | @@ -48,14 +48,14 @@ typedef void* srs_rtmp_t; | ||
| 48 | /** | 48 | /** |
| 49 | * create/destroy a rtmp protocol stack. | 49 | * create/destroy a rtmp protocol stack. |
| 50 | * @url rtmp url, for example: | 50 | * @url rtmp url, for example: |
| 51 | -* rtmp://127.0.0.1/live/livestream | 51 | +* rtmp://localhost/live/livestream |
| 52 | * @return a rtmp handler, or NULL if error occured. | 52 | * @return a rtmp handler, or NULL if error occured. |
| 53 | */ | 53 | */ |
| 54 | srs_rtmp_t srs_rtmp_create(const char* url); | 54 | srs_rtmp_t srs_rtmp_create(const char* url); |
| 55 | /** | 55 | /** |
| 56 | * create rtmp with url, used for connection specified application. | 56 | * create rtmp with url, used for connection specified application. |
| 57 | * @param url the tcUrl, for exmple: | 57 | * @param url the tcUrl, for exmple: |
| 58 | -* rtmp://127.0.0.1/live | 58 | +* rtmp://localhost/live |
| 59 | * @remark this is used to create application connection-oriented, | 59 | * @remark this is used to create application connection-oriented, |
| 60 | * for example, the bandwidth client used this, no stream specified. | 60 | * for example, the bandwidth client used this, no stream specified. |
| 61 | */ | 61 | */ |
| @@ -20,6 +20,8 @@ file | @@ -20,6 +20,8 @@ file | ||
| 20 | ..\kernel\srs_kernel_buffer.cpp, | 20 | ..\kernel\srs_kernel_buffer.cpp, |
| 21 | ..\kernel\srs_kernel_codec.hpp, | 21 | ..\kernel\srs_kernel_codec.hpp, |
| 22 | ..\kernel\srs_kernel_codec.cpp, | 22 | ..\kernel\srs_kernel_codec.cpp, |
| 23 | + ..\kernel\srs_kernel_consts.hpp, | ||
| 24 | + ..\kernel\srs_kernel_consts.cpp, | ||
| 23 | ..\kernel\srs_kernel_error.hpp, | 25 | ..\kernel\srs_kernel_error.hpp, |
| 24 | ..\kernel\srs_kernel_error.cpp, | 26 | ..\kernel\srs_kernel_error.cpp, |
| 25 | ..\kernel\srs_kernel_file.hpp, | 27 | ..\kernel\srs_kernel_file.hpp, |
| @@ -115,6 +117,8 @@ file | @@ -115,6 +117,8 @@ file | ||
| 115 | ..\utest\srs_utest.cpp, | 117 | ..\utest\srs_utest.cpp, |
| 116 | ..\utest\srs_utest_amf0.hpp, | 118 | ..\utest\srs_utest_amf0.hpp, |
| 117 | ..\utest\srs_utest_amf0.cpp, | 119 | ..\utest\srs_utest_amf0.cpp, |
| 120 | + ..\utest\srs_utest_config.hpp, | ||
| 121 | + ..\utest\srs_utest_config.cpp, | ||
| 118 | ..\utest\srs_utest_core.hpp, | 122 | ..\utest\srs_utest_core.hpp, |
| 119 | ..\utest\srs_utest_core.cpp, | 123 | ..\utest\srs_utest_core.cpp, |
| 120 | ..\utest\srs_utest_kernel.hpp, | 124 | ..\utest\srs_utest_kernel.hpp, |
trunk/src/utest/srs_utest_config.cpp
0 → 100644
| 1 | +/* | ||
| 2 | +The MIT License (MIT) | ||
| 3 | + | ||
| 4 | +Copyright (c) 2013-2014 winlin | ||
| 5 | + | ||
| 6 | +Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
| 7 | +this software and associated documentation files (the "Software"), to deal in | ||
| 8 | +the Software without restriction, including without limitation the rights to | ||
| 9 | +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
| 10 | +the Software, and to permit persons to whom the Software is furnished to do so, | ||
| 11 | +subject to the following conditions: | ||
| 12 | + | ||
| 13 | +The above copyright notice and this permission notice shall be included in all | ||
| 14 | +copies or substantial portions of the Software. | ||
| 15 | + | ||
| 16 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 17 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| 18 | +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| 19 | +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| 20 | +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| 21 | +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 22 | +*/ | ||
| 23 | +#include <srs_utest_config.hpp> | ||
| 24 | + | ||
| 25 | +using namespace std; | ||
| 26 | + | ||
| 27 | +#include <srs_app_config.hpp> | ||
| 28 | + | ||
| 29 | +VOID TEST(ConfigTest, CheckMacros) | ||
| 30 | +{ | ||
| 31 | +#ifndef SRS_CONSTS_LOCALHOST | ||
| 32 | + EXPECT_TRUE(false); | ||
| 33 | +#endif | ||
| 34 | +#ifndef SRS_CONF_DEFAULT_PID_FILE | ||
| 35 | + EXPECT_TRUE(false); | ||
| 36 | +#endif | ||
| 37 | +#ifndef SRS_CONF_DEFAULT_COFNIG_FILE | ||
| 38 | + EXPECT_TRUE(false); | ||
| 39 | +#endif | ||
| 40 | +#ifndef SRS_CONF_DEFAULT_MAX_CONNECTIONS | ||
| 41 | + EXPECT_TRUE(false); | ||
| 42 | +#endif | ||
| 43 | +#ifndef SRS_CONF_DEFAULT_HLS_PATH | ||
| 44 | + EXPECT_TRUE(false); | ||
| 45 | +#endif | ||
| 46 | +#ifndef SRS_CONF_DEFAULT_HLS_FRAGMENT | ||
| 47 | + EXPECT_TRUE(false); | ||
| 48 | +#endif | ||
| 49 | +#ifndef SRS_CONF_DEFAULT_HLS_WINDOW | ||
| 50 | + EXPECT_TRUE(false); | ||
| 51 | +#endif | ||
| 52 | +#ifndef SRS_CONF_DEFAULT_DVR_PATH | ||
| 53 | + EXPECT_TRUE(false); | ||
| 54 | +#endif | ||
| 55 | +#ifndef SRS_CONF_DEFAULT_DVR_PLAN_SESSION | ||
| 56 | + EXPECT_TRUE(false); | ||
| 57 | +#endif | ||
| 58 | +#ifndef SRS_CONF_DEFAULT_DVR_PLAN_SEGMENT | ||
| 59 | + EXPECT_TRUE(false); | ||
| 60 | +#endif | ||
| 61 | +#ifndef SRS_CONF_DEFAULT_DVR_PLAN_HSS | ||
| 62 | + EXPECT_TRUE(false); | ||
| 63 | +#endif | ||
| 64 | +#ifndef SRS_CONF_DEFAULT_DVR_PLAN | ||
| 65 | + EXPECT_TRUE(false); | ||
| 66 | +#endif | ||
| 67 | +#ifndef SRS_CONF_DEFAULT_DVR_DURATION | ||
| 68 | + EXPECT_TRUE(false); | ||
| 69 | +#endif | ||
| 70 | +#ifndef SRS_CONF_DEFAULT_TIME_JITTER | ||
| 71 | + EXPECT_TRUE(false); | ||
| 72 | +#endif | ||
| 73 | +#ifndef SRS_CONF_DEFAULT_QUEUE_LENGTH | ||
| 74 | + EXPECT_TRUE(false); | ||
| 75 | +#endif | ||
| 76 | +#ifndef SRS_CONF_DEFAULT_PAUSED_LENGTH | ||
| 77 | + EXPECT_TRUE(false); | ||
| 78 | +#endif | ||
| 79 | +#ifndef SRS_CONF_DEFAULT_BANDWIDTH_INTERVAL | ||
| 80 | + EXPECT_TRUE(false); | ||
| 81 | +#endif | ||
| 82 | +#ifndef SRS_CONF_DEFAULT_BANDWIDTH_LIMIT_KBPS | ||
| 83 | + EXPECT_TRUE(false); | ||
| 84 | +#endif | ||
| 85 | +#ifndef SRS_CONF_DEFAULT_HTTP_MOUNT | ||
| 86 | + EXPECT_TRUE(false); | ||
| 87 | +#endif | ||
| 88 | +#ifndef SRS_CONF_DEFAULT_HTTP_DIR | ||
| 89 | + EXPECT_TRUE(false); | ||
| 90 | +#endif | ||
| 91 | +#ifndef SRS_CONF_DEFAULT_HTTP_STREAM_PORT | ||
| 92 | + EXPECT_TRUE(false); | ||
| 93 | +#endif | ||
| 94 | +#ifndef SRS_CONF_DEFAULT_HTTP_API_PORT | ||
| 95 | + EXPECT_TRUE(false); | ||
| 96 | +#endif | ||
| 97 | +#ifndef SRS_CONF_DEFAULT_HTTP_HEAETBEAT_ENABLED | ||
| 98 | + EXPECT_TRUE(false); | ||
| 99 | +#endif | ||
| 100 | +#ifndef SRS_CONF_DEFAULT_HTTP_HEAETBEAT_INTERVAL | ||
| 101 | + EXPECT_TRUE(false); | ||
| 102 | +#endif | ||
| 103 | +#ifndef SRS_CONF_DEFAULT_HTTP_HEAETBEAT_URL | ||
| 104 | + EXPECT_TRUE(false); | ||
| 105 | +#endif | ||
| 106 | +#ifndef SRS_CONF_DEFAULT_HTTP_HEAETBEAT_INDEX | ||
| 107 | + EXPECT_TRUE(false); | ||
| 108 | +#endif | ||
| 109 | +#ifndef SRS_CONF_DEFAULT_HTTP_HEAETBEAT_SUMMARIES | ||
| 110 | + EXPECT_TRUE(false); | ||
| 111 | +#endif | ||
| 112 | +#ifndef SRS_STAGE_PLAY_USER_INTERVAL_MS | ||
| 113 | + EXPECT_TRUE(false); | ||
| 114 | +#endif | ||
| 115 | +#ifndef SRS_STAGE_PUBLISH_USER_INTERVAL_MS | ||
| 116 | + EXPECT_TRUE(false); | ||
| 117 | +#endif | ||
| 118 | +#ifndef SRS_STAGE_FORWARDER_INTERVAL_MS | ||
| 119 | + EXPECT_TRUE(false); | ||
| 120 | +#endif | ||
| 121 | +#ifndef SRS_STAGE_ENCODER_INTERVAL_MS | ||
| 122 | + EXPECT_TRUE(false); | ||
| 123 | +#endif | ||
| 124 | +#ifndef SRS_STAGE_INGESTER_INTERVAL_MS | ||
| 125 | + EXPECT_TRUE(false); | ||
| 126 | +#endif | ||
| 127 | +#ifndef SRS_STAGE_HLS_INTERVAL_MS | ||
| 128 | + EXPECT_TRUE(false); | ||
| 129 | +#endif | ||
| 130 | +#ifndef SRS_STAGE_EDGE_INTERVAL_MS | ||
| 131 | + EXPECT_TRUE(false); | ||
| 132 | +#endif | ||
| 133 | +#ifndef SRS_AUTO_INGEST_TYPE_FILE | ||
| 134 | + EXPECT_TRUE(false); | ||
| 135 | +#endif | ||
| 136 | +#ifndef SRS_AUTO_INGEST_TYPE_STREAM | ||
| 137 | + EXPECT_TRUE(false); | ||
| 138 | +#endif | ||
| 139 | +#ifndef SRS_CONF_DEFAULT_TRANSCODE_IFORMAT | ||
| 140 | + EXPECT_TRUE(false); | ||
| 141 | +#endif | ||
| 142 | +#ifndef SRS_CONF_DEFAULT_TRANSCODE_OFORMAT | ||
| 143 | + EXPECT_TRUE(false); | ||
| 144 | +#endif | ||
| 145 | +#ifndef SRS_CONF_DEFAULT_LOG_FILE | ||
| 146 | + EXPECT_TRUE(false); | ||
| 147 | +#endif | ||
| 148 | +#ifndef SRS_CONSTS_NULL_FILE | ||
| 149 | + EXPECT_TRUE(false); | ||
| 150 | +#endif | ||
| 151 | +#ifndef SRS_CONF_DEFAULT_FF_LOG_DIR | ||
| 152 | + EXPECT_TRUE(false); | ||
| 153 | +#endif | ||
| 154 | +#ifndef SRS_CONF_DEFAULT_LOG_LEVEL | ||
| 155 | + EXPECT_TRUE(false); | ||
| 156 | +#endif | ||
| 157 | +#ifndef SRS_CONF_DEFAULT_LOG_TANK_CONSOLE | ||
| 158 | + EXPECT_TRUE(false); | ||
| 159 | +#endif | ||
| 160 | +#ifndef xxxxxxxxxxxxxxxxxxxxxxxx | ||
| 161 | + EXPECT_TRUE(false); | ||
| 162 | +#endif | ||
| 163 | +#ifndef xxxxxxxxxxxxxxxxxxxxxxxx | ||
| 164 | + EXPECT_TRUE(false); | ||
| 165 | +#endif | ||
| 166 | +#ifndef xxxxxxxxxxxxxxxxxxxxxxxx | ||
| 167 | + EXPECT_TRUE(false); | ||
| 168 | +#endif | ||
| 169 | +#ifndef xxxxxxxxxxxxxxxxxxxxxxxx | ||
| 170 | + EXPECT_TRUE(false); | ||
| 171 | +#endif | ||
| 172 | +#ifndef xxxxxxxxxxxxxxxxxxxxxxxx | ||
| 173 | + EXPECT_TRUE(false); | ||
| 174 | +#endif | ||
| 175 | +#ifndef xxxxxxxxxxxxxxxxxxxxxxxx | ||
| 176 | + EXPECT_TRUE(false); | ||
| 177 | +#endif | ||
| 178 | +#ifndef xxxxxxxxxxxxxxxxxxxxxxxx | ||
| 179 | + EXPECT_TRUE(false); | ||
| 180 | +#endif | ||
| 181 | +#ifndef xxxxxxxxxxxxxxxxxxxxxxxx | ||
| 182 | + EXPECT_TRUE(false); | ||
| 183 | +#endif | ||
| 184 | +#ifndef xxxxxxxxxxxxxxxxxxxxxxxx | ||
| 185 | + EXPECT_TRUE(false); | ||
| 186 | +#endif | ||
| 187 | +#ifndef xxxxxxxxxxxxxxxxxxxxxxxx | ||
| 188 | + EXPECT_TRUE(false); | ||
| 189 | +#endif | ||
| 190 | +#ifndef xxxxxxxxxxxxxxxxxxxxxxxx | ||
| 191 | + EXPECT_TRUE(false); | ||
| 192 | +#endif | ||
| 193 | +#ifndef xxxxxxxxxxxxxxxxxxxxxxxx | ||
| 194 | + EXPECT_TRUE(false); | ||
| 195 | +#endif | ||
| 196 | +} |
trunk/src/utest/srs_utest_config.hpp
0 → 100644
| 1 | +/* | ||
| 2 | +The MIT License (MIT) | ||
| 3 | + | ||
| 4 | +Copyright (c) 2013-2014 winlin | ||
| 5 | + | ||
| 6 | +Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
| 7 | +this software and associated documentation files (the "Software"), to deal in | ||
| 8 | +the Software without restriction, including without limitation the rights to | ||
| 9 | +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
| 10 | +the Software, and to permit persons to whom the Software is furnished to do so, | ||
| 11 | +subject to the following conditions: | ||
| 12 | + | ||
| 13 | +The above copyright notice and this permission notice shall be included in all | ||
| 14 | +copies or substantial portions of the Software. | ||
| 15 | + | ||
| 16 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 17 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| 18 | +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| 19 | +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| 20 | +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| 21 | +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 22 | +*/ | ||
| 23 | + | ||
| 24 | +#ifndef SRS_UTEST_CONFIG_HPP | ||
| 25 | +#define SRS_UTEST_CONFIG_HPP | ||
| 26 | + | ||
| 27 | +/* | ||
| 28 | +#include <srs_utest_config.hpp> | ||
| 29 | +*/ | ||
| 30 | +#include <srs_utest.hpp> | ||
| 31 | + | ||
| 32 | +#include <string> | ||
| 33 | + | ||
| 34 | +#endif |
-
请 注册 或 登录 后发表评论