summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llvoicewebrtc.cpp19
-rw-r--r--indra/newview/llvoicewebrtc.h3
2 files changed, 20 insertions, 2 deletions
diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp
index 06baea4ba2..919b541efe 100644
--- a/indra/newview/llvoicewebrtc.cpp
+++ b/indra/newview/llvoicewebrtc.cpp
@@ -2150,8 +2150,10 @@ LLVoiceWebRTCConnection::LLVoiceWebRTCConnection(const LLUUID &regionID, const s
mOutstandingRequests(0),
mChannelID(channelID),
mRegionID(regionID),
+ mPrimary(true),
mRetryWaitPeriod(0)
{
+
// retries wait a short period...randomize it so
// all clients don't try to reconnect at once.
mRetryWaitSecs = ((F32) rand() / (RAND_MAX)) + 0.5;
@@ -2755,6 +2757,17 @@ bool LLVoiceWebRTCConnection::connectionStateMachine()
{
mRetryWaitPeriod = 0;
mRetryWaitSecs = ((F32) rand() / (RAND_MAX)) + 0.5;
+ LLUUID agentRegionID;
+ if (isSpatial() && gAgent.getRegion())
+ {
+
+ bool primary = (mRegionID == gAgent.getRegion()->getRegionID());
+ if (primary != mPrimary)
+ {
+ mPrimary = primary;
+ sendJoin();
+ }
+ }
// we'll stay here as long as the session remains up.
if (mShutDown)
@@ -3023,7 +3036,7 @@ void LLVoiceWebRTCConnection::sendJoin()
Json::Value root = Json::objectValue;
Json::Value join_obj = Json::objectValue;
LLUUID regionID = gAgent.getRegion()->getRegionID();
- if ((regionID == mRegionID) || !isSpatial())
+ if (mPrimary)
{
join_obj["p"] = true;
}
@@ -3041,6 +3054,10 @@ LLVoiceWebRTCSpatialConnection::LLVoiceWebRTCSpatialConnection(const LLUUID &reg
LLVoiceWebRTCConnection(regionID, channelID),
mParcelLocalID(parcelLocalID)
{
+ if (gAgent.getRegion())
+ {
+ mPrimary = (regionID == gAgent.getRegion()->getRegionID());
+ }
}
LLVoiceWebRTCSpatialConnection::~LLVoiceWebRTCSpatialConnection()
diff --git a/indra/newview/llvoicewebrtc.h b/indra/newview/llvoicewebrtc.h
index 48c50a1ea3..324b4c5b9c 100644
--- a/indra/newview/llvoicewebrtc.h
+++ b/indra/newview/llvoicewebrtc.h
@@ -622,7 +622,7 @@ class LLVoiceWebRTCConnection :
bool connectionStateMachine();
- virtual bool isSpatial() = 0;
+ virtual bool isSpatial() { return false; }
LLUUID getRegionID() { return mRegionID; }
@@ -686,6 +686,7 @@ class LLVoiceWebRTCConnection :
LLVoiceClientStatusObserver::EStatusType mCurrentStatus;
LLUUID mRegionID;
+ bool mPrimary;
LLUUID mViewerSession;
std::string mChannelID;