From 17bb7f4fc5463e9426179b0ded810b51ef291c79 Mon Sep 17 00:00:00 2001
From: Oz Linden <oz@lindenlab.com>
Date: Fri, 9 Mar 2018 09:05:42 -0500
Subject: improve logging around setup and teardown

---
 indra/newview/llvoicevivox.cpp | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index 627b83818f..93a176d435 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -731,6 +731,7 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon()
     if (!voiceEnabled())
     {
         // Voice is locked out, we must not launch the vivox daemon.
+        LL_WARNS("Voice") << "voice disabled; not starting daemon" << LL_ENDL;
         return false;
     }
 
@@ -889,12 +890,14 @@ bool LLVivoxVoiceClient::provisionVoiceAccount()
     LL_INFOS("Voice") << "Provisioning voice account." << LL_ENDL;
     while (!gAgent.getRegion())
     {
+        LL_DEBUGS("Voice") << "no region for voice provisioning; waiting " << LL_ENDL;
         // *TODO* Set up a call back on agent that sends a message to a pump we can use to wake up.
         llcoro::suspend();
     }
 
     while (!gAgent.getRegion()->capabilitiesReceived())
     {
+        LL_DEBUGS("Voice") << "no capabilities for voice provisioning; waiting " << LL_ENDL;
         // *TODO* Pump a message for wake up.
         llcoro::suspend();
     }
@@ -1279,17 +1282,30 @@ bool LLVivoxVoiceClient::requestParcelVoiceInfo()
         LLSD voice_credentials = result["voice_credentials"];
         if (voice_credentials.has("channel_uri"))
         {
+            LL_DEBUGS("Voice") << "got voice channel uri" << LL_ENDL;
             uri = voice_credentials["channel_uri"].asString();
         }
+        else
+        {
+            LL_WARNS("Voice") << "No voice channel uri" << LL_ENDL;
+        }
+        
         if (voice_credentials.has("channel_credentials"))
         {
+            LL_DEBUGS("Voice") << "got voice channel credentials" << LL_ENDL;
             credentials =
                 voice_credentials["channel_credentials"].asString();
         }
-    }
+        else
+        {
+            LL_WARNS("Voice") << "No voice channel credentials" << LL_ENDL;
 
-    if (!uri.empty())
-        LL_INFOS("Voice") << "Voice URI is " << uri << LL_ENDL;
+        }
+    }
+    else
+    {
+        LL_WARNS("Voice") << "No voice credentials" << LL_ENDL;
+    }
 
     // set the spatial channel.  If no voice credentials or uri are 
     // available, then we simply drop out of voice spatially.
@@ -1633,8 +1649,10 @@ bool LLVivoxVoiceClient::waitForChannel()
 
         if (mRelogRequested)
         {
+            LL_DEBUGS("Voice") << "Relog Requested, restarting provisioning" << LL_ENDL;
             if (!provisionVoiceAccount())
             {
+                LL_WARNS("Voice") << "provisioning voice failed; giving up" << LL_ENDL;
                 giveUp();
                 return false;
             }
-- 
cgit v1.2.3


From 73b44833a6a801a7bc72810664557e559d54575d Mon Sep 17 00:00:00 2001
From: Oz Linden <oz@lindenlab.com>
Date: Fri, 13 Apr 2018 20:34:10 -0400
Subject: VOICE-59: display human-friendly names for voice input and output
 devices

---
 indra/newview/llpanelvoicedevicesettings.cpp | 21 ++++++++++++++---
 indra/newview/llvoicevivox.cpp               | 35 ++++++++++++++++++++--------
 indra/newview/llvoicevivox.h                 |  4 ++--
 3 files changed, 45 insertions(+), 15 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llpanelvoicedevicesettings.cpp b/indra/newview/llpanelvoicedevicesettings.cpp
index 07f8045546..3dfa559dac 100644
--- a/indra/newview/llpanelvoicedevicesettings.cpp
+++ b/indra/newview/llpanelvoicedevicesettings.cpp
@@ -38,7 +38,8 @@
 
 // Library includes (after viewer)
 #include "lluictrlfactory.h"
-
+#include "llmemorystream.h"
+#include "llsdserialize.h"
 
 static LLPanelInjector<LLPanelVoiceDeviceSettings> t_panel_group_general("panel_voice_device_settings");
 static const std::string DEFAULT_DEVICE("Default");
@@ -244,7 +245,14 @@ void LLPanelVoiceDeviceSettings::refresh()
 				iter != LLVoiceClient::getInstance()->getCaptureDevices().end();
 				iter++)
 			{
-				mCtrlInputDevices->add(getLocalizedDeviceName(*iter), *iter, ADD_BOTTOM);
+                // the devices in the list are serialized as an LLSD map
+                // deserialize to separate the display and device names
+                std::string device_names(*iter);
+                size_t len = device_names.size();
+                LLMemoryStream device_stream((U8*)device_names.c_str(), len);
+                LLSD device = LLSDSerialize::fromNotation(device_stream, len);
+
+				mCtrlInputDevices->add(getLocalizedDeviceName(device["display"]), device["device"], ADD_BOTTOM);
 			}
 
 			// Fix invalid input audio device preference.
@@ -264,7 +272,14 @@ void LLPanelVoiceDeviceSettings::refresh()
 			for(iter= LLVoiceClient::getInstance()->getRenderDevices().begin(); 
 				iter !=  LLVoiceClient::getInstance()->getRenderDevices().end(); iter++)
 			{
-				mCtrlOutputDevices->add(getLocalizedDeviceName(*iter), *iter, ADD_BOTTOM);
+                // the devices in the list are serialized as an LLSD map
+                // deserialize to separate the display and device names
+                std::string device_names(*iter);
+                size_t len = device_names.size();
+                LLMemoryStream device_stream((U8*)device_names.c_str(), len);
+                LLSD device = LLSDSerialize::fromNotation(device_stream, len);
+
+                mCtrlOutputDevices->add(getLocalizedDeviceName(device["display"]), device["display"], ADD_BOTTOM);
 			}
 
 			// Fix invalid output audio device preference.
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index 8e46e08b14..90e106b000 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -48,6 +48,7 @@
 #include "llviewercontrol.h"
 #include "llappviewer.h"	// for gDisconnected, gDisableVoice
 #include "llprocess.h"
+#include "llsdserialize.h"
 
 // Viewer includes
 #include "llmutelist.h"  // to check for muted avatars
@@ -1964,6 +1965,7 @@ bool LLVivoxVoiceClient::performMicTuning()
 
                 if (mTuningSpeakerVolumeDirty)
                 {
+                    LL_INFOS("Voice") << "setting tuning speaker level to " << mTuningSpeakerVolume << LL_ENDL;
                     stream
                         << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetSpeakerLevel.1\">"
                         << "<Level>" << mTuningSpeakerVolume << "</Level>"
@@ -2321,11 +2323,15 @@ void LLVivoxVoiceClient::clearCaptureDevices()
 	mCaptureDevices.clear();
 }
 
