From 89690140c79dcbd8466ebd1c637f474670e3a7ce Mon Sep 17 00:00:00 2001 From: Bjoseph Wombat Date: Tue, 3 Mar 2015 18:04:05 +0000 Subject: Better MediaConnect handling of 1026 return status, media already connected. --- indra/newview/llvoicevivox.cpp | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index a6a7a35b03..ac264d395f 100755 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -95,7 +95,7 @@ const int MAX_LOGIN_RETRIES = 12; // to voice server (EXT-4313). When voice works correctly, there is from 1 to 15 times. 50 was chosen // to make sure we don't make mistake when slight connection problems happen- situation when connection to server is // blocked is VERY rare and it's better to sacrifice response time in this situation for the sake of stability. -const int MAX_NORMAL_JOINING_SPATIAL_NUM = 50; +const int MAX_NORMAL_JOINING_SPATIAL_NUM = 150; // How often to check for expired voice fonts in seconds const F32 VOICE_FONT_EXPIRY_INTERVAL = 10.f; @@ -1512,7 +1512,7 @@ void LLVivoxVoiceClient::stateMachine() //MARK: stateLeavingSession case stateLeavingSession: // waiting for terminate session response // The handler for the Session.Terminate response will transition from here to stateSessionTerminated. - break; + //break; // brett, should fall through and clean up session before getting terminated event. //MARK: stateSessionTerminated case stateSessionTerminated: @@ -1522,6 +1522,7 @@ void LLVivoxVoiceClient::stateMachine() if(mAudioSession) { + leaveAudioSession(); sessionState *oldSession = mAudioSession; mAudioSession = NULL; @@ -1881,6 +1882,7 @@ void LLVivoxVoiceClient::leaveAudioSession() case stateJoiningSession: case stateSessionJoined: case stateRunning: + case stateSessionTerminated: if(!mAudioSession->mHandle.empty()) { @@ -2813,15 +2815,24 @@ void LLVivoxVoiceClient::sessionGroupAddSessionResponse(std::string &requestId, void LLVivoxVoiceClient::sessionConnectResponse(std::string &requestId, int statusCode, std::string &statusString) { sessionState *session = findSession(requestId); - if(statusCode != 0) + // 1026 is session already has media, somehow mediaconnect was called twice on the same session. + // set the session info to reflect that the user is already connected. + if (statusCode == 1026){ + session->mVoiceEnabled = true; + session->mMediaConnectInProgress = false; + session->mMediaStreamState = streamStateConnected; + session->mTextStreamState = streamStateConnected; + session->mErrorStatusCode = 0; + } + else if (statusCode != 0) { LL_WARNS("Voice") << "Session.Connect response failure (" << statusCode << "): " << statusString << LL_ENDL; - if(session) + if (session) { session->mMediaConnectInProgress = false; - session->mErrorStatusCode = statusCode; + session->mErrorStatusCode = statusCode; session->mErrorStatusString = statusString; - if(session == mAudioSession) + if (session == mAudioSession) setState(stateJoinSessionFailed); } } @@ -4611,6 +4622,11 @@ void LLVivoxVoiceClient::enforceTether(void) void LLVivoxVoiceClient::updatePosition(void) { + // Throttle the position updates to one every 1/10 of a second if we are in an audio session at all + if (mAudioSession == NULL) { + return; + } + LLViewerRegion *region = gAgent.getRegion(); if(region && isAgentAvatarValid()) { -- cgit v1.2.3