From d2257711c58654f6ab75c5b2b733302a8aa56d07 Mon Sep 17 00:00:00 2001
From: Oz Linden <oz@lindenlab.com>
Date: Wed, 8 Mar 2017 14:37:30 -0500
Subject: revert structure change, introduce VoiceFont logging tag

---
 indra/newview/llvoicevivox.cpp | 104 ++++++++++++++++++++---------------------
 1 file changed, 50 insertions(+), 54 deletions(-)

diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index 5d1b8f628f..d14a0f983c 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -1328,50 +1328,46 @@ bool LLVivoxVoiceClient::addAndJoinSession(const sessionStatePtr_t &nextSession)
         LL_INFOS("Voice") << "event=" << ll_stream_notation_sd(result) << LL_ENDL;
         if (result.has("session"))
         {
-            if (result.has("handle"))
+            if (result.has("handle") && result["handle"] != mAudioSession->mHandle)
             {
-                if (result["handle"] != mAudioSession->mHandle)
-                {
-                    LL_WARNS("Voice") << "Message for session handle \"" << result["handle"] << "\" while waiting for \"" << mAudioSession->mHandle << "\"." << LL_ENDL;
-                }
+                LL_WARNS("Voice") << "Message for session handle \"" << result["handle"] << "\" while waiting for \"" << mAudioSession->mHandle << "\"." << LL_ENDL;
+                continue;
             }
-            else
-            {
-                std::string message = result["session"].asString();
 
-                if ((message == "added") || (message == "created"))
+            std::string message = result["session"].asString();
+
+            if ((message == "added") || (message == "created"))
+            {
+                added = true;
+            }
+            else if (message == "joined")
+            {
+                joined = true;
+            }
+            else if ((message == "failed") || (message == "removed") || (message == "timeout"))
+            {   // we will get a removed message if a voice call is declined.
+                
+                if (message == "failed") 
                 {
-                    added = true;
+                    int reason = result["reason"].asInteger();
+                    LL_WARNS("Voice") << "Add and join failed for reason " << reason << LL_ENDL;
+                    
+                    if (   (reason == ERROR_VIVOX_NOT_LOGGED_IN)
+                        || (reason == ERROR_VIVOX_OBJECT_NOT_FOUND))
+                    {
+                        LL_DEBUGS("Voice") << "Requesting reprovision and login." << LL_ENDL;
+                        requestRelog();
+                    }                    
                 }
-                else if (message == "joined")
+                else
                 {
-                    joined = true;
+                    LL_WARNS("Voice") << "session '" << message << "' "
+                                      << LL_ENDL;
                 }
-                else if ((message == "failed") || (message == "removed") || (message == "timeout"))
-                {   // we will get a removed message if a voice call is declined.
-                
-                    if (message == "failed") 
-                    {
-                        int reason = result["reason"].asInteger();
-                        LL_WARNS("Voice") << "Add and join failed for reason " << reason << LL_ENDL;
-                    
-                        if (   (reason == ERROR_VIVOX_NOT_LOGGED_IN)
-                            || (reason == ERROR_VIVOX_OBJECT_NOT_FOUND))
-                        {
-                            LL_DEBUGS("Voice") << "Requesting reprovision and login." << LL_ENDL;
-                            requestRelog();
-                        }                    
-                    }
-                    else
-                    {
-                        LL_WARNS("Voice") << "session '" << message << "' "
-                                          << LL_ENDL;
-                    }
                     
-                    notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL);
-                    mIsJoiningSession = false;
-                    return false;
-                }
+                notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL);
+                mIsJoiningSession = false;
+                return false;
             }
         }
     } while (!added || !joined);
