summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorRoxie Linden <roxie@lindenlab.com>2023-09-28 15:33:42 -0700
committerRoxie Linden <roxie@lindenlab.com>2024-02-08 18:34:01 -0800
commit84f6d30afa86b9ff2a273ce98a00667e81506a1e (patch)
tree1ce01948b694d183b52bc438d1d33a31f33c6fe8 /indra
parentd093ca0523c1162353e2553c016c15d41ab014ff (diff)
when a peer joins, notify them of position and heading
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llvoicewebrtc.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp
index ccaa02b704..d97d4847ee 100644
--- a/indra/newview/llvoicewebrtc.cpp
+++ b/indra/newview/llvoicewebrtc.cpp
@@ -2514,6 +2514,7 @@ void LLWebRTCVoiceClient::OnDataReceived(const std::string& data, bool binary)
LL_WARNS("Voice") << "Expected object from data channel:" << data << LL_ENDL;
return;
}
+ bool new_participant = false;
for (auto &participant_id : voice_data.getMemberNames())
{
LLUUID agent_id(participant_id);
@@ -2525,6 +2526,7 @@ void LLWebRTCVoiceClient::OnDataReceived(const std::string& data, bool binary)
participantStatePtr_t participant = findParticipantByID(agent_id);
if (!participant && voice_data[participant_id].get("j", Json::Value(false)).asBool())
{
+ new_participant = true;
participant = addParticipantByID(agent_id);
}
if (participant)
@@ -2538,9 +2540,16 @@ void LLWebRTCVoiceClient::OnDataReceived(const std::string& data, bool binary)
participant->mPower = energyRMS;
/* WebRTC appears to have deprecated VAD, but it's still in the Audio Processing Module so maybe we
can use it at some point when we actually process frames. */
- participant->mIsSpeaking = participant->mPower > SPEAKING_AUDIO_LEVEL;
+ participant->mIsSpeaking = participant->mPower > SPEAKING_AUDIO_LEVEL;
}
}
+ if (new_participant)
+ {
+ Json::FastWriter writer;
+ Json::Value root = getPositionAndVolumeUpdateJson(true);
+ std::string json_data = writer.write(root);
+ mWebRTCDataInterface->sendData(json_data, false);
+ }
}
}
@@ -4493,7 +4502,7 @@ F32 LLWebRTCVoiceClient::getCurrentPower(const LLUUID &id)
participantStatePtr_t participant(findParticipantByID(id));
if (participant)
{
- result = participant->mPower * 3.5;
+ result = participant->mPower * 3.0;
}
return result;
}