-void LLVivoxVoiceClient::addCaptureDevice(const std::string& name)
+void LLVivoxVoiceClient::addCaptureDevice(const std::string& display_name, const std::string& device_name)
 {
-	LL_DEBUGS("Voice") << name << LL_ENDL;
-
-	mCaptureDevices.push_back(name);
+	LL_DEBUGS("Voice") << "display: '" << display_name << "' device: '" << device_name << "'" << LL_ENDL;
+    LLSD device(LLSD::emptyMap());
+    device["display"]=display_name;
+    device["device"]=device_name;
+    std::ostringstream device_names;
+    LLSDSerialize::toNotation(device, device_names);
+    mCaptureDevices.push_back(device_names.str());
 }
 
 LLVoiceDeviceList& LLVivoxVoiceClient::getCaptureDevices()
@@ -2363,10 +2369,15 @@ void LLVivoxVoiceClient::clearRenderDevices()
 	mRenderDevices.clear();
 }
 
-void LLVivoxVoiceClient::addRenderDevice(const std::string& name)
+void LLVivoxVoiceClient::addRenderDevice(const std::string& display_name, const std::string& device_name)
 {
-	LL_DEBUGS("Voice") << name << LL_ENDL;
-	mRenderDevices.push_back(name);
+	LL_DEBUGS("Voice") << "display: '" << display_name << "' device: '" << device_name << "'" << LL_ENDL;
+    LLSD device(LLSD::emptyMap());
+    device["display"]=display_name;
+    device["device"]=device_name;
+    std::ostringstream device_names;
+    LLSDSerialize::toNotation(device, device_names);
+    mRenderDevices.push_back(device_names.str());
 }
 
 LLVoiceDeviceList& LLVivoxVoiceClient::getRenderDevices()
@@ -4022,7 +4033,7 @@ void LLVivoxVoiceClient::sessionNotificationEvent(std::string &sessionHandle, st
 
 void LLVivoxVoiceClient::auxAudioPropertiesEvent(F32 energy)
 {
-	LL_DEBUGS("Voice") << "got energy " << energy << LL_ENDL;
+	LL_DEBUGS("VoiceEnergy") << "got energy " << energy << LL_ENDL;
 	mTuningEnergy = energy;
 }
 
@@ -7006,16 +7017,20 @@ void LLVivoxProtocolParser::EndTag(const char *tag)
 		else if (!stricmp("Presence", tag))
 			statusString = string;
 		else if (!stricmp("CaptureDevices", tag))
+		{
 			LLVivoxVoiceClient::getInstance()->setDevicesListUpdated(true);
+		}
 		else if (!stricmp("RenderDevices", tag))
+		{
 			LLVivoxVoiceClient::getInstance()->setDevicesListUpdated(true);
+		}
 		else if (!stricmp("CaptureDevice", tag))
 		{
-			LLVivoxVoiceClient::getInstance()->addCaptureDevice(deviceString);
+			LLVivoxVoiceClient::getInstance()->addCaptureDevice(displayNameString, deviceString);
 		}
 		else if (!stricmp("RenderDevice", tag))
 		{
-			LLVivoxVoiceClient::getInstance()->addRenderDevice(deviceString);
+			LLVivoxVoiceClient::getInstance()->addRenderDevice(displayNameString, deviceString);
 		}
 		else if (!stricmp("BlockMask", tag))
 			blockMask = string;
diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h
index 9d4af85c8c..b4cf94444b 100644
--- a/indra/newview/llvoicevivox.h
+++ b/indra/newview/llvoicevivox.h
@@ -432,10 +432,10 @@ protected:
 	//----------------------------------
 	// devices
 	void clearCaptureDevices();
-	void addCaptureDevice(const std::string& name);
+	void addCaptureDevice(const std::string& display_name, const std::string& device_name);
 	void clearRenderDevices();
 	void setDevicesListUpdated(bool state);
-	void addRenderDevice(const std::string& name);	
+	void addRenderDevice(const std::string& display_name, const std::string& device_name);	
 	void buildSetAudioDevices(std::ostringstream &stream);
 	
 	void getCaptureDevicesSendMessage();
-- 
cgit v1.2.3


From 4ab4bfb2c7bd79a89b347969c7812db366538ed9 Mon Sep 17 00:00:00 2001
From: Oz Linden <oz@lindenlab.com>
Date: Sun, 15 Apr 2018 09:41:47 -0400
Subject: VOICE-59: better fix for display human-friendly names for voice input
 and output devices

---
 indra/newview/llpanelvoicedevicesettings.cpp | 33 ++++++++--------------------
 indra/newview/llvoiceclient.h                | 15 +++++++++++--
 indra/newview/llvoicevivox.cpp               | 33 ++++++++++------------------
 indra/newview/llvoicevivox.h                 |  4 ++--
 4 files changed, 35 insertions(+), 50 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llpanelvoicedevicesettings.cpp b/indra/newview/llpanelvoicedevicesettings.cpp
index 3dfa559dac..28631e2b7b 100644
--- a/indra/newview/llpanelvoicedevicesettings.cpp
+++ b/indra/newview/llpanelvoicedevicesettings.cpp
@@ -38,8 +38,6 @@
 
 // Library includes (after viewer)
 #include "lluictrlfactory.h"
-#include "llmemorystream.h"
-#include "llsdserialize.h"
 
 static LLPanelInjector<LLPanelVoiceDeviceSettings> t_panel_group_general("panel_voice_device_settings");
 static const std::string DEFAULT_DEVICE("Default");
@@ -234,25 +232,18 @@ void LLPanelVoiceDeviceSettings::refresh()
 	}
 	else if (LLVoiceClient::getInstance()->deviceSettingsUpdated())
 	{
-		LLVoiceDeviceList::const_iterator iter;
+		LLVoiceDeviceList::const_iterator device;
 		
 		if(mCtrlInputDevices)
 		{
 			mCtrlInputDevices->removeall();
 			mCtrlInputDevices->add(getLocalizedDeviceName(DEFAULT_DEVICE), DEFAULT_DEVICE, ADD_BOTTOM);
 
-			for(iter=LLVoiceClient::getInstance()->getCaptureDevices().begin(); 
-				iter != LLVoiceClient::getInstance()->getCaptureDevices().end();
-				iter++)
+			for(device=LLVoiceClient::getInstance()->getCaptureDevices().begin(); 
+				device != LLVoiceClient::getInstance()->getCaptureDevices().end();
+				device++)
 			{
-                // the devices in the list are serialized as an LLSD map
-                // deserialize to separate the display and device names
-                std::string device_names(*iter);
-                size_t len = device_names.size();
-                LLMemoryStream device_stream((U8*)device_names.c_str(), len);
-                LLSD device = LLSDSerialize::fromNotation(device_stream, len);
-
-				mCtrlInputDevices->add(getLocalizedDeviceName(device["display"]), device["device"], ADD_BOTTOM);
+				mCtrlInputDevices->add(getLocalizedDeviceName(device->display_name), device->full_name, ADD_BOTTOM);
 			}
 
 			// Fix invalid input audio device preference.
@@ -269,17 +260,11 @@ void LLPanelVoiceDeviceSettings::refresh()
 			mCtrlOutputDevices->removeall();
 			mCtrlOutputDevices->add(getLocalizedDeviceName(DEFAULT_DEVICE), DEFAULT_DEVICE, ADD_BOTTOM);
 
-			for(iter= LLVoiceClient::getInstance()->getRenderDevices().begin(); 
-				iter !=  LLVoiceClient::getInstance()->getRenderDevices().end(); iter++)
+			for(device = LLVoiceClient::getInstance()->getRenderDevices().begin(); 
+				device !=  LLVoiceClient::getInstance()->getRenderDevices().end();
+                device++)
 			{
-                // the devices in the list are serialized as an LLSD map
-                // deserialize to separate the display and device names
-                std::string device_names(*iter);
-                size_t len = device_names.size();
-                LLMemoryStream device_stream((U8*)device_names.c_str(), len);
-                LLSD device = LLSDSerialize::fromNotation(device_stream, len);
-
-                mCtrlOutputDevices->add(getLocalizedDeviceName(device["display"]), device["display"], ADD_BOTTOM);
+                mCtrlOutputDevices->add(getLocalizedDeviceName(device->display_name), device->full_name, ADD_BOTTOM);
 			}
 
 			// Fix invalid output audio device preference.
diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h
index 32637dcf42..337f01f3e5 100644
--- a/indra/newview/llvoiceclient.h
+++ b/indra/newview/llvoiceclient.h
@@ -40,8 +40,19 @@ class LLVOAvatar;
 
 // devices
 
-typedef std::vector<std::string> LLVoiceDeviceList;	
-
+class LLVoiceDevice
+{
+  public:
+    std::string display_name; // friendly value for the user
+    std::string full_name;  // internal value for selection
+
+    LLVoiceDevice(const std::string& display_name, const std::string& full_name)
+        :display_name(display_name)
+        ,full_name(full_name)
+    {
+    };
+};
+typedef std::vector<LLVoiceDevice> LLVoiceDeviceList;
 
 class LLVoiceClientParticipantObserver
 {
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index 90e106b000..741c04ac8b 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -48,7 +48,6 @@
 #include "llviewercontrol.h"
 #include "llappviewer.h"	// for gDisconnected, gDisableVoice
 #include "llprocess.h"
-#include "llsdserialize.h"
 
 // Viewer includes
 #include "llmutelist.h"  // to check for muted avatars
@@ -2323,15 +2322,10 @@ void LLVivoxVoiceClient::clearCaptureDevices()
 	mCaptureDevices.clear();
 }
 
-void LLVivoxVoiceClient::addCaptureDevice(const std::string& display_name, const std::string& device_name)
+void LLVivoxVoiceClient::addCaptureDevice(const LLVoiceDevice& device)
 {
-	LL_DEBUGS("Voice") << "display: '" << display_name << "' device: '" << device_name << "'" << LL_ENDL;
-    LLSD device(LLSD::emptyMap());
-    device["display"]=display_name;
-    device["device"]=device_name;
-    std::ostringstream device_names;
-    LLSDSerialize::toNotation(device, device_names);
-    mCaptureDevices.push_back(device_names.str());
+	LL_DEBUGS("Voice") << "display: '" << device.display_name << "' device: '" << device.full_name << "'" << LL_ENDL;
+    mCaptureDevices.push_back(device);
 }
 
 LLVoiceDeviceList& LLVivoxVoiceClient::getCaptureDevices()
@@ -2369,15 +2363,10 @@ void LLVivoxVoiceClient::clearRenderDevices()
 	mRenderDevices.clear();
 }
 
-void LLVivoxVoiceClient::addRenderDevice(const std::string& display_name, const std::string& device_name)
+void LLVivoxVoiceClient::addRenderDevice(const LLVoiceDevice& device)
 {
-	LL_DEBUGS("Voice") << "display: '" << display_name << "' device: '" << device_name << "'" << LL_ENDL;
-    LLSD device(LLSD::emptyMap());
-    device["display"]=display_name;
-    device["device"]=device_name;
-    std::ostringstream device_names;
-    LLSDSerialize::toNotation(device, device_names);
-    mRenderDevices.push_back(device_names.str());
+	LL_DEBUGS("Voice") << "display: '" << device.display_name << "' device: '" << device.full_name << "'" << LL_ENDL;
+    mRenderDevices.push_back(device);
 }
 
 LLVoiceDeviceList& LLVivoxVoiceClient::getRenderDevices()
@@ -2525,13 +2514,13 @@ bool LLVivoxVoiceClient::deviceSettingsAvailable()
 }
 bool LLVivoxVoiceClient::deviceSettingsUpdated()
 {
+    bool updated = mDevicesListUpdated;
 	if (mDevicesListUpdated)
 	{
 		// a hot swap event or a polling of the audio devices has been parsed since the last redraw of the input and output device panel.
-		mDevicesListUpdated = !mDevicesListUpdated; // toggle the setting
-		return true;
+		mDevicesListUpdated = false; // toggle the setting
 	}
-	return false;		
+	return updated;		
 }
 
 void LLVivoxVoiceClient::refreshDeviceLists(bool clearCurrentList)
