diff options
author | Roxie Linden <roxie@lindenlab.com> | 2023-09-28 15:33:42 -0700 |
---|---|---|
committer | Roxie Linden <roxie@lindenlab.com> | 2024-02-22 23:11:34 -0800 |
commit | bdf6c299754fef09ab6d836888931588174b6e89 (patch) | |
tree | 56d326205d9fd42cbcbdbc57ad637bca79eba5bd | |
parent | 4359b574e8ed505b3f4019f70823e34cf571ba76 (diff) |
when a peer joins, notify them of position and heading
-rw-r--r-- | indra/newview/llvoicewebrtc.cpp | 13 |
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; } |