正在显示
2 个修改的文件
包含
34 行增加
和
4 行删除
@@ -391,12 +391,16 @@ void SrsConfig::set_config_directive(SrsConfDirective* parent, string dir, strin | @@ -391,12 +391,16 @@ void SrsConfig::set_config_directive(SrsConfDirective* parent, string dir, strin | ||
391 | 391 | ||
392 | if (!d) { | 392 | if (!d) { |
393 | d = new SrsConfDirective(); | 393 | d = new SrsConfDirective(); |
394 | + if (!dir.empty()) { | ||
394 | d->name = dir; | 395 | d->name = dir; |
396 | + } | ||
395 | parent->directives.push_back(d); | 397 | parent->directives.push_back(d); |
396 | } | 398 | } |
397 | 399 | ||
398 | d->args.clear(); | 400 | d->args.clear(); |
401 | + if (!value.empty()) { | ||
399 | d->args.push_back(value); | 402 | d->args.push_back(value); |
403 | + } | ||
400 | } | 404 | } |
401 | 405 | ||
402 | void SrsConfig::subscribe(ISrsReloadHandler* handler) | 406 | void SrsConfig::subscribe(ISrsReloadHandler* handler) |
@@ -1284,16 +1288,29 @@ int SrsConfig::parse_argv(int& i, char** argv) | @@ -1284,16 +1288,29 @@ int SrsConfig::parse_argv(int& i, char** argv) | ||
1284 | case 'p': | 1288 | case 'p': |
1285 | dolphin = true; | 1289 | dolphin = true; |
1286 | if (*p) { | 1290 | if (*p) { |
1287 | - dolphin_port = p; | 1291 | + dolphin_rtmp_port = p; |
1288 | continue; | 1292 | continue; |
1289 | } | 1293 | } |
1290 | if (argv[++i]) { | 1294 | if (argv[++i]) { |
1291 | - dolphin_port = argv[i]; | 1295 | + dolphin_rtmp_port = argv[i]; |
1292 | continue; | 1296 | continue; |
1293 | } | 1297 | } |
1294 | ret = ERROR_SYSTEM_CONFIG_INVALID; | 1298 | ret = ERROR_SYSTEM_CONFIG_INVALID; |
1295 | srs_error("option \"-p\" requires params, ret=%d", ret); | 1299 | srs_error("option \"-p\" requires params, ret=%d", ret); |
1296 | return ret; | 1300 | return ret; |
1301 | + case 'x': | ||
1302 | + dolphin = true; | ||
1303 | + if (*p) { | ||
1304 | + dolphin_http_port = p; | ||
1305 | + continue; | ||
1306 | + } | ||
1307 | + if (argv[++i]) { | ||
1308 | + dolphin_http_port = argv[i]; | ||
1309 | + continue; | ||
1310 | + } | ||
1311 | + ret = ERROR_SYSTEM_CONFIG_INVALID; | ||
1312 | + srs_error("option \"-x\" requires params, ret=%d", ret); | ||
1313 | + return ret; | ||
1297 | case 'v': | 1314 | case 'v': |
1298 | case 'V': | 1315 | case 'V': |
1299 | show_help = false; | 1316 | show_help = false; |
@@ -1338,6 +1355,9 @@ void SrsConfig::print_help(char** argv) | @@ -1338,6 +1355,9 @@ void SrsConfig::print_help(char** argv) | ||
1338 | " -v, -V : show version and exit(0)\n" | 1355 | " -v, -V : show version and exit(0)\n" |
1339 | " -t : test configuration file, exit(error_code).\n" | 1356 | " -t : test configuration file, exit(error_code).\n" |
1340 | " -c filename : use configuration file for SRS\n" | 1357 | " -c filename : use configuration file for SRS\n" |
1358 | + "For srs-dolphin:\n" | ||
1359 | + " -p rtmp-port : the rtmp port to listen.\n" | ||
1360 | + " -x http-port : the http port to listen.\n" | ||
1341 | "\n" | 1361 | "\n" |
1342 | RTMP_SIG_SRS_WEB"\n" | 1362 | RTMP_SIG_SRS_WEB"\n" |
1343 | RTMP_SIG_SRS_URL"\n" | 1363 | RTMP_SIG_SRS_URL"\n" |
@@ -1882,7 +1902,16 @@ int SrsConfig::parse_buffer(SrsConfigBuffer* buffer) | @@ -1882,7 +1902,16 @@ int SrsConfig::parse_buffer(SrsConfigBuffer* buffer) | ||
1882 | // mock by dolphin mode. | 1902 | // mock by dolphin mode. |
1883 | // for the dolphin will start srs with specified params. | 1903 | // for the dolphin will start srs with specified params. |
1884 | if (dolphin) { | 1904 | if (dolphin) { |
1885 | - set_config_directive(root, "listen", dolphin_port); | 1905 | + // for RTMP. |
1906 | + set_config_directive(root, "listen", dolphin_rtmp_port); | ||
1907 | + | ||
1908 | + // for HTTP | ||
1909 | + set_config_directive(root, "http_server", ""); | ||
1910 | + SrsConfDirective* http_server = root->get("http_server"); | ||
1911 | + set_config_directive(http_server, "enabled", "on"); | ||
1912 | + set_config_directive(http_server, "listen", dolphin_http_port); | ||
1913 | + | ||
1914 | + // others. | ||
1886 | set_config_directive(root, "daemon", "off"); | 1915 | set_config_directive(root, "daemon", "off"); |
1887 | set_config_directive(root, "srs_log_tank", "console"); | 1916 | set_config_directive(root, "srs_log_tank", "console"); |
1888 | } | 1917 | } |
@@ -271,7 +271,8 @@ private: | @@ -271,7 +271,8 @@ private: | ||
271 | * @see https://github.com/simple-rtmp-server/srs-dolphin | 271 | * @see https://github.com/simple-rtmp-server/srs-dolphin |
272 | */ | 272 | */ |
273 | bool dolphin; | 273 | bool dolphin; |
274 | - std::string dolphin_port; | 274 | + std::string dolphin_rtmp_port; |
275 | + std::string dolphin_http_port; | ||
275 | /** | 276 | /** |
276 | * whether show help and exit. | 277 | * whether show help and exit. |
277 | */ | 278 | */ |
-
请 注册 或 登录 后发表评论