@@ -7026,11 +7015,11 @@ void LLVivoxProtocolParser::EndTag(const char *tag)
 		}
 		else if (!stricmp("CaptureDevice", tag))
 		{
-			LLVivoxVoiceClient::getInstance()->addCaptureDevice(displayNameString, deviceString);
+			LLVivoxVoiceClient::getInstance()->addCaptureDevice(LLVoiceDevice(displayNameString, deviceString));
 		}
 		else if (!stricmp("RenderDevice", tag))
 		{
-			LLVivoxVoiceClient::getInstance()->addRenderDevice(displayNameString, deviceString);
+			LLVivoxVoiceClient::getInstance()->addRenderDevice(LLVoiceDevice(displayNameString, deviceString));
 		}
 		else if (!stricmp("BlockMask", tag))
 			blockMask = string;
diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h
index b4cf94444b..50862cea1e 100644
--- a/indra/newview/llvoicevivox.h
+++ b/indra/newview/llvoicevivox.h
@@ -432,10 +432,10 @@ protected:
 	//----------------------------------
 	// devices
 	void clearCaptureDevices();
-	void addCaptureDevice(const std::string& display_name, const std::string& device_name);
+	void addCaptureDevice(const LLVoiceDevice& device);
 	void clearRenderDevices();
 	void setDevicesListUpdated(bool state);
-	void addRenderDevice(const std::string& display_name, const std::string& device_name);	
+	void addRenderDevice(const LLVoiceDevice& device);	
 	void buildSetAudioDevices(std::ostringstream &stream);
 	
 	void getCaptureDevicesSendMessage();
-- 
cgit v1.2.3


From 14dc84cc83e2308725fd9a20c391cbfb7455bdd1 Mon Sep 17 00:00:00 2001
From: Oz Linden <oz@lindenlab.com>
Date: Sun, 15 Apr 2018 12:17:32 -0400
Subject: logging changes for diagnosing startup connection issue

---
 indra/newview/llvoicevivox.cpp | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index 741c04ac8b..546d437769 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -283,7 +283,7 @@ LLVivoxVoiceClient::LLVivoxVoiceClient() :
 	mDevicesListUpdated(false),
 
 	mAreaVoiceDisabled(false),
-	mAudioSession(),
+	mAudioSession(), // TBD - should be NULL
 	mAudioSessionChanged(false),
 	mNextAudioSession(),
 
