diff options
author | Roxie Linden <roxie@lindenlab.com> | 2023-09-21 22:33:57 -0700 |
---|---|---|
committer | Roxie Linden <roxie@lindenlab.com> | 2024-02-22 23:11:34 -0800 |
commit | dc56d0104d1c54fd2b9c6925cefbeac04eadcca8 (patch) | |
tree | 590555077fc510267c1d29b81e402d7aef647305 /indra/newview/llvoicewebrtc.cpp | |
parent | 1cd8f6f4f88f7717f0fcafbb5d47de0af59d5fb7 (diff) |
deal with add/remove of participants more effectively.
Diffstat (limited to 'indra/newview/llvoicewebrtc.cpp')
-rw-r--r-- | indra/newview/llvoicewebrtc.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index da27ff7320..a942eb8288 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -2619,7 +2619,7 @@ void LLWebRTCVoiceClient::OnAudioLevel(float level) { Json::FastWriter writer; Json::Value root; - root["p"] = (UINT32) (level * 256); + root["p"] = (uint32_t) (level * 256); std::string json_data = writer.write(root); mWebRTCDataInterface->sendData(json_data, false); @@ -2656,9 +2656,6 @@ void LLWebRTCVoiceClient::OnDataReceived(const std::string& data, bool binary) } for (auto &participant_id : voice_data.getMemberNames()) { - std::string foo = participant_id; - LL_WARNS("Voice") << "Participant ID (" << participant_id << "):" << data << LL_ENDL; - LLUUID agent_id(participant_id); if (agent_id.isNull()) { @@ -2666,8 +2663,16 @@ void LLWebRTCVoiceClient::OnDataReceived(const std::string& data, bool binary) continue; } participantStatePtr_t participant = findParticipantByID(agent_id); + if (!participant && voice_data[participant_id].get("j", Json::Value(false)).asBool()) + { + participant = addParticipantByID(agent_id); + } if (participant) { + if(voice_data[participant_id].get("l", Json::Value(false)).asBool()) + { + removeParticipantByID(agent_id); + } participant->mPower = (F32) (voice_data[participant_id].get("p", Json::Value(participant->mPower)).asInt()) / 256; /* 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. */ @@ -3842,6 +3847,18 @@ LLWebRTCVoiceClient::participantStatePtr_t LLWebRTCVoiceClient::addParticipantBy return result; } +void LLWebRTCVoiceClient::removeParticipantByID(const LLUUID &id) +{ + participantStatePtr_t result; + if (mAudioSession) + { + participantStatePtr_t participant = mAudioSession->findParticipantByID(id); + if (participant) + { + mAudioSession->removeParticipant(participant); + } + } +} // Check for parcel boundary crossing |