Added the ability to have the voice enabled in multiple viewer instances

This commit is contained in:
Latif Khalifa
2013-01-31 01:26:03 +01:00
parent 4e29b6752e
commit 4b0bac34dd
3 changed files with 41 additions and 2 deletions

View File

@@ -15403,6 +15403,17 @@ This should be as low as possible, but too low may break functionality</string>
<key>Value</key>
<integer>44125</integer>
</map>
<key>VoiceMultiInstance</key>
<map>
<key>Comment</key>
<string>Allow multiple viewers to have the voice enabled at the same time</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>WLSkyDetail</key>
<map>
<key>Comment</key>

View File

@@ -2503,7 +2503,7 @@ bool LLAppViewer::initConfiguration()
// This is the second instance of SL. Turn off voice support,
// but make sure the setting is *not* persisted.
LLControlVariable* disable_voice = gSavedSettings.getControl("CmdLineDisableVoice");
if(disable_voice)
if(disable_voice && !gSavedSettings.getBOOL("VoiceMultiInstance"))
{
const BOOL DO_NOT_PERSIST = FALSE;
disable_voice->setValue(LLSD(TRUE), DO_NOT_PERSIST);

View File

@@ -1313,7 +1313,16 @@ void LLVoiceClient::connectorCreate()
<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.Create.1\">"
<< "<ClientName>V2 SDK</ClientName>"
<< "<AccountManagementServer>" << mVoiceAccountServerURI << "</AccountManagementServer>"
<< "<Mode>Normal</Mode>"
<< "<Mode>Normal</Mode>";
if (gSavedSettings.getBOOL("VoiceMultiInstance"))
{
stream
<< "<MinimumPort>30000</MinimumPort>"
<< "<MaximumPort>50000</MaximumPort>";
}
stream
<< "<Logging>"
<< "<Folder>" << logpath << "</Folder>"
<< "<FileNamePrefix>Connector</FileNamePrefix>"
@@ -1686,6 +1695,19 @@ void LLVoiceClient::stateMachine()
std::string args;
std::string cmd;
std::string loglevel = gSavedSettings.getString("VivoxDebugLevel");
// If we allow multiple instances of the viewer to start the voice
// daemon, set TEMPORARY random voice port
if (gSavedSettings.getBOOL("VoiceMultiInstance"))
{
LLControlVariable* voice_port = gSavedSettings.getControl("VoicePort");
if (voice_port)
{
const BOOL DO_NOT_PERSIST = FALSE;
S32 port_nr = 30000 + ll_rand(20000);
voice_port->setValue(LLSD(port_nr), DO_NOT_PERSIST);
}
}
if(loglevel.empty())
{
@@ -1694,6 +1716,12 @@ void LLVoiceClient::stateMachine()
args += " -ll ";
args += loglevel;
// Tell voice gateway to listen to a specific port
if (gSavedSettings.getBOOL("VoiceMultiInstance"))
{
args += llformat(" -i 127.0.0.1:%u", gSavedSettings.getU32("VoicePort"));
}
LL_DEBUGS("Voice") << "Args for SLVoice: " << args << LL_ENDL;