@@ -713,6 +713,7 @@ bool LLVivoxVoiceClient::endAndDisconnectSession()
 
 bool LLVivoxVoiceClient::callbackEndDaemon(const LLSD& data)
 {
+    LL_DEBUGS("Voice") << LL_ENDL;
     if (!LLAppViewer::isExiting())
     {
         terminateAudioSession(false);
@@ -1253,6 +1254,10 @@ bool LLVivoxVoiceClient::requestParcelVoiceInfo()
         // state.  If the cap request is still pending,
         // the responder will check to see if we've moved
         // to a new session and won't change any state.
+        LL_DEBUGS("Voice") << "terminate requested " << mSessionTerminateRequested
+                           << " enabled " << mVoiceEnabled
+                           << " initialized " << mIsInitialized
+                           << LL_ENDL;
         terminateAudioSession(true);
         return false;
     }
@@ -1360,7 +1365,10 @@ bool LLVivoxVoiceClient::addAndJoinSession(const sessionStatePtr_t &nextSession)
 
     if (!mVoiceEnabled && mIsInitialized)
     {
-        LL_DEBUGS("Voice") << "Voice no longer enabled. Exiting." << LL_ENDL;
+        LL_DEBUGS("Voice") << "Voice no longer enabled. Exiting"
+                           << " enabled " << mVoiceEnabled
+                           << " initialized " << mIsInitialized
+                           << LL_ENDL;
         mIsJoiningSession = false;
         // User bailed out during connect -- jump straight to teardown.
         terminateAudioSession(true);
@@ -1667,6 +1675,7 @@ bool LLVivoxVoiceClient::runSession(const sessionStatePtr_t &session)
 
         if (mSessionTerminateRequested)
         {
+            LL_DEBUGS("Voice") << "terminate requested " << LL_ENDL;
             terminateAudioSession(true);
         }
         // if a relog has been requested then addAndJoineSession 
@@ -1769,6 +1778,7 @@ bool LLVivoxVoiceClient::runSession(const sessionStatePtr_t &session)
     }
 
     mIsInChannel = false;
+    LL_DEBUGS("Voice") << "terminating at end of runSession" << LL_ENDL;
     terminateAudioSession(true);
 
     return true;
-- 
cgit v1.2.3


From 77344afa8b39b4c1fcebda4de63998a67fd4debb Mon Sep 17 00:00:00 2001
From: Oz Linden <oz@lindenlab.com>
Date: Tue, 29 May 2018 11:46:03 -0400
Subject: additional debug logging for voice startup

---
 indra/newview/llvoicevivox.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index 546d437769..f6cde58f86 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -716,6 +716,7 @@ bool LLVivoxVoiceClient::callbackEndDaemon(const LLSD& data)
     LL_DEBUGS("Voice") << LL_ENDL;
     if (!LLAppViewer::isExiting())
     {
+        LL_DEBUGS("Voice") << "callbackEndDaemon terminating audio session" << LL_ENDL;
         terminateAudioSession(false);
         closeSocket();
         cleanUp();
@@ -1486,7 +1487,7 @@ bool LLVivoxVoiceClient::terminateAudioSession(bool wait)
 
     if (mAudioSession)
     {
-        LL_INFOS("Voice") << "Terminating current voice session " << mAudioSession->mHandle << LL_ENDL;
+        LL_INFOS("Voice") << "terminateAudioSession(" << wait << ") Terminating current voice session " << mAudioSession->mHandle << LL_ENDL;
 
         if (mIsLoggedIn)
         {
@@ -1560,7 +1561,7 @@ bool LLVivoxVoiceClient::terminateAudioSession(bool wait)
     }
     else
     {
-        LL_WARNS("Voice") << "stateSessionTerminated with NULL mAudioSession" << LL_ENDL;
+        LL_WARNS("Voice") << "terminateAudioSession(" << wait << ") with NULL mAudioSession" << LL_ENDL;
     }
 
     notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL);
@@ -1675,7 +1676,7 @@ bool LLVivoxVoiceClient::runSession(const sessionStatePtr_t &session)
 
         if (mSessionTerminateRequested)
         {
-            LL_DEBUGS("Voice") << "terminate requested " << LL_ENDL;
+            LL_DEBUGS("Voice") << "runSession terminate requested " << LL_ENDL;
             terminateAudioSession(true);
         }
         // if a relog has been requested then addAndJoineSession 
@@ -2911,7 +2912,6 @@ void LLVivoxVoiceClient::sendPositionAndVolumeUpdate(void)
 		}
 	}
 
-	//sendLocalAudioUpdates();  obsolete, used to send volume setting on position updates
     std::string update(stream.str());
 	if(!update.empty())
 	{
-- 
cgit v1.2.3


From 711cd0d10fc5e1895eac4fe6e1ca224fa7fcae6c Mon Sep 17 00:00:00 2001
From: Oz Linden <oz@lindenlab.com>
Date: Wed, 27 Jun 2018 09:44:54 -0400
Subject: add more startup debug logging

---
 indra/newview/llvoicevivox.cpp | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index fe61c94f7a..43c390ca5f 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -806,13 +806,15 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon()
             params.postend = sGatewayPump.getName();
             sGatewayPump.listen("VivoxDaemonPump", boost::bind(&LLVivoxVoiceClient::callbackEndDaemon, this, _1));
 
+            LL_INFOS("Voice") << "Launching SLVoice " << LL_ENDL;
+
             sGatewayPtr = LLProcess::create(params);
 
             mDaemonHost = LLHost(gSavedSettings.getString("VivoxVoiceHost").c_str(), gSavedSettings.getU32("VivoxVoicePort"));
         }
         else
         {
-            LL_INFOS("Voice") << exe_path << " not found." << LL_ENDL;
+            LL_WARNS("Voice") << exe_path << " not found." << LL_ENDL;
             return false;
         }
 #else
@@ -896,7 +898,6 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon()
 bool LLVivoxVoiceClient::provisionVoiceAccount()
 {
     LL_INFOS("Voice") << "Provisioning voice account." << LL_ENDL;
-        LL_DEBUGS("Voice") << "no region for voice provisioning; waiting " << LL_ENDL;
 
     while (!gAgent.getRegion() || !gAgent.getRegion()->capabilitiesReceived())
     {
@@ -907,6 +908,8 @@ bool LLVivoxVoiceClient::provisionVoiceAccount()
 
     std::string url = gAgent.getRegionCapability("ProvisionVoiceAccountRequest");
 
+    LL_DEBUGS("Voice") << "region ready for voice provisioning; url=" << url << LL_ENDL;
+
     LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
     LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
         httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("voiceAccountProvision", httpPolicy));
@@ -954,7 +957,7 @@ bool LLVivoxVoiceClient::provisionVoiceAccount()
     std::string voiceUserName = result["username"].asString();
     std::string voicePassword = result["password"].asString();
 
-    //LL_DEBUGS("Voice") << "ProvisionVoiceAccountRequest response:" << dumpResponse() << LL_ENDL;
+    LL_DEBUGS("Voice") << "ProvisionVoiceAccountRequest response:" << dumpResponse() << LL_ENDL;
 
     if (result.has("voice_sip_uri_hostname"))
         voiceSipUriHostname = result["voice_sip_uri_hostname"].asString();
@@ -973,8 +976,11 @@ bool LLVivoxVoiceClient::establishVoiceConnection()
     LLEventPump &voiceConnectPump = LLEventPumps::instance().obtain("vivoxClientPump");
 
     if (!mVoiceEnabled && mIsInitialized)
+    {
+        LL_WARNS("Voice") << "cannot establish connection; enabled "<<mVoiceEnabled<<" initialized "<<mIsInitialized<<LL_ENDL;
         return false;
-
+    }
+    
     LLSD result;
     bool connected(false);
     bool giving_up(false);
@@ -2569,8 +2575,7 @@ void LLVivoxVoiceClient::daemonDied()
 	// The daemon died, so the connection is gone.  Reset everything and start over.
 	LL_WARNS("Voice") << "Connection to vivox daemon lost.  Resetting state."<< LL_ENDL;
 
-	// Try to relaunch the daemon
-    /*TODO:*/
+	//TODO: Try to relaunch the daemon
 }
 
 void LLVivoxVoiceClient::giveUp()