@@ -2006,10 +2002,10 @@ void LLVivoxVoiceClient::sessionGroupCreateSendMessage()
 
 void LLVivoxVoiceClient::sessionCreateSendMessage(const sessionStatePtr_t &session, bool startAudio, bool startText)
 {
-	LL_DEBUGS("Voice") << "Requesting create: " << session->mSIPURI << LL_ENDL;
-
 	S32 font_index = getVoiceFontIndex(session->mVoiceFontID);
-	LL_DEBUGS("Voice") << "With voice font: " << session->mVoiceFontID << " (" << font_index << ")" << LL_ENDL;
+	LL_DEBUGS("Voice") << "Requesting create: " << session->mSIPURI
+                       << " with voice font: " << session->mVoiceFontID << " (" << font_index << ")"
+                       << LL_ENDL;
 
 	session->mCreateInProgress = true;
 	if(startAudio)
@@ -2087,10 +2083,10 @@ void LLVivoxVoiceClient::sessionGroupAddSessionSendMessage(const sessionStatePtr
 
 void LLVivoxVoiceClient::sessionMediaConnectSendMessage(const sessionStatePtr_t &session)
 {
-	LL_DEBUGS("Voice") << "Connecting audio to session handle: " << session->mHandle << LL_ENDL;
-
 	S32 font_index = getVoiceFontIndex(session->mVoiceFontID);
-	LL_DEBUGS("Voice") << "With voice font: " << session->mVoiceFontID << " (" << font_index << ")" << LL_ENDL;
+	LL_DEBUGS("Voice") << "Connecting audio to session handle: " << session->mHandle
+                       << " with voice font: " << session->mVoiceFontID << " (" << font_index << ")"
+                       << LL_ENDL;
 
 	session->mMediaConnectInProgress = true;
 	
@@ -5957,7 +5953,7 @@ void LLVivoxVoiceClient::addVoiceFont(const S32 font_index,
 
 	if (has_expired)
 	{
-		LL_DEBUGS("Voice") << "Expired " << (template_font ? "Template " : "")
+		LL_DEBUGS("VoiceFont") << "Expired " << (template_font ? "Template " : "")
 		<< expiration_date.asString() << " " << font_id
 		<< " (" << font_index << ") " << name << LL_ENDL;
 
@@ -6020,7 +6016,7 @@ void LLVivoxVoiceClient::addVoiceFont(const S32 font_index,
 			}
 		}
 
-		LL_DEBUGS("Voice") << (template_font ? "Template " : "")
+		LL_DEBUGS("VoiceFont") << (template_font ? "Template " : "")
 			<< font->mExpirationDate.asString() << " " << font->mID
 			<< " (" << font->mFontIndex << ") " << name << LL_ENDL;
 
@@ -6036,11 +6032,11 @@ void LLVivoxVoiceClient::addVoiceFont(const S32 font_index,
 
 		if (font_type < VOICE_FONT_TYPE_NONE || font_type >= VOICE_FONT_TYPE_UNKNOWN)
 		{
-			LL_WARNS("Voice") << "Unknown voice font type: " << font_type << LL_ENDL;
+			LL_WARNS("VoiceFont") << "Unknown voice font type: " << font_type << LL_ENDL;
 		}
 		if (font_status < VOICE_FONT_STATUS_NONE || font_status >= VOICE_FONT_STATUS_UNKNOWN)
 		{
-			LL_WARNS("Voice") << "Unknown voice font status: " << font_status << LL_ENDL;
+			LL_WARNS("VoiceFont") << "Unknown voice font status: " << font_status << LL_ENDL;
 		}
 	}
 }
@@ -6084,7 +6080,7 @@ void LLVivoxVoiceClient::expireVoiceFonts()
 		// Check for voice fonts that will expire in less that the warning time
 		if (warning_timer.getStarted() && warning_timer.hasExpired())
 		{
-			LL_DEBUGS("Voice") << "Voice Font " << voice_font->mName << " will expire soon." << LL_ENDL;
+			LL_DEBUGS("VoiceFont") << "Voice Font " << voice_font->mName << " will expire soon." << LL_ENDL;
 			will_expire = true;
 			warning_timer.stop();
 		}
@@ -6127,7 +6123,7 @@ void LLVivoxVoiceClient::deleteVoiceFont(const LLUUID& id)
 	{
 		if (list_iter->second == id)
 		{
-			LL_DEBUGS("Voice") << "Removing " << id << " from the voice font list." << LL_ENDL;
+			LL_DEBUGS("VoiceFont") << "Removing " << id << " from the voice font list." << LL_ENDL;
 			mVoiceFontList.erase(list_iter++);
 			mVoiceFontListDirty = true;
 		}
@@ -6184,7 +6180,7 @@ S32 LLVivoxVoiceClient::getVoiceFontIndex(const LLUUID& id) const
 		}
 		else
 		{
-			LL_DEBUGS("Voice") << "Selected voice font " << id << " is not available." << LL_ENDL;
+			LL_WARNS("VoiceFont") << "Selected voice font " << id << " is not available." << LL_ENDL;
 		}
 	}
 	return result;
@@ -6202,7 +6198,7 @@ S32 LLVivoxVoiceClient::getVoiceFontTemplateIndex(const LLUUID& id) const
 		}
 		else
 		{
-			LL_DEBUGS("Voice") << "Selected voice font template " << id << " is not available." << LL_ENDL;
+			LL_WARNS("VoiceFont") << "Selected voice font template " << id << " is not available." << LL_ENDL;
 		}
 	}
 	return result;
@@ -6214,7 +6210,7 @@ void LLVivoxVoiceClient::accountGetSessionFontsSendMessage()
 	{
 		std::ostringstream stream;
 
-		LL_DEBUGS("Voice") << "Requesting voice font list." << LL_ENDL;
+		LL_DEBUGS("VoiceFont") << "Requesting voice font list." << LL_ENDL;
 
 		stream
 		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.GetSessionFonts.1\">"
@@ -6232,7 +6228,7 @@ void LLVivoxVoiceClient::accountGetTemplateFontsSendMessage()
 	{
 		std::ostringstream stream;
 
-		LL_DEBUGS("Voice") << "Requesting voice font template list." << LL_ENDL;
+		LL_DEBUGS("VoiceFont") << "Requesting voice font template list." << LL_ENDL;
 
 		stream
 		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.GetTemplateFonts.1\">"
@@ -6247,7 +6243,7 @@ void LLVivoxVoiceClient::accountGetTemplateFontsSendMessage()
 void LLVivoxVoiceClient::sessionSetVoiceFontSendMessage(const sessionStatePtr_t &session)
 {
 	S32 font_index = getVoiceFontIndex(session->mVoiceFontID);
-	LL_DEBUGS("Voice") << "Requesting voice font: " << session->mVoiceFontID << " (" << font_index << "), session handle: " << session->mHandle << LL_ENDL;
+	LL_DEBUGS("VoiceFont") << "Requesting voice font: " << session->mVoiceFontID << " (" << font_index << "), session handle: " << session->mHandle << LL_ENDL;
 
 	std::ostringstream stream;
 
@@ -6384,7 +6380,7 @@ void LLVivoxVoiceClient::updateVoiceMorphingMenu()
 }
 void LLVivoxVoiceClient::notifyVoiceFontObservers()
 {
-    LL_DEBUGS("Voice") << "Notifying voice effect observers. Lists changed: " << mVoiceFontListDirty << LL_ENDL;
+    LL_DEBUGS("VoiceFont") << "Notifying voice effect observers. Lists changed: " << mVoiceFontListDirty << LL_ENDL;
 
     updateVoiceMorphingMenu();
 
-- 
cgit v1.2.3