正在显示
3 个修改的文件
包含
33 行增加
和
13 行删除
| @@ -1412,10 +1412,12 @@ SrsConfDirective* SrsConfig::get_vhost(string vhost) | @@ -1412,10 +1412,12 @@ SrsConfDirective* SrsConfig::get_vhost(string vhost) | ||
| 1412 | return NULL; | 1412 | return NULL; |
| 1413 | } | 1413 | } |
| 1414 | 1414 | ||
| 1415 | -void SrsConfig::get_vhosts(std::vector<SrsConfDirective*>& vhosts) | 1415 | +vector<SrsConfDirective*> SrsConfig::get_vhosts() |
| 1416 | { | 1416 | { |
| 1417 | srs_assert(root); | 1417 | srs_assert(root); |
| 1418 | 1418 | ||
| 1419 | + std::vector<SrsConfDirective*> vhosts; | ||
| 1420 | + | ||
| 1419 | for (int i = 0; i < (int)root->directives.size(); i++) { | 1421 | for (int i = 0; i < (int)root->directives.size(); i++) { |
| 1420 | SrsConfDirective* conf = root->at(i); | 1422 | SrsConfDirective* conf = root->at(i); |
| 1421 | 1423 | ||
| @@ -1425,6 +1427,8 @@ void SrsConfig::get_vhosts(std::vector<SrsConfDirective*>& vhosts) | @@ -1425,6 +1427,8 @@ void SrsConfig::get_vhosts(std::vector<SrsConfDirective*>& vhosts) | ||
| 1425 | 1427 | ||
| 1426 | vhosts.push_back(conf); | 1428 | vhosts.push_back(conf); |
| 1427 | } | 1429 | } |
| 1430 | + | ||
| 1431 | + return vhosts; | ||
| 1428 | } | 1432 | } |
| 1429 | 1433 | ||
| 1430 | SrsConfDirective* SrsConfig::get_vhost_on_connect(string vhost) | 1434 | SrsConfDirective* SrsConfig::get_vhost_on_connect(string vhost) |
| @@ -366,44 +366,61 @@ public: | @@ -366,44 +366,61 @@ public: | ||
| 366 | */ | 366 | */ |
| 367 | virtual std::vector<std::string> get_listen(); | 367 | virtual std::vector<std::string> get_listen(); |
| 368 | /** | 368 | /** |
| 369 | - * | 369 | + * get the pid file path. |
| 370 | + * the pid file is used to save the pid of SRS, | ||
| 371 | + * use file lock to prevent multiple SRS starting. | ||
| 372 | + * @remark, if user need to run multiple SRS instance, | ||
| 373 | + * for example, to start multiple SRS for multiple CPUs, | ||
| 374 | + * user can use different pid file for each process. | ||
| 370 | */ | 375 | */ |
| 371 | virtual std::string get_pid_file(); | 376 | virtual std::string get_pid_file(); |
| 372 | /** | 377 | /** |
| 373 | - * | 378 | + * get the pithy print interval for publish, in ms, |
| 379 | + * the publish(flash/FMLE) message print. | ||
| 374 | */ | 380 | */ |
| 375 | virtual int get_pithy_print_publish(); | 381 | virtual int get_pithy_print_publish(); |
| 376 | /** | 382 | /** |
| 377 | - * | 383 | + * get the pithy print interval for forwarder, in ms, |
| 384 | + * the forwarder message print, for SRS forward stream to other servers. | ||
| 378 | */ | 385 | */ |
| 379 | virtual int get_pithy_print_forwarder(); | 386 | virtual int get_pithy_print_forwarder(); |
| 380 | /** | 387 | /** |
| 381 | - * | 388 | + * get the pithy print interval for encoder, in ms, |
| 389 | + * the encoder message print, for FFMPEG transcoder. | ||
| 382 | */ | 390 | */ |
| 383 | virtual int get_pithy_print_encoder(); | 391 | virtual int get_pithy_print_encoder(); |
| 384 | /** | 392 | /** |
| 385 | - * | 393 | + * get the pithy print interval for ingester, in ms, |
| 394 | + * the ingest used FFMPEG, or your tools, to read and transcode other stream | ||
| 395 | + * to RTMP to SRS. | ||
| 386 | */ | 396 | */ |
| 387 | virtual int get_pithy_print_ingester(); | 397 | virtual int get_pithy_print_ingester(); |
| 388 | /** | 398 | /** |
| 389 | - * | 399 | + * get the pithy print interval for HLS, in ms, |
| 400 | + * the HLS used for IOS/android/PC, SRS will mux RTMP to HLS. | ||
| 390 | */ | 401 | */ |
| 391 | virtual int get_pithy_print_hls(); | 402 | virtual int get_pithy_print_hls(); |
| 392 | /** | 403 | /** |
| 393 | - * | 404 | + * get the pithy print interval for Play, in ms, |
| 405 | + * the play is client or edge playing RTMP stream | ||
| 394 | */ | 406 | */ |
| 395 | virtual int get_pithy_print_play(); | 407 | virtual int get_pithy_print_play(); |
| 396 | /** | 408 | /** |
| 397 | - * | 409 | + * get the pithy print interval for edge, in ms, |
| 410 | + * the edge will get stream from upnode. | ||
| 398 | */ | 411 | */ |
| 399 | virtual int get_pithy_print_edge(); | 412 | virtual int get_pithy_print_edge(); |
| 400 | // vhost specified section | 413 | // vhost specified section |
| 401 | public: | 414 | public: |
| 415 | + /** | ||
| 416 | + * get the vhost directive by vhost name. | ||
| 417 | + * @param vhost, the name of vhost to get. | ||
| 418 | + */ | ||
| 402 | virtual SrsConfDirective* get_vhost(std::string vhost); | 419 | virtual SrsConfDirective* get_vhost(std::string vhost); |
| 403 | /** | 420 | /** |
| 404 | - * | 421 | + * get all vhosts in config file. |
| 405 | */ | 422 | */ |
| 406 | - virtual void get_vhosts(std::vector<SrsConfDirective*>& vhosts); | 423 | + virtual std::vector<SrsConfDirective*> get_vhosts(); |
| 407 | /** | 424 | /** |
| 408 | * | 425 | * |
| 409 | */ | 426 | */ |
| @@ -215,8 +215,7 @@ int SrsIngester::parse() | @@ -215,8 +215,7 @@ int SrsIngester::parse() | ||
| 215 | int ret = ERROR_SUCCESS; | 215 | int ret = ERROR_SUCCESS; |
| 216 | 216 | ||
| 217 | // parse ingesters | 217 | // parse ingesters |
| 218 | - std::vector<SrsConfDirective*> vhosts; | ||
| 219 | - _srs_config->get_vhosts(vhosts); | 218 | + std::vector<SrsConfDirective*> vhosts = _srs_config->get_vhosts(); |
| 220 | 219 | ||
| 221 | for (int i = 0; i < (int)vhosts.size(); i++) { | 220 | for (int i = 0; i < (int)vhosts.size(); i++) { |
| 222 | SrsConfDirective* vhost = vhosts[i]; | 221 | SrsConfDirective* vhost = vhosts[i]; |
-
请 注册 或 登录 后发表评论