@@ -2975,7 +2980,8 @@ void LLVivoxVoiceClient::sendLocalAudioUpdates()
 {
 	// Check all of the dirty states and then send messages to those needing to be changed.
 	// Tuningmode hands its own mute settings.
-
+    LL_DEBUGS("Voice")<<LL_ENDL;
+    
 	std::ostringstream stream;
 
 	if (mMuteMicDirty && !mTuningMode)
@@ -2984,7 +2990,7 @@ void LLVivoxVoiceClient::sendLocalAudioUpdates()
 
 		// Send a local mute command.
 
-		LL_DEBUGS("Voice") << "Sending MuteLocalMic command with parameter " << (mMuteMic ? "true" : "false") << LL_ENDL;
+		LL_INFOS("Voice") << "Sending MuteLocalMic command with parameter " << (mMuteMic ? "true" : "false") << LL_ENDL;
 
 		stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.MuteLocalMic.1\">"
 			<< "<ConnectorHandle>" << LLVivoxSecurity::getInstance()->connectorHandle() << "</ConnectorHandle>"
@@ -3246,8 +3252,6 @@ void LLVivoxVoiceClient::sessionConnectResponse(std::string &requestId, int stat
 	{
 		LL_DEBUGS("Voice") << "Session.Connect response received (success)" << LL_ENDL;
 	}
-
-    /*TODO: Post response?*/
 }
 
 void LLVivoxVoiceClient::logoutResponse(int statusCode, std::string &statusString)
-- 
cgit v1.2.3


From 04fecd480247a86e597483beaee66deb9efb3aad Mon Sep 17 00:00:00 2001
From: Oz Linden <oz@lindenlab.com>
Date: Wed, 27 Jun 2018 14:46:59 -0400
Subject: fix provisioning debug log

---
 indra/newview/llvoicevivox.cpp | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index 43c390ca5f..3b56076463 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -957,14 +957,23 @@ bool LLVivoxVoiceClient::provisionVoiceAccount()
     std::string voiceUserName = result["username"].asString();
     std::string voicePassword = result["password"].asString();
 
-    LL_DEBUGS("Voice") << "ProvisionVoiceAccountRequest response:" << dumpResponse() << LL_ENDL;
-
     if (result.has("voice_sip_uri_hostname"))
+    {
         voiceSipUriHostname = result["voice_sip_uri_hostname"].asString();
-
+    }
+    
     // this key is actually misnamed -- it will be an entire URI, not just a hostname.
     if (result.has("voice_account_server_name"))
+    {
         voiceAccountServerUri = result["voice_account_server_name"].asString();
+    }
+
+    LL_DEBUGS("Voice") << "ProvisionVoiceAccountRequest response"
+                       << " user " << (voiceUserName.empty() ? "not set" : "set")
+                       << " password " << (voicePassword.empty() ? "not set" : "set")
+                       << " sip uri " voiceSipUriHostname
+                       << " account uri " voiceAccountServerUri
+                       << LL_ENDL;
 
     setLoginInfo(voiceUserName, voicePassword, voiceSipUriHostname, voiceAccountServerUri);
 
-- 
cgit v1.2.3


From d9c59488f45a7fc03030b0e69293c2679e67c9f1 Mon Sep 17 00:00:00 2001
From: Oz Linden <oz@lindenlab.com>
Date: Wed, 27 Jun 2018 16:21:10 -0400
Subject: fix debug logging

---
 indra/newview/llvoicevivox.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index 3b56076463..65fa2b9c6d 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -971,8 +971,8 @@ bool LLVivoxVoiceClient::provisionVoiceAccount()
     LL_DEBUGS("Voice") << "ProvisionVoiceAccountRequest response"
                        << " user " << (voiceUserName.empty() ? "not set" : "set")
                        << " password " << (voicePassword.empty() ? "not set" : "set")
-                       << " sip uri " voiceSipUriHostname
-                       << " account uri " voiceAccountServerUri
+                       << " sip uri " << voiceSipUriHostname
+                       << " account uri " << voiceAccountServerUri
                        << LL_ENDL;
 
     setLoginInfo(voiceUserName, voicePassword, voiceSipUriHostname, voiceAccountServerUri);
-- 
cgit v1.2.3


From dbbeeed6f4459a8016dbb8800af4def85ab4fcea Mon Sep 17 00:00:00 2001
From: Oz Linden <oz@lindenlab.com>
Date: Sun, 29 Jul 2018 09:49:55 -0400
Subject: retrigger build

---
 indra/edit-me-to-trigger-new-build.txt | 1 +
 1 file changed, 1 insertion(+)

(limited to 'indra')

diff --git a/indra/edit-me-to-trigger-new-build.txt b/indra/edit-me-to-trigger-new-build.txt
index 139597f9cb..b28b04f643 100644
--- a/indra/edit-me-to-trigger-new-build.txt
+++ b/indra/edit-me-to-trigger-new-build.txt
@@ -1,2 +1,3 @@
 
 
+
-- 
cgit v1.2.3


From c339894390af70b32cef3fca258b9a19ce4aeb20 Mon Sep 17 00:00:00 2001
From: Oz Linden <oz@lindenlab.com>
Date: Thu, 2 Aug 2018 10:00:34 -0400
Subject: additional logging around launch/termination of SLVoice

---
 indra/newview/llvoicevivox.cpp | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index 65fa2b9c6d..858f71e151 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -722,7 +722,7 @@ bool LLVivoxVoiceClient::callbackEndDaemon(const LLSD& data)
     LL_DEBUGS("Voice") << LL_ENDL;
     if (!LLAppViewer::isExiting())
     {
-        LL_DEBUGS("Voice") << "callbackEndDaemon terminating audio session" << LL_ENDL;
+        LL_DEBUGS("Voice") << "SLVoice terminated " << ll_stream_notation_sd(data) << LL_ENDL;
         terminateAudioSession(false);
         closeSocket();
         cleanUp();
@@ -747,11 +747,6 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon()
     {
 #ifndef VIVOXDAEMON_REMOTEHOST
         // Launch the voice daemon
-
-        // *FIX:Mani - Using the executable dir instead 
-        // of mAppRODataDir, the working directory from which the app
-        // is launched.
-        //std::string exe_path = gDirUtilp->getAppRODataDir();
         std::string exe_path = gDirUtilp->getExecutableDir();
         exe_path += gDirUtilp->getDirDelimiter();
 #if LL_WINDOWS
@@ -806,7 +801,8 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon()
             params.postend = sGatewayPump.getName();
             sGatewayPump.listen("VivoxDaemonPump", boost::bind(&LLVivoxVoiceClient::callbackEndDaemon, this, _1));
 
-            LL_INFOS("Voice") << "Launching SLVoice " << LL_ENDL;
+            LL_INFOS("Voice") << "Launching SLVoice" << LL_ENDL;
+            LL_DEBUGS("Voice") << "SLVoice params " << params << LL_ENDL;
 
             sGatewayPtr = LLProcess::create(params);
 
-- 
cgit v1.2.3


From 30b8068c97e6d3fffe43bf90286fccbad158277f Mon Sep 17 00:00:00 2001
From: Oz Linden <oz@lindenlab.com>
Date: Fri, 10 Aug 2018 09:51:48 -0400
Subject: VOICE-50 VOICE-58: recover from SLVoice process exit automatically

---
 indra/newview/llvoiceclient.cpp |   8 +-
 indra/newview/llvoicevivox.cpp  | 166 +++++++++++++++++++++++++++++-----------
 2 files changed, 128 insertions(+), 46 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp
index 503815e2ed..e1dca4ae43 100644
--- a/indra/newview/llvoiceclient.cpp
+++ b/indra/newview/llvoiceclient.cpp
@@ -79,7 +79,7 @@ LLVoiceHandler gVoiceHandler;
 
 std::string LLVoiceClientStatusObserver::status2string(LLVoiceClientStatusObserver::EStatusType inStatus)
 {
-	std::string result = "UNKNOWN";
+	std::string result = "UNTRANSLATED";
 	
 	// Prevent copy-paste errors when updating this list...
 #define CASE(x)  case x:  result = #x;  break
@@ -92,12 +92,18 @@ std::string LLVoiceClientStatusObserver::status2string(LLVoiceClientStatusObserv
 			CASE(STATUS_JOINED);
 			CASE(STATUS_LEFT_CHANNEL);
 			CASE(STATUS_VOICE_DISABLED);
+			CASE(STATUS_VOICE_ENABLED);
 			CASE(BEGIN_ERROR_STATUS);
 			CASE(ERROR_CHANNEL_FULL);
 			CASE(ERROR_CHANNEL_LOCKED);
 			CASE(ERROR_NOT_AVAILABLE);
 			CASE(ERROR_UNKNOWN);
 		default:
+            {
+                std::ostringstream stream;
+                stream << "UNKNOWN(" << (int)inStatus << ")";
+                result = stream.str();
+            }
 			break;
 	}
 	
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index da874008c8..b90e09b739 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -99,6 +99,7 @@ namespace {
     const int CONNECT_RETRY_MAX = 3;
 
     const F32 LOGIN_ATTEMPT_TIMEOUT = 30.0f;
+    const F32 LOGOUT_ATTEMPT_TIMEOUT = 5.0f;
     const int LOGIN_RETRY_MAX = 3;
 
     const F32 PROVISION_RETRY_TIMEOUT = 2.0;
@@ -259,9 +260,16 @@ static void killGateway()
 {
 	if (sGatewayPtr)
 	{
+        LL_DEBUGS("Voice") << "SLVoice " << sGatewayPtr->getStatusString() << LL_ENDL;
+
 		sGatewayPump.stopListening("VivoxDaemonPump");
-		sGatewayPtr->kill();
+		sGatewayPtr->kill(__FUNCTION__);
+        sGatewayPtr=NULL;
 	}
+    else
+    {
+        LL_DEBUGS("Voice") << "no gateway" << LL_ENDL;
+    }
 }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////
@@ -416,6 +424,7 @@ void LLVivoxVoiceClient::cleanUp()
 	deleteAllSessions();
 	deleteAllVoiceFonts();
 	deleteVoiceFontTemplates();
+    LL_DEBUGS("Voice") << "exiting" << LL_ENDL;
 }
 
 //---------------------------------------------------
@@ -645,18 +654,18 @@ void LLVivoxVoiceClient::idle(void* user_data)
 // 
 void LLVivoxVoiceClient::voiceControlCoro()
 {
+    LL_DEBUGS("Voice") << "starting" << LL_ENDL;
     mIsCoroutineActive = true;
     LLCoros::set_consuming(true);
 
     while (gAgent.getTeleportState() != LLAgent::TELEPORT_NONE)
     {
-        LL_INFOS("Voice") << "Suspending voiceControlCoro() due to teleport. Tuning: " << mTuningMode << ". Relog: " << mRelogRequested << LL_ENDL;
+        LL_DEBUGS("Voice") << "Suspending voiceControlCoro() momentarily for teleport. Tuning: " << mTuningMode << ". Relog: " << mRelogRequested << LL_ENDL;
         llcoro::suspendUntilTimeout(1.0);
     }
 
     do
     {
-        
         if (startAndConnectSession())
         {
             if (mTuningMode)
@@ -666,6 +675,7 @@ void LLVivoxVoiceClient::voiceControlCoro()
 
             waitForChannel(); // this doesn't normally return unless relog is needed or shutting down
     
+            LL_DEBUGS("Voice") << "lost channel RelogRequested=" << mRelogRequested << LL_ENDL;            
             endAndDisconnectSession();
         }
         
@@ -673,16 +683,23 @@ void LLVivoxVoiceClient::voiceControlCoro()
         // that we attempted to relog into Vivox and were rejected.
         // Rather than just quit out of voice, we will tear it down (above)
         // and then reconstruct the voice connecion from scratch.
+        LL_DEBUGS("Voice")
+            << "disconnected"
+            << " RelogRequested=" << mRelogRequested
+            << LL_ENDL;            
         if (mRelogRequested)
         {
+            LL_INFOS("Voice") << "will attempt to reconnect to voice" << LL_ENDL;
             while (isGatewayRunning() || gAgent.getTeleportState() != LLAgent::TELEPORT_NONE)
             {
+                LL_INFOS("Voice") << "waiting for SLVoice to exit" << LL_ENDL;
                 llcoro::suspendUntilTimeout(1.0);
             }
         }
     }
-    while (mRelogRequested);
+    while (mVoiceEnabled && mRelogRequested);
     mIsCoroutineActive = false;
+    LL_INFOS("Voice") << "exiting" << LL_ENDL;
 }
 
 
@@ -714,6 +731,8 @@ bool LLVivoxVoiceClient::startAndConnectSession()
 
 bool LLVivoxVoiceClient::endAndDisconnectSession()
 {
+    LL_DEBUGS("Voice") << LL_ENDL;
+
     breakVoiceConnection(true);
 
     killGateway();
@@ -723,15 +742,15 @@ bool LLVivoxVoiceClient::endAndDisconnectSession()
 
 bool LLVivoxVoiceClient::callbackEndDaemon(const LLSD& data)
 {
-    LL_DEBUGS("Voice") << LL_ENDL;
-    if (!LLAppViewer::isExiting())
+    if (!LLAppViewer::isExiting() && mVoiceEnabled)
     {
-        LL_DEBUGS("Voice") << "SLVoice terminated " << ll_stream_notation_sd(data) << LL_ENDL;
+        LL_WARNS("Voice") << "SLVoice terminated " << ll_stream_notation_sd(data) << LL_ENDL;
         terminateAudioSession(false);
         closeSocket();
         cleanUp();
         LLVoiceClient::getInstance()->setUserPTTState(false);
         gAgent.setVoiceConnected(false);
+        mRelogRequested = true;
     }
     sGatewayPump.stopListening("VivoxDaemonPump");
     return false;
@@ -837,6 +856,10 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon()
 
         mMainSessionGroupHandle.clear();
     }
+    else
+    {
+        LL_DEBUGS("Voice") << " gateway running; not attempting to start" << LL_ENDL;
+    }
 
     //---------------------------------------------------------------------
     llcoro::suspendUntilTimeout(UPDATE_THROTTLE_SECONDS);
@@ -1051,7 +1074,7 @@ bool LLVivoxVoiceClient::establishVoiceConnection()
 
 bool LLVivoxVoiceClient::breakVoiceConnection(bool corowait)
 {
-    LL_DEBUGS("Voice") << LL_ENDL;
+    LL_DEBUGS("Voice") << "( wait=" << corowait << ")" << LL_ENDL;
     LLEventPump &voicePump = LLEventPumps::instance().obtain("vivoxClientPump");
     bool retval(true);
 
@@ -1060,7 +1083,9 @@ bool LLVivoxVoiceClient::breakVoiceConnection(bool corowait)
 
     if (corowait)
     {
-        LLSD result = llcoro::suspendUntilEventOn(voicePump);
+        LLSD timeoutResult(LLSDMap("connector", "timeout"));
+
+        LLSD result = llcoro::suspendUntilEventOnWithTimeout(voicePump, LOGOUT_ATTEMPT_TIMEOUT, timeoutResult);
         LL_DEBUGS("Voice") << "event=" << ll_stream_notation_sd(result) << LL_ENDL;
 
         retval = result.has("connector");
@@ -1089,6 +1114,7 @@ bool LLVivoxVoiceClient::breakVoiceConnection(bool corowait)
 #endif
     }
 
+    LL_DEBUGS("Voice") << "closing SLVoice socket" << LL_ENDL;
     closeSocket();		// Need to do this now -- bad things happen if the destructor does it later.
     cleanUp();
     mConnected = false;
@@ -1190,31 +1216,35 @@ bool LLVivoxVoiceClient::loginToVivox()
 
 void LLVivoxVoiceClient::logoutOfVivox(bool wait)
 {
+    if (mIsLoggedIn)
+    {
+        // Ensure that we'll re-request provisioning before logging in again
+        mAccountPassword.clear();
+        mVoiceAccountServerURI.clear();
 
-    if (!mIsLoggedIn)
-        return;
-
-    // Ensure that we'll re-request provisioning before logging in again
-    mAccountPassword.clear();
-    mVoiceAccountServerURI.clear();
-
-    logoutSendMessage();
+        logoutSendMessage();
 
-    if (wait)
-    {
-        LLEventPump &voicePump = LLEventPumps::instance().obtain("vivoxClientPump");
-        LLSD timeoutResult(LLSDMap("lougout", "timeout"));
+        if (wait)
+        {
+            LLEventPump &voicePump = LLEventPumps::instance().obtain("vivoxClientPump");
+            LLSD timeoutResult(LLSDMap("logout", "timeout"));
 
-        LLSD result = llcoro::suspendUntilEventOnWithTimeout(voicePump, LOGIN_ATTEMPT_TIMEOUT, timeoutResult);
+            LL_DEBUGS("Voice")
+                << "waiting for logout response on "
+                << voicePump.getName()
+                << LL_ENDL;
 
-        LL_DEBUGS("Voice") << "event=" << ll_stream_notation_sd(result) << LL_ENDL;
+            LLSD result = llcoro::suspendUntilEventOnWithTimeout(voicePump, LOGOUT_ATTEMPT_TIMEOUT, timeoutResult);
 
-        if (result.has("logout"))
+            LL_DEBUGS("Voice") << "event=" << ll_stream_notation_sd(result) << LL_ENDL;
+        }
+        else
         {
+            LL_DEBUGS("Voice") << "not waiting for logout" << LL_ENDL;
         }
-    }
 
-    mIsLoggedIn = false;
+        mIsLoggedIn = false;
+    }
 }
 
 
@@ -1555,7 +1585,9 @@ bool LLVivoxVoiceClient::terminateAudioSession(bool wait)
                     LLSD result;
                     do
                     {
-                        result = llcoro::suspendUntilEventOn(voicePump);
+                        LLSD timeoutResult(LLSDMap("session", "timeout"));
+
+                        result = llcoro::suspendUntilEventOnWithTimeout(voicePump, LOGOUT_ATTEMPT_TIMEOUT, timeoutResult);
 
                         LL_DEBUGS("Voice") << "event=" << ll_stream_notation_sd(result) << LL_ENDL;
                         if (result.has("session"))
@@ -1570,7 +1602,7 @@ bool LLVivoxVoiceClient::terminateAudioSession(bool wait)
                             }
 
                             std::string message = result["session"].asString();
-                            if (message == "removed")
+                            if (message == "removed" || message == "timeout")
                                 break;
                         }
                     } while (true);
@@ -1595,7 +1627,6 @@ bool LLVivoxVoiceClient::terminateAudioSession(bool wait)
 
         // The old session may now need to be deleted.
         reapSession(oldSession);
-
     }
     else
     {
@@ -1609,13 +1640,15 @@ bool LLVivoxVoiceClient::terminateAudioSession(bool wait)
     // the region chat.
     mSessionTerminateRequested = false;
 
-    if ((mVoiceEnabled || !mIsInitialized) && !mRelogRequested  && !LLApp::isExiting())
-    {
-        // Just leaving a channel, go back to stateNoChannel (the "logged in but have no channel" state).
-        return true;
-    }
-
-    return false;
+    bool status=((mVoiceEnabled || !mIsInitialized) && !mRelogRequested  && !LLApp::isExiting());
+    LL_DEBUGS("Voice") << "exiting"
+                       << " VoiceEnabled " << mVoiceEnabled
+                       << " IsInitialized " << mIsInitialized
+                       << " RelogRequested " << mRelogRequested
+                       << " AppExiting " << LLApp::isExiting()
+                       << " returning " << status
+                       << LL_ENDL;
+    return status;
 }
 
 bool LLVivoxVoiceClient::waitForChannel()
@@ -1676,7 +1709,18 @@ bool LLVivoxVoiceClient::waitForChannel()
                 sessionStatePtr_t joinSession = mNextAudioSession;
                 mNextAudioSession.reset();
                 if (!runSession(joinSession))
+                {
+                    LL_DEBUGS("Voice") << "runSession returned false; leaving inner loop" << LL_ENDL;
                     break;
+                }
+                else
+                {
+                    LL_DEBUGS("Voice")
+                        << "runSession returned true to inner loop"
+                        << " RelogRequested=" << mRelogRequested
+                        << " VoiceEnabled=" << mVoiceEnabled
+                        << LL_ENDL;
+                }
             }
 
             if (!mNextAudioSession)
@@ -1685,6 +1729,12 @@ bool LLVivoxVoiceClient::waitForChannel()
             }
         } while (mVoiceEnabled && !mRelogRequested);
 
