Skip to content

Commit

Permalink
Config: Error when both HLS and HTTP-TS enabled. (#3400)
Browse files Browse the repository at this point in the history
Co-authored-by: winlin <winlin@vip.126.com>
Co-authored-by: john <hondaxiao@tencent.com>
  • Loading branch information
3 people authored Feb 8, 2023
1 parent 2b0e32a commit 5b001fe
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 2 deletions.
2 changes: 2 additions & 0 deletions trunk/doc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The changelog for SRS.

## SRS 6.0 Changelog

* v6.0, 2023-02-08, Merge [#3391](https://github.com/ossrs/srs/pull/3391): Config: Error when both HLS and HTTP-TS enabled. v6.0.23 (#3391)
* v6.0, 2023-02-08, Merge [#3389](https://github.com/ossrs/srs/pull/3389): Kernel: Fix demux SPS error for NVENC and LARIX. v6.0.22 (#3389)
* v6.0, 2023-01-29, Merge [#3371](https://github.com/ossrs/srs/pull/3371): HLS: support kick-off hls client. v6.0.21 (#3371)
* v6.0, 2023-01-19, Merge [#3366](https://github.com/ossrs/srs/pull/3366): H265: Support HEVC over SRT. v6.0.20 (#465) (#3366)
Expand Down Expand Up @@ -36,6 +37,7 @@ The changelog for SRS.

## SRS 5.0 Changelog

* 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)
* v5.0, 2023-01-29, Merge [#3371](https://github.com/ossrs/srs/pull/3371): HLS: support kick-off hls client. v5.0.139 (#3371)
* v5.0, 2023-01-19, Merge [#3318](https://github.com/ossrs/srs/pull/3318): RTC: fix rtc publisher pli cid. v5.0.138 (#3318)
* 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)
Expand Down
53 changes: 53 additions & 0 deletions trunk/src/app/srs_app_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2674,6 +2674,59 @@ srs_error_t SrsConfig::check_normal_config()
}
}
}

////////////////////////////////////////////////////////////////////////
// check HLS with HTTP-TS
////////////////////////////////////////////////////////////////////////
for (int n = 0; n < (int)vhosts.size(); n++) {
SrsConfDirective* vhost = vhosts[n];

bool hls_enabled = false;
bool http_remux_ts = false;
int http_remux_cnt = 0;

for (int i = 0; vhost && i < (int)vhost->directives.size(); i++) {
SrsConfDirective* conf = vhost->at(i);
string n = conf->name;
if (n == "http_remux") {
bool http_remux_enabled = false;
for (int j = 0; j < (int)conf->directives.size(); j++) {
string m = conf->at(j)->name;

// http_remux enabled
if (m == "enabled" && conf->at(j)->arg0() == "on") {
http_remux_enabled = true;
}

// check mount suffix '.ts'
if (http_remux_enabled && m == "mount" && srs_string_ends_with(conf->at(j)->arg0(), ".ts")) {
http_remux_ts = true;
}
}
http_remux_cnt++;
} else if (n == "hls") {
for (int j = 0; j < (int)conf->directives.size(); j++) {
string m = conf->at(j)->name;

// hls enabled
if (m == "enabled" && conf->at(j)->arg0() == "on") {
hls_enabled = true;
}
}
}
}

// check valid http-remux count
if (http_remux_cnt > 1) {
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());
}

// check hls conflict with http-ts
if (hls_enabled && http_remux_ts) {
return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "vhost.hls conflict with vhost.http-ts of %s", vhost->arg0().c_str());
}
}

// check ingest id unique.
for (int i = 0; i < (int)vhosts.size(); i++) {
SrsConfDirective* vhost = vhosts[i];
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/core/srs_core_version5.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

#define VERSION_MAJOR 5
#define VERSION_MINOR 0
#define VERSION_REVISION 139
#define VERSION_REVISION 140

#endif
2 changes: 1 addition & 1 deletion trunk/src/core/srs_core_version6.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

#define VERSION_MAJOR 6
#define VERSION_MINOR 0
#define VERSION_REVISION 22
#define VERSION_REVISION 23

#endif

0 comments on commit 5b001fe

Please sign in to comment.