summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/llvoicevivox.cpp27
-rwxr-xr-xindra/newview/llvoicevivox.h4
2 files changed, 19 insertions, 12 deletions
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index ba374a0e11..e2bb212a52 100755
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -89,11 +89,14 @@ static const std::string VOICE_SERVER_TYPE = "Vivox";
const F32 CONNECT_THROTTLE_SECONDS = 1.0f;
// Don't send positional updates more frequently than this:
-const F32 UPDATE_THROTTLE_SECONDS = 0.1f;
+const F32 UPDATE_THROTTLE_SECONDS = 0.5f;
const F32 LOGIN_RETRY_SECONDS = 10.0f;
const int MAX_LOGIN_RETRIES = 12;
+// Cosine of a "trivially" small angle
+const F32 MINUSCULE_ANGLE_COS = 0.999f;
+
// Defines the maximum number of times(in a row) "stateJoiningSession" case for spatial channel is reached in stateMachine()
// which is treated as normal. The is the number of frames to wait for a channel join before giving up. This was changed
// from the original count of 50 for two reason. Modern PCs have higher frame rates and sometimes the SLVoice process
@@ -2397,10 +2400,12 @@ void LLVivoxVoiceClient::sendPositionalUpdate(void)
stream << "<SpeakerPosition>";
+ LLMatrix3 avatarRot = mAvatarRot.getMatrix3();
+
// LL_DEBUGS("Voice") << "Sending speaker position " << mAvatarPosition << LL_ENDL;
- l = mAvatarRot.getLeftRow();
- u = mAvatarRot.getUpRow();
- a = mAvatarRot.getFwdRow();
+ l = avatarRot.getLeftRow();
+ u = avatarRot.getUpRow();
+ a = avatarRot.getFwdRow();
pos = mAvatarPosition;
vel = mAvatarVelocity;
@@ -2464,7 +2469,7 @@ void LLVivoxVoiceClient::sendPositionalUpdate(void)
case earLocAvatar:
earPosition = mAvatarPosition;
earVelocity = mAvatarVelocity;
- earRot = mAvatarRot;
+ earRot = avatarRot;
break;
case earLocMixed:
@@ -4518,6 +4523,7 @@ void LLVivoxVoiceClient::updatePosition(void)
{
LLMatrix3 rot;
LLVector3d pos;
+ LLQuaternion qrot;
// TODO: If camera and avatar velocity are actually used by the voice system, we could compute them here...
// They're currently always set to zero.
@@ -4532,7 +4538,7 @@ void LLVivoxVoiceClient::updatePosition(void)
rot); // rotation matrix
// Send the current avatar position to the voice code
- rot = gAgentAvatarp->getRootJoint()->getWorldRotation().getMatrix3();
+ qrot = gAgentAvatarp->getRootJoint()->getWorldRotation();
pos = gAgentAvatarp->getPositionGlobal();
// TODO: Can we get the head offset from outside the LLVOAvatar?
@@ -4542,7 +4548,7 @@ void LLVivoxVoiceClient::updatePosition(void)
LLVivoxVoiceClient::getInstance()->setAvatarPosition(
pos, // position
LLVector3::zero, // velocity
- rot); // rotation matrix
+ qrot); // rotation matrix
}
}
@@ -4563,7 +4569,7 @@ void LLVivoxVoiceClient::setCameraPosition(const LLVector3d &position, const LLV
}
}
-void LLVivoxVoiceClient::setAvatarPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot)
+void LLVivoxVoiceClient::setAvatarPosition(const LLVector3d &position, const LLVector3 &velocity, const LLQuaternion &rot)
{
if(dist_vec_squared(mAvatarPosition, position) > 0.01)
{
@@ -4577,8 +4583,9 @@ void LLVivoxVoiceClient::setAvatarPosition(const LLVector3d &position, const LLV
mSpatialCoordsDirty = true;
}
- if(mAvatarRot != rot)
- {
+ if ((mAvatarRot != rot) && (llabs(dot(mAvatarRot, rot)) > MINUSCULE_ANGLE_COS))
+ { // if the two rotations are not exactly equal test their dot product
+ // to get the cos of the angle between them. If it is minuscule don't update.
mAvatarRot = rot;
mSpatialCoordsDirty = true;
}
diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h
index 83911f91f8..0054c7cca4 100755
--- a/indra/newview/llvoicevivox.h
+++ b/indra/newview/llvoicevivox.h
@@ -446,7 +446,7 @@ protected:
// Sending updates of current state
void updatePosition(void);
void setCameraPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot);
- void setAvatarPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot);
+ void setAvatarPosition(const LLVector3d &position, const LLVector3 &velocity, const LLQuaternion &rot);
bool channelFromRegion(LLViewerRegion *region, std::string &name);
void setEarLocation(S32 loc);
@@ -735,7 +735,7 @@ private:
LLVector3d mAvatarPosition;
LLVector3 mAvatarVelocity;
- LLMatrix3 mAvatarRot;
+ LLQuaternion mAvatarRot;
bool mMuteMic;
bool mMuteMicDirty;