+        LL_DEBUGS("Voice")
+            << "leaving inner waitForChannel loop"
+            << " RelogRequested=" << mRelogRequested
+            << " VoiceEnabled=" << mVoiceEnabled
+            << LL_ENDL;
+
         mIsProcessingChannels = false;
 
         logoutOfVivox(true);
@@ -1699,8 +1749,13 @@ bool LLVivoxVoiceClient::waitForChannel()
                 return false;
             }
         }
-    } while (mVoiceEnabled && mRelogRequested);
+    } while (mVoiceEnabled && mRelogRequested && isGatewayRunning());
 
+    LL_DEBUGS("Voice")
+        << "exiting"
+        << " RelogRequested=" << mRelogRequested
+        << " VoiceEnabled=" << mVoiceEnabled
+        << LL_ENDL;
     return true;
 }
 
@@ -1733,7 +1788,7 @@ bool LLVivoxVoiceClient::runSession(const sessionStatePtr_t &session)
     mIsInChannel = true;
     mMuteMicDirty = true;
 
-    while (mVoiceEnabled && !mSessionTerminateRequested && !mTuningMode)
+    while (mVoiceEnabled && isGatewayRunning() && !mSessionTerminateRequested && !mTuningMode)
     {
         sendCaptureAndRenderDevices();
         if (mAudioSession && mAudioSession->mParticipantsChanged)
@@ -1783,7 +1838,9 @@ bool LLVivoxVoiceClient::runSession(const sessionStatePtr_t &session)
         mIsInitialized = true;
         LLSD result = llcoro::suspendUntilEventOnWithTimeout(voicePump, UPDATE_THROTTLE_SECONDS, timeoutEvent);
         if (!result.has("timeout")) // logging the timeout event spams the log
+        {
             LL_DEBUGS("Voice") << "event=" << ll_stream_notation_sd(result) << LL_ENDL;
+        }
         if (result.has("session"))
         {   
             if (result.has("handle"))
@@ -1804,6 +1861,7 @@ bool LLVivoxVoiceClient::runSession(const sessionStatePtr_t &session)
 
             if (message == "removed")
             {
+                LL_DEBUGS("Voice") << "session removed" << LL_ENDL;
                 notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL);
                 break;
             }
@@ -1813,12 +1871,12 @@ bool LLVivoxVoiceClient::runSession(const sessionStatePtr_t &session)
             std::string message = result["login"];
             if (message == "account_logout")
             {
+                LL_DEBUGS("Voice") << "logged out" << LL_ENDL;
                 mIsLoggedIn = false;
                 mRelogRequested = true;
                 break;
             }
         }
