mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
parent
d21ef106a0
commit
51af2b4779
10 changed files with 68 additions and 227 deletions
|
@ -4290,7 +4290,7 @@ bool SrsConfig::get_rtc_enabled(SrsConfDirective* conf)
|
|||
|
||||
int SrsConfig::get_rtc_listen()
|
||||
{
|
||||
static int DEFAULT = 9527;
|
||||
static int DEFAULT = 8000;
|
||||
|
||||
SrsConfDirective* conf = root->get("rtc");
|
||||
if (!conf) {
|
||||
|
@ -4318,6 +4318,11 @@ std::string SrsConfig::get_rtc_candidates()
|
|||
if (!conf || conf->arg0().empty()) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
string eip = srs_getenv(conf->arg0());
|
||||
if (!eip.empty()) {
|
||||
return eip;
|
||||
}
|
||||
|
||||
return (conf->arg0().c_str());
|
||||
}
|
||||
|
|
|
@ -851,7 +851,7 @@ srs_error_t SrsGoApiSdp::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage*
|
|||
obj->set("server", SrsJsonAny::integer(stat->server_id()));
|
||||
|
||||
// XXX: ice candidate
|
||||
//string candidate_str = "candidate:1 1 udp 2115783679 192.168.170.129:9527 typ host generation 0 ufrag "
|
||||
//string candidate_str = "candidate:1 1 udp 2115783679 192.168.170.129:8000 typ host generation 0 ufrag "
|
||||
// + local_sdp.get_ice_ufrag() + "netwrok-cost 50";
|
||||
|
||||
//SrsJsonObject* candidate_obj = SrsJsonAny::object();
|
||||
|
|
|
@ -1227,3 +1227,23 @@ string dump_string_hex(const char* buf, const int nb_buf, const int& max_len)
|
|||
return ret;
|
||||
|
||||
}
|
||||
|
||||
string srs_getenv(string key)
|
||||
{
|
||||
string ekey = key;
|
||||
if (srs_string_starts_with(key, "$")) {
|
||||
ekey = key.substr(1);
|
||||
}
|
||||
|
||||
if (ekey.empty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
char* value = ::getenv(ekey.c_str());
|
||||
if (value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
|
@ -653,5 +653,9 @@ extern void srs_api_dump_summaries(SrsJsonObject* obj);
|
|||
extern std::string dump_string_hex(const std::string& str, const int& max_len = INT_MAX);
|
||||
extern std::string dump_string_hex(const char* buf, const int nb_buf, const int& max_len = INT_MAX);
|
||||
|
||||
// Get ENV variable, which may starts with $.
|
||||
// srs_getenv("EIP") === srs_getenv("$EIP")
|
||||
extern std::string srs_getenv(std::string key);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -59,7 +59,6 @@ using namespace std;
|
|||
srs_error_t run_directly_or_daemon();
|
||||
srs_error_t run_hybrid_server();
|
||||
void show_macro_features();
|
||||
string srs_getenv(const char* name);
|
||||
|
||||
// @global log and context.
|
||||
ISrsLog* _srs_log = new SrsFastLog();
|
||||
|
@ -344,17 +343,6 @@ void show_macro_features()
|
|||
#endif
|
||||
}
|
||||
|
||||
string srs_getenv(const char* name)
|
||||
{
|
||||
char* cv = ::getenv(name);
|
||||
|
||||
if (cv) {
|
||||
return cv;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
// Detect docker by https://stackoverflow.com/a/41559867
|
||||
bool _srs_in_docker = false;
|
||||
srs_error_t srs_detect_docker()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue