Skip to content

Commit d1dec92

Browse files
chundonglinlinwinlinvipxiaozhihong
committed
Config: Error when both HLS and HTTP-TS enabled. (#3400)
PICK 5b001fe Co-authored-by: winlin <[email protected]> Co-authored-by: john <[email protected]>
1 parent ed95a8f commit d1dec92

File tree

3 files changed

+55
-1
lines changed

3 files changed

+55
-1
lines changed

trunk/doc/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ The changelog for SRS.
88

99
## SRS 5.0 Changelog
1010

11+
* v5.0, 2023-02-08, Merge [#3391](https://github.com/ossrs/srs/pull/3391): Config: Error when both HLS and HTTP-TS enabled. v5.0.140 (#3391)
1112
* v5.0, 2023-01-29, Merge [#3371](https://github.com/ossrs/srs/pull/3371): HLS: support kick-off hls client. v5.0.139 (#3371)
1213
* v5.0, 2023-01-19, Merge [#3318](https://github.com/ossrs/srs/pull/3318): RTC: fix rtc publisher pli cid. v5.0.138 (#3318)
1314
* v5.0, 2023-01-18, Merge [#3382](https://github.com/ossrs/srs/pull/3382): Rewrite research/api-server code by Go, remove Python. v5.0.137 (#3382)

trunk/src/app/srs_app_config.cpp

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2674,6 +2674,59 @@ srs_error_t SrsConfig::check_normal_config()
26742674
}
26752675
}
26762676
}
2677+
2678+
////////////////////////////////////////////////////////////////////////
2679+
// check HLS with HTTP-TS
2680+
////////////////////////////////////////////////////////////////////////
2681+
for (int n = 0; n < (int)vhosts.size(); n++) {
2682+
SrsConfDirective* vhost = vhosts[n];
2683+
2684+
bool hls_enabled = false;
2685+
bool http_remux_ts = false;
2686+
int http_remux_cnt = 0;
2687+
2688+
for (int i = 0; vhost && i < (int)vhost->directives.size(); i++) {
2689+
SrsConfDirective* conf = vhost->at(i);
2690+
string n = conf->name;
2691+
if (n == "http_remux") {
2692+
bool http_remux_enabled = false;
2693+
for (int j = 0; j < (int)conf->directives.size(); j++) {
2694+
string m = conf->at(j)->name;
2695+
2696+
// http_remux enabled
2697+
if (m == "enabled" && conf->at(j)->arg0() == "on") {
2698+
http_remux_enabled = true;
2699+
}
2700+
2701+
// check mount suffix '.ts'
2702+
if (http_remux_enabled && m == "mount" && srs_string_ends_with(conf->at(j)->arg0(), ".ts")) {
2703+
http_remux_ts = true;
2704+
}
2705+
}
2706+
http_remux_cnt++;
2707+
} else if (n == "hls") {
2708+
for (int j = 0; j < (int)conf->directives.size(); j++) {
2709+
string m = conf->at(j)->name;
2710+
2711+
// hls enabled
2712+
if (m == "enabled" && conf->at(j)->arg0() == "on") {
2713+
hls_enabled = true;
2714+
}
2715+
}
2716+
}
2717+
}
2718+
2719+
// check valid http-remux count
2720+
if (http_remux_cnt > 1) {
2721+
return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "vhost.http_remux only one but count=%d of %s", http_remux_cnt, vhost->arg0().c_str());
2722+
}
2723+
2724+
// check hls conflict with http-ts
2725+
if (hls_enabled && http_remux_ts) {
2726+
return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "vhost.hls conflict with vhost.http-ts of %s", vhost->arg0().c_str());
2727+
}
2728+
}
2729+
26772730
// check ingest id unique.
26782731
for (int i = 0; i < (int)vhosts.size(); i++) {
26792732
SrsConfDirective* vhost = vhosts[i];

trunk/src/core/srs_core_version5.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99

1010
#define VERSION_MAJOR 5
1111
#define VERSION_MINOR 0
12-
#define VERSION_REVISION 139
12+
#define VERSION_REVISION 140
1313

1414
#endif

0 commit comments

Comments
 (0)