-    
     }
 
     mIsInChannel = false;
@@ -2998,8 +3056,6 @@ void LLVivoxVoiceClient::sendLocalAudioUpdates()
 {
 	// Check all of the dirty states and then send messages to those needing to be changed.
 	// Tuningmode hands its own mute settings.
-    LL_DEBUGS("Voice")<<LL_ENDL;
-    
 	std::ostringstream stream;
 
 	if (mMuteMicDirty && !mTuningMode)
@@ -5026,6 +5082,12 @@ void LLVivoxVoiceClient::setMuteMic(bool muted)
 
 void LLVivoxVoiceClient::setVoiceEnabled(bool enabled)
 {
+    LL_DEBUGS("Voice")
+        << "( " << (enabled ? "enabled" : "disabled") << " )"
+        << " was "<< (mVoiceEnabled ? "enabled" : "disabled")
+        << " coro "<< (mIsCoroutineActive ? "active" : "inactive")
+        << LL_ENDL;
+    
 	if (enabled != mVoiceEnabled)
 	{
 		// TODO: Refactor this so we don't call into LLVoiceChannel, but simply
@@ -5035,6 +5097,7 @@ void LLVivoxVoiceClient::setVoiceEnabled(bool enabled)
 		
 		if (enabled)
 		{
+            LL_DEBUGS("Voice") << "enabling" << LL_ENDL;
 			LLVoiceChannel::getCurrentVoiceChannel()->activate();
 			status = LLVoiceClientStatusObserver::STATUS_VOICE_ENABLED;
 
@@ -5042,6 +5105,10 @@ void LLVivoxVoiceClient::setVoiceEnabled(bool enabled)
             {
                 LLCoros::instance().launch("LLVivoxVoiceClient::voiceControlCoro();",
                     boost::bind(&LLVivoxVoiceClient::voiceControlCoro, LLVivoxVoiceClient::getInstance()));
+            }
+            else
+            {
+                LL_DEBUGS("Voice") << "coro should be active.. not launching" << LL_ENDL;
             }
 		}
 		else
@@ -5050,8 +5117,13 @@ void LLVivoxVoiceClient::setVoiceEnabled(bool enabled)
 			LLVoiceChannel::getCurrentVoiceChannel()->deactivate();
 			status = LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED;
 		}
-		notifyStatusObservers(status);		
+
+		notifyStatusObservers(status);
 	}
+    else
+    {
+        LL_DEBUGS("Voice") << " no-op" << LL_ENDL;
+    }
 }
 
 bool LLVivoxVoiceClient::voiceEnabled()
