From 03593762833c1b9fbac8932d5a8a99dd90be03bb Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Fri, 16 Dec 2022 19:46:48 -0500 Subject: [PATCH] Fix voice --- indra/newview/llvoicevivox.cpp | 40 +++++++++++----------------------- 1 file changed, 13 insertions(+), 27 deletions(-) diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 6d902f92a24..04260676a39 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -947,21 +947,6 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon() LLProcess::Params params; params.executable = exe_path; - // VOICE-88: Cycle through [portbase..portbase+portrange) on - // successive tries because attempting to relaunch (after manually - // disabling and then re-enabling voice) with the same port can - // cause SLVoice's bind() call to fail with EADDRINUSE. We expect - // that eventually the OS will time out previous ports, which is - // why we cycle instead of incrementing indefinitely. - U32 portbase = gSavedSettings.getU32("VivoxVoicePort"); - static U32 portoffset = 0; - static const U32 portrange = 100; - std::string host(gSavedSettings.getString("VivoxVoiceHost")); - U32 port = portbase + portoffset; - portoffset = (portoffset + 1) % portrange; - params.args.add("-i"); - params.args.add(STRINGIZE(host << ':' << port)); - std::string loglevel = gSavedSettings.getString("VivoxDebugLevel"); if (loglevel.empty()) { @@ -970,18 +955,6 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon() params.args.add("-ll"); params.args.add(loglevel); - if (gSavedSettings.getBOOL("VoiceMultiInstance")) - { - S32 port_nr = 30000 + ll_rand(20000); - LLControlVariable* voice_port = gSavedSettings.getControl("VivoxVoicePort"); - if (voice_port) - { - voice_port->setValue(LLSD(port_nr), false); - params.args.add("-i"); - params.args.add(llformat("127.0.0.1:%u", gSavedSettings.getU32("VivoxVoicePort"))); - } - } - std::string log_folder = gSavedSettings.getString("VivoxLogDirectory"); if (log_folder.empty()) @@ -1017,6 +990,18 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon() params.args.add("-st"); params.args.add(shutdown_timeout); } + if (gSavedSettings.getBOOL("VoiceMultiInstance")) + { + S32 port_nr = 30000 + ll_rand(20000); + LLControlVariable* voice_port = gSavedSettings.getControl("VivoxVoicePort"); + if (voice_port) + { + voice_port->setValue(LLSD(port_nr), false); + params.args.add("-i"); + params.args.add(llformat("127.0.0.1:%u", gSavedSettings.getU32("VivoxVoicePort"))); + } + } + params.cwd = gDirUtilp->getAppRODataDir(); #ifndef LL_LINUX @@ -1038,6 +1023,7 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon() sGatewayPtr = LLProcess::create(params); mDaemonHost = LLHost(host.c_str(), port); + mDaemonHost = LLHost(gSavedSettings.getString("VivoxVoiceHost").c_str(), gSavedSettings.getU32("VivoxVoicePort")); } else { -- GitLab