From a2c6c09c5370b4068c91864e808fa8f970139ada Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Mon, 15 Feb 2010 17:32:55 +0000 Subject: CID-209 Checker: REVERSE_INULL Function: LLVoiceClient::startUserIMSession(const LLUUID &) File: /indra/newview/llvoiceclient.cpp --- indra/newview/llvoiceclient.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'indra/newview/llvoiceclient.cpp') diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index f3bfc2e86c..3d153db733 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -5377,24 +5377,25 @@ LLVoiceClient::sessionState* LLVoiceClient::startUserIMSession(const LLUUID &uui // No session with user, need to start one. std::string uri = sipURIFromID(uuid); session = addSession(uri); + + llassert(session); + if (!session) return NULL; + session->mIsSpatial = false; session->mReconnect = false; session->mIsP2P = true; session->mCallerID = uuid; } - if(session) + if(session->mHandle.empty()) { - if(session->mHandle.empty()) - { - // Session isn't active -- start it up. - sessionCreateSendMessage(session, false, true); - } - else - { - // Session is already active -- start up text. - sessionTextConnectSendMessage(session); - } + // Session isn't active -- start it up. + sessionCreateSendMessage(session, false, true); + } + else + { + // Session is already active -- start up text. + sessionTextConnectSendMessage(session); } return session; -- cgit v1.3 From 1ae70e112a466a6ed5baf4e05c1771218c78b2f5 Mon Sep 17 00:00:00 2001 From: Aimee Linden Date: Thu, 18 Feb 2010 12:04:21 +0000 Subject: EXT-5370: Voice volumes set for other agents reverting between voice sessions mVolumeDirty needs to be set when recalling volume levels, for both the participant and the session, to trigger sending a volume change message to Vivox. Reviewed by: Lynx. --- indra/newview/app_settings/settings.xml | 11 ----------- indra/newview/llvoiceclient.cpp | 15 +++++++++------ 2 files changed, 9 insertions(+), 17 deletions(-) (limited to 'indra/newview/llvoiceclient.cpp') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index b1bf132f43..f58f4ac594 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -10393,17 +10393,6 @@ Value 1 - VoiceDefaultInternalLevel - - Comment - Internal level of voice set by default. Is equivalent to 0.5 (from 0.0-1.0 range) external voice level (internal = 400 * external^2). - Persist - 1 - Type - S32 - Value - 100 - VoiceEarLocation Comment diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 3d153db733..59606f17b2 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -1115,10 +1115,9 @@ public: * Gets stored external (vivox) volume level for specified speaker and * transforms it into internal (viewer) level. * - * If specified user is not found default level will be returned. It is equivalent of - * external level 0.5 from the 0.0..1.0 range. + * If specified user is not found -1 will be returned. * Internal level is calculated as: internal = 400 * external^2 - * Maps 0.0 to 1.0 to internal values 0-400 with default 0.5 == 100 + * Maps 0.0 to 1.0 to internal values 0-400 * * @param[in] speaker_id - LLUUID of user to get his volume level */ @@ -1157,9 +1156,8 @@ void LLSpeakerVolumeStorage::storeSpeakerVolume(const LLUUID& speaker_id, F32 vo S32 LLSpeakerVolumeStorage::getSpeakerVolume(const LLUUID& speaker_id) { - // default internal level of user voice. - const static LLUICachedControl DEFAULT_INTERNAL_VOLUME_LEVEL("VoiceDefaultInternalLevel", 100); - S32 ret_val = DEFAULT_INTERNAL_VOLUME_LEVEL; + // Return value of -1 indicates no level is stored for this speaker + S32 ret_val = -1; speaker_data_map_t::const_iterator it = mSpeakersData.find(speaker_id); if (it != mSpeakersData.end()) @@ -5045,6 +5043,11 @@ LLVoiceClient::participantState *LLVoiceClient::sessionState::addParticipant(con mParticipantsByUUID.insert(participantUUIDMap::value_type(&(result->mAvatarID), result)); result->mUserVolume = LLSpeakerVolumeStorage::getInstance()->getSpeakerVolume(result->mAvatarID); + if (result->mUserVolume != -1) + { + result->mVolumeDirty = true; + mVolumeDirty = true; + } LL_DEBUGS("Voice") << "participant \"" << result->mURI << "\" added." << LL_ENDL; } -- cgit v1.3 From 272c42d7cfc88026d5326943845fd3a2cef68e25 Mon Sep 17 00:00:00 2001 From: Andrew Dyukov Date: Thu, 25 Feb 2010 22:05:55 +0200 Subject: Fixed normal bug EXT-4313 (Should not be able to start a call when voice is disabled). - Added constant holding maximum number of times(in a row) "stateJoiningSession" case for spatial channel is reached in LLVoiceClient::stateMachine() which is treated as normal. They are counted using member added to LLVoiceClient. If this number is exceeded we suspect there is a problem with connection to voice server. Check of current number against maximum was added to LLVoiceClient::voiceWorking(). --HG-- branch : product-engine --- indra/newview/llvoiceclient.cpp | 33 ++++++++++++++++++++++++++++++++- indra/newview/llvoiceclient.h | 4 ++++ 2 files changed, 36 insertions(+), 1 deletion(-) (limited to 'indra/newview/llvoiceclient.cpp') diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 59606f17b2..5ba13efca2 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -102,6 +102,13 @@ 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; @@ -1221,6 +1228,7 @@ LLVoiceClient::LLVoiceClient() : mRelogRequested(false), mConnected(false), mPump(NULL), + mSpatialJoiningNum(0), mTuningMode(false), mTuningEnergy(0.0f), @@ -2223,6 +2231,8 @@ void LLVoiceClient::stateMachine() //MARK: stateNoChannel case stateNoChannel: + + 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(); @@ -2279,6 +2289,23 @@ void LLVoiceClient::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) { @@ -2302,6 +2329,8 @@ void LLVoiceClient::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. @@ -5992,7 +6021,9 @@ bool LLVoiceClient::voiceEnabled() bool LLVoiceClient::voiceWorking() { //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); } void LLVoiceClient::setLipSyncEnabled(BOOL enabled) diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h index a96cf18e27..aaacab69e0 100644 --- a/indra/newview/llvoiceclient.h +++ b/indra/newview/llvoiceclient.h @@ -586,6 +586,10 @@ static void updatePosition(void); state mState; bool mSessionTerminateRequested; bool mRelogRequested; + // Number of times (in a row) "stateJoiningSession" case for spatial channel is reached in stateMachine(). + // The larger it is the greater is possibility there is a problem with connection to voice server. + // Introduced while fixing EXT-4313. + int mSpatialJoiningNum; void setState(state inState); state getState(void) { return mState; }; -- cgit v1.3