@@ -5755,7 +5827,7 @@ void LLVivoxVoiceClient::deleteSession(const sessionStatePtr_t &session)
 
 void LLVivoxVoiceClient::deleteAllSessions()
 {
-	LL_DEBUGS("Voice") << "called" << LL_ENDL;
+	LL_DEBUGS("Voice") << LL_ENDL;
 
     while (!mSessionsByHandle.empty())
 	{
@@ -5806,6 +5878,10 @@ void LLVivoxVoiceClient::removeObserver(LLVoiceClientStatusObserver* observer)
 
 void LLVivoxVoiceClient::notifyStatusObservers(LLVoiceClientStatusObserver::EStatusType status)
 {
+    LL_DEBUGS("Voice") << "( " << LLVoiceClientStatusObserver::status2string(status) << " )"
+                       << " mAudioSession=" << mAudioSession
+                       << LL_ENDL;
+
 	if(mAudioSession)
 	{
 		if(status == LLVoiceClientStatusObserver::ERROR_UNKNOWN)
@@ -5850,8 +5926,8 @@ void LLVivoxVoiceClient::notifyStatusObservers(LLVoiceClientStatusObserver::ESta
 	LL_DEBUGS("Voice") 
 		<< " " << LLVoiceClientStatusObserver::status2string(status)  
 		<< ", session URI " << getAudioSessionURI() 
-		<< (inSpatialChannel()?", proximal is true":", proximal is false")
-	<< LL_ENDL;
+		<< ", proximal is " << inSpatialChannel()
+        << LL_ENDL;
 
 	for (status_observer_set_t::iterator it = mStatusObservers.begin();
 		it != mStatusObservers.end();
-- 
cgit v1.2.3


From 6f54add8a8852c8f3df86abebe38ef0ce4a6742c Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Tue, 21 Aug 2018 19:03:01 -0400
Subject: increment viewer version to 5.1.9

---
 indra/newview/VIEWER_VERSION.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/VIEWER_VERSION.txt b/indra/newview/VIEWER_VERSION.txt
index d4bda08b51..fc3aa7739a 100644
--- a/indra/newview/VIEWER_VERSION.txt
+++ b/indra/newview/VIEWER_VERSION.txt
@@ -1 +1 @@
-5.1.8
+5.1.9
-- 
cgit v1.2.3