diff options
author | Roxie Linden <roxie@lindenlab.com> | 2010-03-01 18:09:04 -0800 |
---|---|---|
committer | Roxie Linden <roxie@lindenlab.com> | 2010-03-01 18:09:04 -0800 |
commit | 1147cb1afbc21e1251614895844e95bca9b6b5bc (patch) | |
tree | da01f6c0e6b61a7c0637a371c946ea69b46f9dff /indra/newview/llvoicevivox.cpp | |
parent | b11a625e6ff89470d25273fa426ed13f7abc4a6a (diff) | |
parent | 0600083891ab5b2c6a79097f65945bcb2d049bed (diff) |
Automated merge from trunk
Diffstat (limited to 'indra/newview/llvoicevivox.cpp')
-rw-r--r-- | indra/newview/llvoicevivox.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index c7a7ccd493..c75405e12e 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -91,6 +91,14 @@ const F32 UPDATE_THROTTLE_SECONDS = 0.1f; const F32 LOGIN_RETRY_SECONDS = 10.0f; const int MAX_LOGIN_RETRIES = 12; +// Defines the maximum number of times(in a row) "stateJoiningSession" case for spatial channel is reached in stateMachine() +// which is treated as normal. If this number is exceeded we suspect there is a problem with connection +// 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; + + static void setUUIDFromStringHash(LLUUID &uuid, const std::string &str) { LLMD5 md5_uuid; @@ -292,6 +300,7 @@ LLVivoxVoiceClient::LLVivoxVoiceClient() : mRelogRequested(false), mConnected(false), mPump(NULL), + mSpatialJoiningNum(0), mTuningMode(false), mTuningEnergy(0.0f), @@ -1281,6 +1290,7 @@ void LLVivoxVoiceClient::stateMachine() case stateNoChannel: LL_DEBUGS("Voice") << "State No Channel" << LL_ENDL; + mSpatialJoiningNum = 0; // Do this here as well as inside sendPositionalUpdate(). // Otherwise, if you log in but don't join a proximal channel (such as when your login location has voice disabled), your friends list won't sync. sendFriendsListUpdates(); @@ -1337,6 +1347,23 @@ void LLVivoxVoiceClient::stateMachine() //MARK: stateJoiningSession case stateJoiningSession: // waiting for session handle + + // If this is true we have problem with connection to voice server (EXT-4313). + // See descriptions of mSpatialJoiningNum and MAX_NORMAL_JOINING_SPATIAL_NUM. + if(mSpatialJoiningNum == MAX_NORMAL_JOINING_SPATIAL_NUM) + { + // Notify observers to let them know there is problem with voice + notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED); + llwarns << "There seems to be problem with connection to voice server. Disabling voice chat abilities." << llendl; + } + + // Increase mSpatialJoiningNum only for spatial sessions- it's normal to reach this case for + // example for p2p many times while waiting for response, so it can't be used to detect errors + if(mAudioSession && mAudioSession->mIsSpatial) + { + mSpatialJoiningNum++; + } + // joinedAudioSession() will transition from here to stateSessionJoined. if(!mVoiceEnabled) { @@ -1360,6 +1387,8 @@ void LLVivoxVoiceClient::stateMachine() //MARK: stateSessionJoined case stateSessionJoined: // session handle received + + mSpatialJoiningNum = 0; // It appears that I need to wait for BOTH the SessionGroup.AddSession response and the SessionStateChangeEvent with state 4 // before continuing from this state. They can happen in either order, and if I don't wait for both, things can get stuck. // For now, the SessionGroup.AddSession response handler sets mSessionHandle and the SessionStateChangeEvent handler transitions to stateSessionJoined. @@ -4595,7 +4624,9 @@ BOOL LLVivoxVoiceClient::isOnlineSIP(const LLUUID &id) bool LLVivoxVoiceClient::isVoiceWorking() { //Added stateSessionTerminated state to avoid problems with call in parcels with disabled voice (EXT-4758) - return (stateLoggedIn <= mState) && (mState <= stateSessionTerminated); + // Condition with joining spatial num was added to take into account possible problems with connection to voice + // server(EXT-4313). See bug descriptions and comments for MAX_NORMAL_JOINING_SPATIAL_NUM for more info. + return (mSpatialJoiningNum < MAX_NORMAL_JOINING_SPATIAL_NUM) && (stateLoggedIn <= mState) && (mState <= stateSessionTerminated); } // Returns true if the indicated participant in the current audio session is really an SL avatar. |