Allow Forward to be configured with Env Var. v6.0.170 (#4245)
Allow Env Var to control forwarding function.
By AI:
* [AI: Add utests for
PR.](1b978d19a5)
---------
Co-authored-by: Haibo Chen <495810242@qq.com>
Co-authored-by: chundonglinlin <chundonglinlin@163.com>
Co-authored-by: winlin <winlinvip@gmail.com>
This commit is contained in:
parent
45090ce4fc
commit
aeca022165
|
|
@ -7,6 +7,7 @@ The changelog for SRS.
|
||||||
<a name="v6-changes"></a>
|
<a name="v6-changes"></a>
|
||||||
|
|
||||||
## SRS 6.0 Changelog
|
## SRS 6.0 Changelog
|
||||||
|
* v6.0, 2025-07-28, Merge [#4245](https://github.com/ossrs/srs/pull/4245): Allow Forward to be configured with Env Var. v6.0.170 (#4245)
|
||||||
* v6.0, 2025-07-10, Merge [#4414](https://github.com/ossrs/srs/pull/4414): Fix H.264 B-frame detection logic to comply with specification. v6.0.169 (#4414)
|
* v6.0, 2025-07-10, Merge [#4414](https://github.com/ossrs/srs/pull/4414): Fix H.264 B-frame detection logic to comply with specification. v6.0.169 (#4414)
|
||||||
* v6.0, 2025-06-04, Merge [#4325](https://github.com/ossrs/srs/pull/4325): fix bug: loop transcoding #3516. v6.0.168 (#4325)
|
* v6.0, 2025-06-04, Merge [#4325](https://github.com/ossrs/srs/pull/4325): fix bug: loop transcoding #3516. v6.0.168 (#4325)
|
||||||
* v6.0, 2025-05-29, Merge [#4356](https://github.com/ossrs/srs/pull/4356): RTMP: Use extended timestamp as delta when chunk fmt=1/2. v6.0.167 (#4356)
|
* v6.0, 2025-05-29, Merge [#4356](https://github.com/ossrs/srs/pull/4356): RTMP: Use extended timestamp as delta when chunk fmt=1/2. v6.0.167 (#4356)
|
||||||
|
|
|
||||||
|
|
@ -5566,7 +5566,10 @@ int SrsConfig::get_global_chunk_size()
|
||||||
return ::atoi(conf->arg0().c_str());
|
return ::atoi(conf->arg0().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SrsConfig::get_forward_enabled(string vhost) {
|
bool SrsConfig::get_forward_enabled(string vhost)
|
||||||
|
{
|
||||||
|
SRS_OVERWRITE_BY_ENV_BOOL("srs.vhost.forward.enabled"); // SRS_VHOST_FORWARD_ENABLED
|
||||||
|
|
||||||
static bool DEFAULT = false;
|
static bool DEFAULT = false;
|
||||||
|
|
||||||
SrsConfDirective* conf = get_vhost(vhost);
|
SrsConfDirective* conf = get_vhost(vhost);
|
||||||
|
|
@ -5579,6 +5582,8 @@ bool SrsConfig::get_forward_enabled(string vhost) {
|
||||||
|
|
||||||
bool SrsConfig::get_forward_enabled(SrsConfDirective* vhost)
|
bool SrsConfig::get_forward_enabled(SrsConfDirective* vhost)
|
||||||
{
|
{
|
||||||
|
SRS_OVERWRITE_BY_ENV_BOOL("srs.vhost.forward.enabled"); // SRS_VHOST_FORWARD_ENABLED
|
||||||
|
|
||||||
static bool DEFAULT = false;
|
static bool DEFAULT = false;
|
||||||
|
|
||||||
SrsConfDirective* conf = vhost->get("forward");
|
SrsConfDirective* conf = vhost->get("forward");
|
||||||
|
|
@ -5611,6 +5616,9 @@ SrsConfDirective* SrsConfig::get_forwards(string vhost)
|
||||||
|
|
||||||
SrsConfDirective* SrsConfig::get_forward_backend(string vhost)
|
SrsConfDirective* SrsConfig::get_forward_backend(string vhost)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
SRS_OVERWRITE_BY_ENV_DIRECTIVE("srs.vhost.forward.backend"); // SRS_VHOST_FORWARD_BACKEND
|
||||||
|
|
||||||
SrsConfDirective* conf = get_vhost(vhost);
|
SrsConfDirective* conf = get_vhost(vhost);
|
||||||
if (!conf) {
|
if (!conf) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,6 @@
|
||||||
|
|
||||||
#define VERSION_MAJOR 6
|
#define VERSION_MAJOR 6
|
||||||
#define VERSION_MINOR 0
|
#define VERSION_MINOR 0
|
||||||
#define VERSION_REVISION 169
|
#define VERSION_REVISION 170
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -45,13 +45,17 @@ class ISrsSetEnvConfig
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
std::string key;
|
std::string key;
|
||||||
|
SrsConfig* conf;
|
||||||
public:
|
public:
|
||||||
ISrsSetEnvConfig(const std::string& k, const std::string& v, bool overwrite) {
|
ISrsSetEnvConfig(SrsConfig* c, const std::string& k, const std::string& v, bool overwrite) {
|
||||||
|
conf = c;
|
||||||
key = k;
|
key = k;
|
||||||
srs_setenv(k, v, overwrite);
|
srs_setenv(k, v, overwrite);
|
||||||
}
|
}
|
||||||
virtual ~ISrsSetEnvConfig() {
|
virtual ~ISrsSetEnvConfig() {
|
||||||
srs_unsetenv(key);
|
srs_unsetenv(key);
|
||||||
|
srs_freep(conf->env_cache_);
|
||||||
|
conf->env_cache_ = new SrsConfDirective();
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
// Adds, changes environment variables, which may starts with $.
|
// Adds, changes environment variables, which may starts with $.
|
||||||
|
|
@ -60,8 +64,8 @@ private:
|
||||||
int srs_unsetenv(const std::string& key);
|
int srs_unsetenv(const std::string& key);
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SrsSetEnvConfig(instance, key, value) \
|
#define SrsSetEnvConfig(conf, instance, key, value) \
|
||||||
ISrsSetEnvConfig _SRS_free_##instance(key, value, true)
|
ISrsSetEnvConfig _SRS_free_##instance(&conf, key, value, true)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user