[FIRE-36421] Add custom WebRTC STUN server support for OpenSim

This commit is contained in:
Hecklezz
2026-03-15 02:30:14 +10:00
parent 9a67c22f9e
commit d72e47dc71
3 changed files with 23 additions and 1 deletions
+6
View File
@@ -2715,6 +2715,12 @@ void LLViewerRegion::setSimulatorFeatures(const LLSD& sim_features)
}
}
}
mStunServers.clear();
if (mSimulatorFeatures.has("stun-servers"))
{
LLStringUtil::getTokens(mSimulatorFeatures["stun-servers"].asString(), mStunServers, ",");
}
}
#endif
+3 -1
View File
@@ -380,7 +380,8 @@ public:
// </FS:CR>
#ifdef OPENSIM
const std::set<std::string, std::less<>>& getGods() const { return mGodNames; };
const std::set<std::string, std::less<>>& getGods() const { return mGodNames; }
const std::vector<std::string> GetStunServers() const { return mStunServers; }
#endif // OPENSIM
// </FS:CR>
@@ -625,6 +626,7 @@ public:
// <FS:CR> Opensim region capabilities
#ifdef OPENSIM
std::set<std::string, std::less<>> mGodNames;
std::vector<std::string> mStunServers;
#endif
// </FS:CR>
+14
View File
@@ -2886,6 +2886,20 @@ static llwebrtc::LLWebRTCPeerConnectionInterface::InitOptions getConnectionOptio
// TODO: Pull these from login
std::string grid = LLGridManager::getInstance()->getGridLoginID();
std::transform(grid.begin(), grid.end(), grid.begin(), [](unsigned char c){ return std::tolower(c); });
// <FS:TJ> [FIRE-36421] Add OpenSim STUN server support
#ifdef OPENSIM
if (!LLGridManager::getInstance()->isInSecondLife())
{
LLViewerRegion* regionp = gAgent.getRegion();
if (regionp) {
std::vector<std::string> stunServers = regionp->GetStunServers();
servers.mUrls = regionp->GetStunServers();
}
options.mServers.push_back(servers);
return options;
}
#endif
// </FS:TJ>
int num_servers = 2;
if (grid == "agni")
{