summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llvoicewebrtc.cpp36
-rw-r--r--indra/newview/llvoicewebrtc.h2
2 files changed, 21 insertions, 17 deletions
diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp
index 2a3f633858..a725bcf034 100644
--- a/indra/newview/llvoicewebrtc.cpp
+++ b/indra/newview/llvoicewebrtc.cpp
@@ -2478,7 +2478,7 @@ void LLVoiceWebRTCConnection::sendData(const std::string &data)
// Tell the simulator that we're shutting down a voice connection.
// The simulator will pass this on to the Secondlife WebRTC server.
-void LLVoiceWebRTCConnection::breakVoiceConnectionCoro(connectionPtr_t connection)
+void LLVoiceWebRTCConnection::breakVoiceConnection(connectionPtr_t connection)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE;
@@ -2493,7 +2493,9 @@ void LLVoiceWebRTCConnection::breakVoiceConnectionCoro(connectionPtr_t connectio
if (!regionp || !regionp->capabilitiesReceived())
{
LL_DEBUGS("Voice") << "no capabilities for voice provisioning; waiting " << LL_ENDL;
- connection->setVoiceConnectionState(VOICE_STATE_SESSION_RETRY);
+ // fine, don't be polite and ask the janus server to break the connection.
+ // just fall through and drop the connection.
+ connection->setVoiceConnectionState(VOICE_STATE_SESSION_EXIT);
connection->mOutstandingRequests--;
return;
}
@@ -2501,7 +2503,8 @@ void LLVoiceWebRTCConnection::breakVoiceConnectionCoro(connectionPtr_t connectio
std::string url = regionp->getCapability("ProvisionVoiceAccountRequest");
if (url.empty())
{
- connection->setVoiceConnectionState(VOICE_STATE_SESSION_RETRY);
+ // and go on to drop the connection here, too.
+ connection->setVoiceConnectionState(VOICE_STATE_SESSION_EXIT);
connection->mOutstandingRequests--;
return;
}
@@ -2529,8 +2532,11 @@ void LLVoiceWebRTCConnection::breakVoiceConnectionCoro(connectionPtr_t connectio
connection->mOutstandingRequests--;
- if (connection->getVoiceConnectionState() == VOICE_STATE_WAIT_FOR_EXIT)
+ if (connection->getVoiceConnectionState() == VOICE_STATE_WAIT_FOR_EXIT ||
+ !(connection->getVoiceConnectionState() & VOICE_STATE_SESSION_STOPPING))
{
+ // drop the connection if we either somehow got set back to a running/starting state
+ // or we completed the call in the wait-for-exit state
connection->setVoiceConnectionState(VOICE_STATE_SESSION_EXIT);
}
}
@@ -2814,9 +2820,7 @@ bool LLVoiceWebRTCConnection::connectionStateMachine()
if (!LLWebRTCVoiceClient::isShuttingDown())
{
mOutstandingRequests++;
- setVoiceConnectionState(VOICE_STATE_WAIT_FOR_EXIT);
- LLCoros::instance().launch("LLVoiceWebRTCConnection::breakVoiceConnectionCoro",
- boost::bind(&LLVoiceWebRTCConnection::breakVoiceConnectionCoro, this->shared_from_this()));
+ breakVoiceConnection(this->shared_from_this());
}
else
{
@@ -2829,17 +2833,18 @@ bool LLVoiceWebRTCConnection::connectionStateMachine()
break;
case VOICE_STATE_SESSION_EXIT:
+ setVoiceConnectionState(VOICE_STATE_WAIT_FOR_CLOSE);
+ mOutstandingRequests++;
+ if (!LLWebRTCVoiceClient::isShuttingDown())
{
- setVoiceConnectionState(VOICE_STATE_WAIT_FOR_CLOSE);
- mOutstandingRequests++;
- if (!LLWebRTCVoiceClient::isShuttingDown())
- {
- mWebRTCPeerConnectionInterface->shutdownConnection();
- }
- // else was already posted by llwebrtc::terminate().
- break;
+ mWebRTCPeerConnectionInterface->shutdownConnection();
+ }
+ // else was already posted by llwebrtc::terminate().
+ break;
+
case VOICE_STATE_WAIT_FOR_CLOSE:
break;
+
case VOICE_STATE_CLOSED:
if (!mShutDown)
{
@@ -2856,7 +2861,6 @@ bool LLVoiceWebRTCConnection::connectionStateMachine()
}
}
break;
- }
default:
{
diff --git a/indra/newview/llvoicewebrtc.h b/indra/newview/llvoicewebrtc.h
index 930018b123..b765126af3 100644
--- a/indra/newview/llvoicewebrtc.h
+++ b/indra/newview/llvoicewebrtc.h
@@ -691,7 +691,7 @@ class LLVoiceWebRTCConnection :
virtual void requestVoiceConnection() = 0;
static void requestVoiceConnectionCoro(connectionPtr_t connection) { connection->requestVoiceConnection(); }
- static void breakVoiceConnectionCoro(connectionPtr_t connection);
+ static void breakVoiceConnection(connectionPtr_t connection);
LLVoiceClientStatusObserver::EStatusType mCurrentStatus;