diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 0136e3656..a3a0880ee 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -15403,6 +15403,17 @@ This should be as low as possible, but too low may break functionality Value 44125 + VoiceMultiInstance + + Comment + Allow multiple viewers to have the voice enabled at the same time + Persist + 1 + Type + Boolean + Value + 0 + WLSkyDetail Comment diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 2777da456..76ba4b9cb 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -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); diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index d7761909a..43a12d5c9 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -1313,7 +1313,16 @@ void LLVoiceClient::connectorCreate() << "" << "V2 SDK" << "" << mVoiceAccountServerURI << "" - << "Normal" + << "Normal"; + + if (gSavedSettings.getBOOL("VoiceMultiInstance")) + { + stream + << "30000" + << "50000"; + } + + stream << "" << "" << logpath << "" << "Connector" @@ -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;