正在显示
4 个修改的文件
包含
43 行增加
和
20 行删除
| @@ -1932,10 +1932,12 @@ string SrsConfig::get_transcode_ffmpeg(SrsConfDirective* transcode) | @@ -1932,10 +1932,12 @@ string SrsConfig::get_transcode_ffmpeg(SrsConfDirective* transcode) | ||
| 1932 | return conf->arg0(); | 1932 | return conf->arg0(); |
| 1933 | } | 1933 | } |
| 1934 | 1934 | ||
| 1935 | -void SrsConfig::get_transcode_engines(SrsConfDirective* transcode, vector<SrsConfDirective*>& engines) | 1935 | +vector<SrsConfDirective*> SrsConfig::get_transcode_engines(SrsConfDirective* transcode) |
| 1936 | { | 1936 | { |
| 1937 | + vector<SrsConfDirective*> engines; | ||
| 1938 | + | ||
| 1937 | if (!transcode) { | 1939 | if (!transcode) { |
| 1938 | - return; | 1940 | + return engines; |
| 1939 | } | 1941 | } |
| 1940 | 1942 | ||
| 1941 | for (int i = 0; i < (int)transcode->directives.size(); i++) { | 1943 | for (int i = 0; i < (int)transcode->directives.size(); i++) { |
| @@ -1946,7 +1948,7 @@ void SrsConfig::get_transcode_engines(SrsConfDirective* transcode, vector<SrsCon | @@ -1946,7 +1948,7 @@ void SrsConfig::get_transcode_engines(SrsConfDirective* transcode, vector<SrsCon | ||
| 1946 | } | 1948 | } |
| 1947 | } | 1949 | } |
| 1948 | 1950 | ||
| 1949 | - return; | 1951 | + return engines; |
| 1950 | } | 1952 | } |
| 1951 | 1953 | ||
| 1952 | bool SrsConfig::get_engine_enabled(SrsConfDirective* engine) | 1954 | bool SrsConfig::get_engine_enabled(SrsConfDirective* engine) |
| @@ -526,57 +526,80 @@ public: | @@ -526,57 +526,80 @@ public: | ||
| 526 | // bwct(bandwidth check tool) section | 526 | // bwct(bandwidth check tool) section |
| 527 | public: | 527 | public: |
| 528 | /** | 528 | /** |
| 529 | - * | 529 | + * whether bw check enabled for vhost. |
| 530 | + * if enabled, serve all clients with bandwidth check services. | ||
| 531 | + * oterwise, serve all cleints with stream. | ||
| 530 | */ | 532 | */ |
| 531 | virtual bool get_bw_check_enabled(std::string vhost); | 533 | virtual bool get_bw_check_enabled(std::string vhost); |
| 532 | /** | 534 | /** |
| 533 | - * | 535 | + * the key of server, if client key mot match, reject. |
| 534 | */ | 536 | */ |
| 535 | virtual std::string get_bw_check_key(std::string vhost); | 537 | virtual std::string get_bw_check_key(std::string vhost); |
| 536 | /** | 538 | /** |
| 537 | - * | 539 | + * the check interval, in ms. |
| 540 | + * if the client request check in very short time(in the interval), | ||
| 541 | + * SRS will reject client. | ||
| 542 | + * @remark this is used to prevent the bandwidth check attack. | ||
| 538 | */ | 543 | */ |
| 539 | virtual int get_bw_check_interval_ms(std::string vhost); | 544 | virtual int get_bw_check_interval_ms(std::string vhost); |
| 540 | /** | 545 | /** |
| 541 | - * | 546 | + * the max kbps that user can test, |
| 547 | + * if exceed the kbps, server will slowdown the send-recv. | ||
| 548 | + * @remark this is used to protect the service bandwidth. | ||
| 542 | */ | 549 | */ |
| 543 | virtual int get_bw_check_limit_kbps(std::string vhost); | 550 | virtual int get_bw_check_limit_kbps(std::string vhost); |
| 544 | // vhost edge section | 551 | // vhost edge section |
| 545 | public: | 552 | public: |
| 546 | /** | 553 | /** |
| 547 | - * | 554 | + * whether vhost is edge mode. |
| 555 | + * for edge, publish client will be proxyed to upnode, | ||
| 556 | + * for edge, play client will share a connection to get stream from upnode. | ||
| 548 | */ | 557 | */ |
| 549 | virtual bool get_vhost_is_edge(std::string vhost); | 558 | virtual bool get_vhost_is_edge(std::string vhost); |
| 550 | /** | 559 | /** |
| 551 | - * | 560 | + * whether vhost is edge mode. |
| 561 | + * for edge, publish client will be proxyed to upnode, | ||
| 562 | + * for edge, play client will share a connection to get stream from upnode. | ||
| 552 | */ | 563 | */ |
| 553 | virtual bool get_vhost_is_edge(SrsConfDirective* vhost); | 564 | virtual bool get_vhost_is_edge(SrsConfDirective* vhost); |
| 554 | /** | 565 | /** |
| 555 | - * | 566 | + * get the origin config of edge, |
| 567 | + * specifies the origin ip address, port. | ||
| 556 | */ | 568 | */ |
| 557 | virtual SrsConfDirective* get_vhost_edge_origin(std::string vhost); | 569 | virtual SrsConfDirective* get_vhost_edge_origin(std::string vhost); |
| 558 | /** | 570 | /** |
| 559 | - * | 571 | + * whether edge token tranverse is enabled, |
| 572 | + * if true, edge will send connect origin to verfy the token of client. | ||
| 573 | + * for example, we verify all clients on the origin FMS by server-side as, | ||
| 574 | + * all clients connected to edge must be tranverse to origin to verify. | ||
| 560 | */ | 575 | */ |
| 561 | virtual bool get_vhost_edge_token_traverse(std::string vhost); | 576 | virtual bool get_vhost_edge_token_traverse(std::string vhost); |
| 562 | // vhost transcode section | 577 | // vhost transcode section |
| 563 | public: | 578 | public: |
| 564 | /** | 579 | /** |
| 565 | - * | 580 | + * get the transcode directive of vhost in specified scope. |
| 581 | + * @param vhost, the vhost name to get the transcode directive. | ||
| 582 | + * @param scope, the scope, empty to get all. for example, user can transcode | ||
| 583 | + * the app scope stream, by config with app: | ||
| 584 | + * transcode live {...} | ||
| 585 | + * when the scope is "live", this directive is matched. | ||
| 586 | + * the scope can be: empty for all, app, app/stream. | ||
| 587 | + * @remark, please see the samples of full.conf, the app.transcode.srs.com | ||
| 588 | + * and stream.transcode.srs.com. | ||
| 566 | */ | 589 | */ |
| 567 | virtual SrsConfDirective* get_transcode(std::string vhost, std::string scope); | 590 | virtual SrsConfDirective* get_transcode(std::string vhost, std::string scope); |
| 568 | /** | 591 | /** |
| 569 | - * | 592 | + * whether the transcode directive is enabled. |
| 570 | */ | 593 | */ |
| 571 | virtual bool get_transcode_enabled(SrsConfDirective* transcode); | 594 | virtual bool get_transcode_enabled(SrsConfDirective* transcode); |
| 572 | /** | 595 | /** |
| 573 | - * | 596 | + * get the ffmpeg tool path of transcode. |
| 574 | */ | 597 | */ |
| 575 | virtual std::string get_transcode_ffmpeg(SrsConfDirective* transcode); | 598 | virtual std::string get_transcode_ffmpeg(SrsConfDirective* transcode); |
| 576 | /** | 599 | /** |
| 577 | - * | 600 | + * get the engines of transcode. |
| 578 | */ | 601 | */ |
| 579 | - virtual void get_transcode_engines(SrsConfDirective* transcode, std::vector<SrsConfDirective*>& engines); | 602 | + virtual std::vector<SrsConfDirective*> get_transcode_engines(SrsConfDirective* transcode); |
| 580 | /** | 603 | /** |
| 581 | * | 604 | * |
| 582 | */ | 605 | */ |
| @@ -224,8 +224,7 @@ int SrsEncoder::parse_ffmpeg(SrsRequest* req, SrsConfDirective* conf) | @@ -224,8 +224,7 @@ int SrsEncoder::parse_ffmpeg(SrsRequest* req, SrsConfDirective* conf) | ||
| 224 | } | 224 | } |
| 225 | 225 | ||
| 226 | // get all engines. | 226 | // get all engines. |
| 227 | - std::vector<SrsConfDirective*> engines; | ||
| 228 | - _srs_config->get_transcode_engines(conf, engines); | 227 | + std::vector<SrsConfDirective*> engines = _srs_config->get_transcode_engines(conf); |
| 229 | if (engines.empty()) { | 228 | if (engines.empty()) { |
| 230 | srs_trace("ignore the empty transcode engine: %s", | 229 | srs_trace("ignore the empty transcode engine: %s", |
| 231 | conf->arg0().c_str()); | 230 | conf->arg0().c_str()); |
| @@ -123,8 +123,7 @@ int SrsIngester::parse_engines(SrsConfDirective* vhost, SrsConfDirective* ingest | @@ -123,8 +123,7 @@ int SrsIngester::parse_engines(SrsConfDirective* vhost, SrsConfDirective* ingest | ||
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | // get all engines. | 125 | // get all engines. |
| 126 | - std::vector<SrsConfDirective*> engines; | ||
| 127 | - _srs_config->get_transcode_engines(ingest, engines); | 126 | + std::vector<SrsConfDirective*> engines = _srs_config->get_transcode_engines(ingest); |
| 128 | if (engines.empty()) { | 127 | if (engines.empty()) { |
| 129 | SrsFFMPEG* ffmpeg = new SrsFFMPEG(ffmpeg_bin); | 128 | SrsFFMPEG* ffmpeg = new SrsFFMPEG(ffmpeg_bin); |
| 130 | if ((ret = initialize_ffmpeg(ffmpeg, vhost, ingest, NULL)) != ERROR_SUCCESS) { | 129 | if ((ret = initialize_ffmpeg(ffmpeg, vhost, ingest, NULL)) != ERROR_SUCCESS) { |
-
请 注册 或 登录 后发表评论