diff options
author | Rider Linden <rider@lindenlab.com> | 2016-01-15 13:38:47 -0800 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2016-01-15 13:38:47 -0800 |
commit | f7ab5676219312867f829d2c70275f8b1ebbe10e (patch) | |
tree | deabd13b5887a40bb5cff8471a457e3c88f1a457 /indra | |
parent | e7eaa94dfa1eba24cbf1667190a0be37b2f417e4 (diff) | |
parent | f78b5c2deaa7b48114f5e8ca4a8376619e291b20 (diff) |
Merge
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/newview/llvoicevivox.cpp | 63 |
1 files changed, 51 insertions, 12 deletions
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 741e6408d0..8823bbce73 100755 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -128,6 +128,9 @@ static int scale_speaker_volume(float volume) } +const int ERROR_VIVOX_OBJECT_NOT_FOUND = 1001; +const int ERROR_VIVOX_NOT_LOGGED_IN = 1007; + /////////////////////////////////////////////////////////////////////////////////////////////// class LLVivoxVoiceClientMuteListObserver : public LLMuteListObserver @@ -519,18 +522,36 @@ void LLVivoxVoiceClient::voiceControlCoro() { mIsCoroutineActive = true; LLCoros::set_consuming(true); - startAndConnectSession(); - - if (mTuningMode) - { - performMicTuning(); - } - else if (mVoiceEnabled) + + do { - waitForChannel(); - } + + startAndConnectSession(); - endAndDisconnectSession(); + if (mTuningMode) + { + performMicTuning(); + } + else if (mVoiceEnabled) + { + waitForChannel(); + } + + endAndDisconnectSession(); + + // if we hit this and mRelogRequested is true, that indicates + // that we attempted to relog into Vivox and were rejected. + // Rather than just quit out of voice, we will tear it down (above) + // and then reconstruct the voice connecino from scratch. + if (mRelogRequested) + { + while (isGatewayRunning()) + { + llcoro::suspendUntilTimeout(1.0); + } + } + } + while (mRelogRequested); mIsCoroutineActive = false; } @@ -715,7 +736,7 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon() bool LLVivoxVoiceClient::provisionVoiceAccount() { - + LL_INFOS("Voice") << "Provisioning voice account." << LL_ENDL; while (!gAgent.getRegion()) { // *TODO* Set up a call back on agent that sends a message to a pump we can use to wake up. @@ -928,6 +949,7 @@ bool LLVivoxVoiceClient::loginToVivox() } while (!response_ok || !account_login); + mRelogRequested = false; mIsLoggedIn = true; notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LOGGED_IN); @@ -1181,6 +1203,21 @@ bool LLVivoxVoiceClient::addAndJoinSession(const sessionStatePtr_t &nextSession) joined = true; else if ((message == "failed") || (message == "removed")) { // we will get a removed message if a voice call is declined. + + if (message == "failed") + { + int reason = result["reason"].asInteger(); + LL_WARNS("Voice") << "Add and join failed for reason " << reason << LL_ENDL; + + if ((reason == ERROR_VIVOX_NOT_LOGGED_IN) || + (reason == ERROR_VIVOX_OBJECT_NOT_FOUND)) + { + LL_INFOS("Voice") << "Requesting reprovision and login." << LL_ENDL; + requestRelog(); + } + + } + notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL); mIsJoiningSession = false; return false; @@ -1364,7 +1401,8 @@ bool LLVivoxVoiceClient::waitForChannel() { sessionStatePtr_t joinSession = mNextAudioSession; mNextAudioSession.reset(); - runSession(joinSession); + if (!runSession(joinSession)) + break; } if (!mNextAudioSession) @@ -2798,6 +2836,7 @@ void LLVivoxVoiceClient::sessionCreateResponse(std::string &requestId, int statu vivoxevent["handle"] = LLSD::String(sessionHandle); vivoxevent["session"] = LLSD::String("failed"); + vivoxevent["reason"] = LLSD::Integer(statusCode); LLEventPumps::instance().post("vivoxClientPump", vivoxevent); } |