diff options
author | Roxie Linden <roxie@lindenlab.com> | 2023-12-19 18:37:34 -0800 |
---|---|---|
committer | Roxie Linden <roxie@lindenlab.com> | 2024-02-08 18:34:02 -0800 |
commit | ec59d2477f686b7e2ee036bbc5a871d9fc735461 (patch) | |
tree | e8a4c668ec0cb4b2cd98ce21b959b1b163a05deb /indra/newview/llvoicewebrtc.cpp | |
parent | d2fee1c3450a71db5d88b2746ba8e2c468960ea6 (diff) |
add concept of primary/secondary connections
Diffstat (limited to 'indra/newview/llvoicewebrtc.cpp')
-rw-r--r-- | indra/newview/llvoicewebrtc.cpp | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index 0c9c5c5bdd..b3de360aa9 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -5,7 +5,7 @@ * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2023, Linden Research, Inc. - * + * ne * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; @@ -506,6 +506,7 @@ void LLWebRTCVoiceClient::voiceConnectionCoro() { continue; } + mNeighboringRegions.insert(regionp->getRegionID()); bool voiceEnabled = mVoiceEnabled && regionp->isVoiceEnabled(); if ((!mAudioSession || mAudioSession->isSpatial()) && !mNextAudioSession) { @@ -541,10 +542,6 @@ void LLWebRTCVoiceClient::voiceConnectionCoro() setSpatialChannel(channelID, "", parcel_local_id); } } - else - { - - } sessionState::processSessionStates(); if (voiceEnabled) { @@ -822,7 +819,6 @@ void LLWebRTCVoiceClient::updateOwnVolume() { if (!mMuteMic && !mTuningMode) { audio_level = getAudioLevel(); - LL_WARNS("Voice") << "Level " << audio_level << LL_ENDL; } sessionState::for_each(boost::bind(predUpdateOwnVolume, _1, audio_level)); @@ -2509,9 +2505,16 @@ void LLVoiceWebRTCConnection::OnDataReceived(const std::string &data, bool binar } LLWebRTCVoiceClient::participantStatePtr_t participant = LLWebRTCVoiceClient::getInstance()->findParticipantByID(mChannelID, agent_id); - bool joined = voice_data[participant_id].get("j", Json::Value(false)).asBool(); + bool joined = false; + bool primary = false; + if (voice_data[participant_id].isMember("j")) + { + joined = true; + primary = voice_data[participant_id]["j"].get("p", Json::Value(false)).asBool(); + } + new_participant |= joined; - if (!participant && joined) + if (!participant && joined && primary) { participant = LLWebRTCVoiceClient::getInstance()->addParticipantByID(mChannelID, agent_id); } @@ -2541,9 +2544,15 @@ void LLVoiceWebRTCConnection::OnDataChannelReady(llwebrtc::LLWebRTCDataInterface { mWebRTCDataInterface = data_interface; mWebRTCDataInterface->setDataObserver(this); + Json::FastWriter writer; - Json::Value root = Json::objectValue; - root["j"] = true; + Json::Value root = Json::objectValue; + Json::Value join_obj = Json::objectValue; + if (gAgent.getRegion()->getRegionID() == mRegionID) + { + join_obj["p"] = true; + } + root["j"] = join_obj; std::string json_data = writer.write(root); mWebRTCDataInterface->sendData(json_data, false); } |