winlin

Merge branch '2.0release' into develop

@@ -217,6 +217,7 @@ Supported operating systems and hardware: @@ -217,6 +217,7 @@ Supported operating systems and hardware:
217 1. [experiment] Support push MPEG-TS over UDP to SRS, read [bug #250][bug #250]. 217 1. [experiment] Support push MPEG-TS over UDP to SRS, read [bug #250][bug #250].
218 1. [experiment] Support push RTSP to SRS, read [bug #133][bug #133]. 218 1. [experiment] Support push RTSP to SRS, read [bug #133][bug #133].
219 1. [experiment] Support push flv stream over HTTP POST to SRS, read [wiki]([CN][v2_CN_Streamer2], [EN][v2_EN_Streamer2]). 219 1. [experiment] Support push flv stream over HTTP POST to SRS, read [wiki]([CN][v2_CN_Streamer2], [EN][v2_EN_Streamer2]).
  220 +1. [experiment] Support [srs-dolphin][srs-dolphin], the multiple-process SRS.
220 1. [no-plan] Support <500ms latency, FRSC(Fast RTMP-compatible Stream Channel tech). 221 1. [no-plan] Support <500ms latency, FRSC(Fast RTMP-compatible Stream Channel tech).
221 1. [no-plan] Support RTMP 302 redirect [bug #92][bug #92]. 222 1. [no-plan] Support RTMP 302 redirect [bug #92][bug #92].
222 1. [no-plan] Support multiple processes, for both origin and edge 223 1. [no-plan] Support multiple processes, for both origin and edge
@@ -270,6 +271,7 @@ Compare SRS with other media server. @@ -270,6 +271,7 @@ Compare SRS with other media server.
270 | Feature | SRS | NGINX | CRTMPD | FMS | WOWZA | 271 | Feature | SRS | NGINX | CRTMPD | FMS | WOWZA |
271 | ----------- | ------- | ----- | --------- | -------- | ------ | 272 | ----------- | ------- | ----- | --------- | -------- | ------ |
272 | Concurrency | 7.5k | 3k | 2k | 2k | 3k | 273 | Concurrency | 7.5k | 3k | 2k | 2k | 3k |
  274 +|MultipleProcess| Experiment| Stable | X | X | X |
273 | RTMP Latency| 0.1s | 3s | 3s | 3s | 3s | 275 | RTMP Latency| 0.1s | 3s | 3s | 3s | 3s |
274 | HLS Latency | 10s | 30s | X | 30s | 30s | 276 | HLS Latency | 10s | 30s | X | 30s | 30s |
275 277
@@ -306,6 +308,7 @@ Compare SRS with other media server. @@ -306,6 +308,7 @@ Compare SRS with other media server.
306 Remark: 308 Remark:
307 309
308 1. Concurrency: The concurrency of single process. 310 1. Concurrency: The concurrency of single process.
  311 +1. MultipleProcess: SRS is single process, while [srs-dolphin][srs-dolphin] is a MultipleProcess SRS.
309 1. HLS aonly: The HLS audio only streaming delivery. 312 1. HLS aonly: The HLS audio only streaming delivery.
310 1. BW check: The bandwidth check. 313 1. BW check: The bandwidth check.
311 1. Security: To allow or deny stream publish or play. 314 1. Security: To allow or deny stream publish or play.
@@ -343,7 +346,7 @@ Remark: @@ -343,7 +346,7 @@ Remark:
343 * v3.0, 2015-03-15, fork srs2 and start srs3. 3.0.0 346 * v3.0, 2015-03-15, fork srs2 and start srs3. 3.0.0
344 347
345 ### SRS 2.0 history 348 ### SRS 2.0 history
346 - 349 +* v2.0, 2015-05-28, support [srs-dolphin][srs-dolphin], the multiple-process SRS.
347 * v2.0, 2015-05-24, fix [#404](https://github.com/simple-rtmp-server/srs/issues/404) register handler then start http thread. 2.0.167. 350 * v2.0, 2015-05-24, fix [#404](https://github.com/simple-rtmp-server/srs/issues/404) register handler then start http thread. 2.0.167.
348 * v2.0, 2015-05-23, refine the thread, protocol, kbps code. 2.0.166 351 * v2.0, 2015-05-23, refine the thread, protocol, kbps code. 2.0.166
349 * v2.0, 2015-05-23, fix [#391](https://github.com/simple-rtmp-server/srs/issues/391) copy request for async call. 352 * v2.0, 2015-05-23, fix [#391](https://github.com/simple-rtmp-server/srs/issues/391) copy request for async call.
@@ -675,6 +678,7 @@ Performance benchmark history, on virtual box. @@ -675,6 +678,7 @@ Performance benchmark history, on virtual box.
675 678
676 * See also: [Performance for x86/x64 Test Guide](https://github.com/simple-rtmp-server/srs/wiki/v1_CN_Performance) 679 * See also: [Performance for x86/x64 Test Guide](https://github.com/simple-rtmp-server/srs/wiki/v1_CN_Performance)
677 * See also: [Performance for RaspberryPi](https://github.com/simple-rtmp-server/srs/wiki/v1_CN_RaspberryPi) 680 * See also: [Performance for RaspberryPi](https://github.com/simple-rtmp-server/srs/wiki/v1_CN_RaspberryPi)
  681 +* About multiple-process performance, read [srs-dolphin][srs-dolphin].
678 682
679 ### Play RTMP benchmark 683 ### Play RTMP benchmark
680 684
@@ -857,6 +861,7 @@ Winlin @@ -857,6 +861,7 @@ Winlin
857 [srs]: https://github.com/simple-rtmp-server/srs 861 [srs]: https://github.com/simple-rtmp-server/srs
858 [csdn]: https://code.csdn.net/winlinvip/srs-csdn 862 [csdn]: https://code.csdn.net/winlinvip/srs-csdn
859 [oschina]: http://git.oschina.net/winlinvip/srs.oschina 863 [oschina]: http://git.oschina.net/winlinvip/srs.oschina
  864 +[srs-dolphin]: https://github.com/simple-rtmp-server/srs-dolphin
860 [gitlab]: https://gitlab.com/winlinvip/srs-gitlab 865 [gitlab]: https://gitlab.com/winlinvip/srs-gitlab
861 [v1_CN_Git]: https://github.com/simple-rtmp-server/srs/wiki/v1_CN_Git 866 [v1_CN_Git]: https://github.com/simple-rtmp-server/srs/wiki/v1_CN_Git
862 [v1_EN_Git]: https://github.com/simple-rtmp-server/srs/wiki/v1_EN_Git 867 [v1_EN_Git]: https://github.com/simple-rtmp-server/srs/wiki/v1_EN_Git
@@ -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 - d->name = dir; 394 + if (!dir.empty()) {
  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();
399 - d->args.push_back(value); 401 + if (!value.empty()) {
  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 */