summaryrefslogtreecommitdiff
path: root/indra/newview/llvoicevivox.cpp
diff options
context:
space:
mode:
authorMaximB ProductEngine <mberezhnoy@productengine.com>2012-11-07 12:07:52 +0200
committerMaximB ProductEngine <mberezhnoy@productengine.com>2012-11-07 12:07:52 +0200
commit4ec5ee63e28a427d88dfc0329151eacaf375fdb6 (patch)
tree62cc9b5d948a253efcdcc193ce25c2604f1e457b /indra/newview/llvoicevivox.cpp
parent990a8c6085b43cb0290a631b664b3160938b0536 (diff)
CHUI-450 (Your own name does not appear in nearby chat participant list if voice chat disabled)
Added audio module initialization without faking mVoiceEnabled value
Diffstat (limited to 'indra/newview/llvoicevivox.cpp')
-rw-r--r--indra/newview/llvoicevivox.cpp42
1 files changed, 17 insertions, 25 deletions
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index f236123ef1..839de395a7 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -291,6 +291,7 @@ LLVivoxVoiceClient::LLVivoxVoiceClient() :
mCaptureDeviceDirty(false),
mRenderDeviceDirty(false),
mSpatialCoordsDirty(false),
+ mIsInitialized(false),
mMuteMic(false),
mMuteMicDirty(false),
@@ -394,15 +395,7 @@ const LLVoiceVersionInfo& LLVivoxVoiceClient::getVersion()
void LLVivoxVoiceClient::updateSettings()
{
- if(!mAudioSession)
- {
- // If audio module is not initialized, pretend that voice is enabled, thus letting state machine to take a full cycle
- setVoiceEnabled(true);
- }
- else
- {
- setVoiceEnabled(gSavedSettings.getBOOL("EnableVoiceChat"));
- }
+ setVoiceEnabled(gSavedSettings.getBOOL("EnableVoiceChat"));
setEarLocation(gSavedSettings.getS32("VoiceEarLocation"));
std::string inputDevice = gSavedSettings.getString("VoiceInputAudioDevice");
@@ -528,7 +521,7 @@ void LLVivoxVoiceClient::requestVoiceAccountProvision(S32 retries)
{
LLViewerRegion *region = gAgent.getRegion();
- if ( region && mVoiceEnabled )
+ if ( region && (mVoiceEnabled || !mIsInitialized))
{
std::string url =
region->getCapability("ProvisionVoiceAccountRequest");
@@ -699,7 +692,7 @@ void LLVivoxVoiceClient::stateMachine()
setVoiceEnabled(false);
}
- if(mVoiceEnabled)
+ if(mVoiceEnabled || !mIsInitialized)
{
updatePosition();
}
@@ -744,7 +737,7 @@ void LLVivoxVoiceClient::stateMachine()
//MARK: stateDisabled
case stateDisabled:
- if(mTuningMode || (mVoiceEnabled && !mAccountName.empty()))
+ if(mTuningMode || ((mVoiceEnabled || !mIsInitialized) && !mAccountName.empty()))
{
setState(stateStart);
}
@@ -899,7 +892,7 @@ void LLVivoxVoiceClient::stateMachine()
mTuningExitState = stateIdle;
setState(stateMicTuningStart);
}
- else if(!mVoiceEnabled)
+ else if(!mVoiceEnabled && mIsInitialized)
{
// We never started up the connector. This will shut down the daemon.
setState(stateConnectorStopped);
@@ -1093,7 +1086,7 @@ void LLVivoxVoiceClient::stateMachine()
//MARK: stateConnectorStart
case stateConnectorStart:
- if(!mVoiceEnabled)
+ if(!mVoiceEnabled && mIsInitialized)
{
// We were never logged in. This will shut down the connector.
setState(stateLoggedOut);
@@ -1111,7 +1104,7 @@ void LLVivoxVoiceClient::stateMachine()
//MARK: stateConnectorStarted
case stateConnectorStarted: // connector handle received
- if(!mVoiceEnabled)
+ if(!mVoiceEnabled && mIsInitialized)
{
// We were never logged in. This will shut down the connector.
setState(stateLoggedOut);
@@ -1255,7 +1248,7 @@ void LLVivoxVoiceClient::stateMachine()
//MARK: stateCreatingSessionGroup
case stateCreatingSessionGroup:
- if(mSessionTerminateRequested || !mVoiceEnabled)
+ if(mSessionTerminateRequested || !mVoiceEnabled && mIsInitialized)
{
// *TODO: Question: is this the right way out of this state
setState(stateSessionTerminated);
@@ -1271,7 +1264,7 @@ void LLVivoxVoiceClient::stateMachine()
//MARK: stateRetrievingParcelVoiceInfo
case stateRetrievingParcelVoiceInfo:
// wait until parcel voice info is received.
- if(mSessionTerminateRequested || !mVoiceEnabled)
+ if(mSessionTerminateRequested || !mVoiceEnabled && mIsInitialized)
{
// if a terminate request has been received,
// bail and go to the stateSessionTerminated
@@ -1291,7 +1284,7 @@ void LLVivoxVoiceClient::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 && mIsInitialized)
{
// TODO: Question: Is this the right way out of this state?
setState(stateSessionTerminated);
@@ -1372,7 +1365,7 @@ void LLVivoxVoiceClient::stateMachine()
}
// joinedAudioSession() will transition from here to stateSessionJoined.
- if(!mVoiceEnabled)
+ if(!mVoiceEnabled && mIsInitialized)
{
// User bailed out during connect -- jump straight to teardown.
setState(stateSessionTerminated);
@@ -1419,7 +1412,7 @@ void LLVivoxVoiceClient::stateMachine()
notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_JOINED);
}
- else if(!mVoiceEnabled)
+ else if(!mVoiceEnabled && mIsInitialized)
{
// User bailed out during connect -- jump straight to teardown.
setState(stateSessionTerminated);
@@ -1439,7 +1432,7 @@ void LLVivoxVoiceClient::stateMachine()
//MARK: stateRunning
case stateRunning: // steady state
// Disabling voice or disconnect requested.
- if(!mVoiceEnabled || mSessionTerminateRequested)
+ if(!mVoiceEnabled && mIsInitialized || mSessionTerminateRequested)
{
leaveAudioSession();
}
@@ -1487,8 +1480,7 @@ void LLVivoxVoiceClient::stateMachine()
sendPositionalUpdate();
}
- // Now that audio module is fully initialized, check for actual mVoiceEnabled value
- updateSettings();
+ mIsInitialized = true;
}
break;
@@ -1522,7 +1514,7 @@ void LLVivoxVoiceClient::stateMachine()
// Always reset the terminate request flag when we get here.
mSessionTerminateRequested = false;
- if(mVoiceEnabled && !mRelogRequested)
+ if((mVoiceEnabled || !mIsInitialized) && !mRelogRequested)
{
// Just leaving a channel, go back to stateNoChannel (the "logged in but have no channel" state).
setState(stateNoChannel);
@@ -1550,7 +1542,7 @@ void LLVivoxVoiceClient::stateMachine()
mAccountHandle.clear();
cleanUp();
- if(mVoiceEnabled && !mRelogRequested)
+ if((mVoiceEnabled || !mIsInitialized) && !mRelogRequested)
{
// User was logged out, but wants to be logged in. Send a new login request.
setState(stateNeedsLogin);