From f6ed529f2237975fb9a205cc6340a7159e44a404 Mon Sep 17 00:00:00 2001 From: Armin Weatherwax Date: Thu, 25 Mar 2010 15:25:49 +0100 Subject: disable voice temporaryly where no caps avail (renables on parcel change) --- linden/indra/newview/llvoiceclient.cpp | 93 ++++++++++++++++++++++------------ linden/indra/newview/llvoiceclient.h | 2 + 2 files changed, 63 insertions(+), 32 deletions(-) (limited to 'linden/indra/newview') diff --git a/linden/indra/newview/llvoiceclient.cpp b/linden/indra/newview/llvoiceclient.cpp index 67e4075..2c46832 100644 --- a/linden/indra/newview/llvoiceclient.cpp +++ b/linden/indra/newview/llvoiceclient.cpp @@ -1137,6 +1137,7 @@ LLVoiceClient::LLVoiceClient() // Use default values for everything then call updateSettings() after preferences are loaded mVoiceEnabled = false; + mVoiceTemporaryDisabled = false; mUsePTT = true; mPTTIsToggle = false; mEarLocation = 0; @@ -1349,13 +1350,17 @@ void LLVoiceClient::userAuthorized(const std::string& firstName, const std::stri void LLVoiceClient::requestVoiceAccountProvision(S32 retries) { - if ( gAgent.getRegion() && mVoiceEnabled ) + if ( gAgent.getRegion() && mVoiceEnabled && !mVoiceTemporaryDisabled) { std::string url = gAgent.getRegion()->getCapability( "ProvisionVoiceAccountRequest"); - if ( url == "" ) return; + if ( url.empty() ) + { + mVoiceTemporaryDisabled = true; + return; + } LLHTTPClient::post( url, @@ -1532,7 +1537,7 @@ void LLVoiceClient::stateMachine() setVoiceEnabled(false); } - if(mVoiceEnabled) + if(mVoiceEnabled && !mVoiceTemporaryDisabled) { updatePosition(); } @@ -1591,18 +1596,29 @@ void LLVoiceClient::stateMachine() } else { - static int count = 0; - static int count2 = 0; - static int num = 1; - ++count; - if (count % num == 0) + if(!mVoiceTemporaryDisabled) { - LL_DEBUGS("Voice") << "region doesn't have ParcelVoiceInfoRequest capability. This is normal for a short time after teleporting, but bad if it persists for very long (" << count << ")." << LL_ENDL; - if (num < 1000 && ++count2 == 10) - { - num *= 10; - count2 = 0; - } + static int count = 0; + static int count2 = 0; + static int num = 1; + ++count; + if (count % num == 0) + { + LL_DEBUGS("Voice") << "region doesn't have ParcelVoiceInfoRequest capability. This is normal for a short time after teleporting, but bad if it persists for very long (" << count << ")." << LL_ENDL; + if (num < 1000) + { + if( ++count2 == 10) + { + num *= 10; + count2 = 0; + } + } + else + { + mVoiceTemporaryDisabled = true; + count = 0; + } + } } } } @@ -1628,7 +1644,7 @@ void LLVoiceClient::stateMachine() //MARK: stateDisabled case stateDisabled: - if(mTuningMode || (mVoiceEnabled && !mAccountName.empty())) + if(mTuningMode || (!mVoiceTemporaryDisabled && mVoiceEnabled && !mAccountName.empty())) { setState(stateStart); } @@ -1852,12 +1868,12 @@ void LLVoiceClient::stateMachine() mTuningExitState = stateIdle; setState(stateMicTuningStart); } - else if(!mVoiceEnabled) + else if(!mVoiceEnabled || mVoiceTemporaryDisabled) { // We never started up the connector. This will shut down the daemon. setState(stateConnectorStopped); } - else if(!mAccountName.empty() && mVoiceEnabled) + else if(!mAccountName.empty() && mVoiceEnabled && !mVoiceTemporaryDisabled) { LLViewerRegion *region = gAgent.getRegion(); @@ -1874,6 +1890,7 @@ void LLVoiceClient::stateMachine() else { LL_DEBUGS("Voice") << "region doesn't have ProvisionVoiceAccountRequest capability!" << LL_ENDL; + mVoiceTemporaryDisabled = true; } } } @@ -1970,7 +1987,7 @@ void LLVoiceClient::stateMachine() //MARK: stateConnectorStart case stateConnectorStart: - if(!mVoiceEnabled) + if(!mVoiceEnabled || mVoiceTemporaryDisabled) { // We were never logged in. This will shut down the connector. setState(stateLoggedOut); @@ -1988,7 +2005,7 @@ void LLVoiceClient::stateMachine() //MARK: stateConnectorStarted case stateConnectorStarted: // connector handle received - if(!mVoiceEnabled) + if(!mVoiceEnabled || mVoiceTemporaryDisabled) { // We were never logged in. This will shut down the connector. setState(stateLoggedOut); @@ -2099,7 +2116,7 @@ void LLVoiceClient::stateMachine() //MARK: stateCreatingSessionGroup case stateCreatingSessionGroup: - if(mSessionTerminateRequested || !mVoiceEnabled) + if(mSessionTerminateRequested || !mVoiceEnabled || mVoiceTemporaryDisabled) { // TODO: Question: is this the right way out of this state setState(stateSessionTerminated); @@ -2122,7 +2139,7 @@ void LLVoiceClient::stateMachine() // 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(); - if(mSessionTerminateRequested || !mVoiceEnabled) + if(mSessionTerminateRequested || !mVoiceEnabled || mVoiceTemporaryDisabled) { // TODO: Question: Is this the right way out of this state? setState(stateSessionTerminated); @@ -2175,7 +2192,7 @@ void LLVoiceClient::stateMachine() //MARK: stateJoiningSession case stateJoiningSession: // waiting for session handle // joinedAudioSession() will transition from here to stateSessionJoined. - if(!mVoiceEnabled) + if(!mVoiceEnabled || mVoiceTemporaryDisabled) { // User bailed out during connect -- jump straight to teardown. setState(stateSessionTerminated); @@ -2219,7 +2236,7 @@ void LLVoiceClient::stateMachine() notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_JOINED); } - else if(!mVoiceEnabled) + else if(!mVoiceEnabled || mVoiceTemporaryDisabled) { // User bailed out during connect -- jump straight to teardown. setState(stateSessionTerminated); @@ -2239,7 +2256,7 @@ void LLVoiceClient::stateMachine() //MARK: stateRunning case stateRunning: // steady state // Disabling voice or disconnect requested. - if(!mVoiceEnabled || mSessionTerminateRequested) + if(!mVoiceEnabled || mSessionTerminateRequested || mVoiceTemporaryDisabled) { leaveAudioSession(); } @@ -2382,7 +2399,7 @@ void LLVoiceClient::stateMachine() break; //MARK: stateConnectorFailedWaiting case stateConnectorFailedWaiting: - if(!mVoiceEnabled) + if(!mVoiceEnabled || mVoiceTemporaryDisabled) { setState(stateDisableCleanup); } @@ -2394,7 +2411,7 @@ void LLVoiceClient::stateMachine() break; //MARK: stateLoginFailedWaiting case stateLoginFailedWaiting: - if(!mVoiceEnabled) + if(!mVoiceEnabled || mVoiceTemporaryDisabled) { setState(stateDisableCleanup); } @@ -5046,17 +5063,27 @@ LLVoiceClient::participantState* LLVoiceClient::findParticipantByID(const LLUUID void LLVoiceClient::parcelChanged() { + mVoiceTemporaryDisabled = false; + if(getState() >= stateNoChannel) { // If the user is logged in, start a channel lookup. LL_DEBUGS("Voice") << "sending ParcelVoiceInfoRequest (" << mCurrentRegionName << ", " << mCurrentParcelLocalID << ")" << LL_ENDL; std::string url = gAgent.getRegion()->getCapability("ParcelVoiceInfoRequest"); - LLSD data; - LLHTTPClient::post( - url, - data, - new LLVoiceClientCapResponder); + + if ( !url.empty() ) + { + LLSD data; + LLHTTPClient::post( + url, + data, + new LLVoiceClientCapResponder); + } + else + { + mVoiceTemporaryDisabled = true; + } } else { @@ -5810,6 +5837,7 @@ void LLVoiceClient::setVoiceEnabled(bool enabled) if (enabled) { LLVoiceChannel::getCurrentVoiceChannel()->activate(); + mVoiceTemporaryDisabled =false; } else { @@ -5832,7 +5860,7 @@ void LLVoiceClient::setLipSyncEnabled(BOOL enabled) BOOL LLVoiceClient::lipSyncEnabled() { - if ( mVoiceEnabled && stateDisabled != getState() ) + if ( !mVoiceTemporaryDisabled && mVoiceEnabled && stateDisabled != getState() ) { return mLipSyncEnabled; } @@ -6269,6 +6297,7 @@ LLVoiceClient::sessionState::sessionState() : mIsP2P(false), mIncoming(false), mVoiceEnabled(false), + mVoiceTemporaryDisabled(false), mReconnect(false), mVolumeDirty(false), mParticipantsChanged(false) diff --git a/linden/indra/newview/llvoiceclient.h b/linden/indra/newview/llvoiceclient.h index cfc336b..d2ec752 100644 --- a/linden/indra/newview/llvoiceclient.h +++ b/linden/indra/newview/llvoiceclient.h @@ -330,6 +330,7 @@ static void updatePosition(void); bool mIsP2P; bool mIncoming; bool mVoiceEnabled; + bool mVoiceTemporaryDisabled; bool mReconnect; // Whether we should try to reconnect to this session if it's dropped // Set to true when the mute state of someone in the participant list changes. // The code will have to walk the list to find the changed participant(s). @@ -725,6 +726,7 @@ static std::string nameFromsipURI(const std::string &uri); bool mMicVolumeDirty; bool mVoiceEnabled; + bool mVoiceTemporaryDisabled; bool mWriteInProgress; std::string mWriteString; size_t mWriteOffset; -- cgit v1.1