summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorRoxie Linden <roxie@lindenlab.com>2023-12-24 00:05:46 -0800
committerRoxie Linden <roxie@lindenlab.com>2024-02-08 18:34:02 -0800
commit423892d0236dd202586f86dcf53c7d363553d859 (patch)
treea52d047dbbabc0b490281ce143bb73770f906eb9 /indra
parentec59d2477f686b7e2ee036bbc5a871d9fc735461 (diff)
Don't need to send level data up to the server anymore
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llvoicewebrtc.cpp102
-rw-r--r--indra/newview/llvoicewebrtc.h9
2 files changed, 39 insertions, 72 deletions
diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp
index b3de360aa9..99061c00da 100644
--- a/indra/newview/llvoicewebrtc.cpp
+++ b/indra/newview/llvoicewebrtc.cpp
@@ -508,45 +508,43 @@ void LLWebRTCVoiceClient::voiceConnectionCoro()
}
mNeighboringRegions.insert(regionp->getRegionID());
bool voiceEnabled = mVoiceEnabled && regionp->isVoiceEnabled();
- if ((!mAudioSession || mAudioSession->isSpatial()) && !mNextAudioSession)
- {
- // check to see if parcel changed.
- std::string channelID = "Estate";
- S32 parcel_local_id = INVALID_PARCEL_ID;
+ // check to see if parcel changed.
+ std::string channelID = "Estate";
+ S32 parcel_local_id = INVALID_PARCEL_ID;
- if (voiceEnabled)
+ if (voiceEnabled)
+ {
+ LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+ if (parcel && parcel->getLocalID() != INVALID_PARCEL_ID)
{
- LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
- if (parcel && parcel->getLocalID() != INVALID_PARCEL_ID)
+ if (!parcel->getParcelFlagAllowVoice())
{
- if (!parcel->getParcelFlagAllowVoice())
- {
- channelID.clear();
- }
- else if (!parcel->getParcelFlagUseEstateVoiceChannel())
- {
- parcel_local_id = parcel->getLocalID();
- channelID = regionp->getRegionID().asString() + "-" + std::to_string(parcel->getLocalID());
- }
+ channelID.clear();
+ }
+ else if (!parcel->getParcelFlagUseEstateVoiceChannel())
+ {
+ parcel_local_id = parcel->getLocalID();
+ channelID = regionp->getRegionID().asString() + "-" + std::to_string(parcel->getLocalID());
}
}
- else
- {
- channelID.clear();
- }
+ }
+ else
+ {
+ channelID.clear();
+ }
- if ((mNextAudioSession && channelID != mNextAudioSession->mChannelID) ||
- (!mAudioSession && !channelID.empty()) ||
- (mAudioSession && channelID != mAudioSession->mChannelID))
- {
- setSpatialChannel(channelID, "", parcel_local_id);
- }
+ if ((mNextAudioSession && channelID != mNextAudioSession->mChannelID) ||
+ (!mAudioSession && !mNextAudioSession && !channelID.empty()) ||
+ (mAudioSession && channelID != mAudioSession->mChannelID))
+ {
+ setSpatialChannel(channelID, "", parcel_local_id);
}
+
sessionState::processSessionStates();
if (voiceEnabled)
{
updatePosition();
- sendPositionAndVolumeUpdate(true);
+ sendPositionUpdate(true);
updateOwnVolume();
}
}
@@ -752,25 +750,14 @@ void LLWebRTCVoiceClient::setHidden(bool hidden)
}
else
{
- sendPositionAndVolumeUpdate(true);
+ sendPositionUpdate(true);
}
}
-void LLWebRTCVoiceClient::sendPositionAndVolumeUpdate(bool force)
+void LLWebRTCVoiceClient::sendPositionUpdate(bool force)
{
Json::FastWriter writer;
std::string spatial_data;
- std::string volume_data;
-
- F32 audio_level = 0.0;
- uint32_t uint_audio_level = 0.0;
-
- if (!mMuteMic && !mTuningMode)
- {
- audio_level = getAudioLevel();
- uint_audio_level = (uint32_t) (audio_level*128);
-
- }
if (mSpatialCoordsDirty || force)
{
@@ -797,21 +784,10 @@ void LLWebRTCVoiceClient::sendPositionAndVolumeUpdate(bool force)
spatial["lh"]["w"] = (int) (mListenerRot[3] * 100);
mSpatialCoordsDirty = false;
- if (force || (uint_audio_level != mAudioLevel))
- {
- spatial["p"] = uint_audio_level;
- }
spatial_data = writer.write(spatial);
- }
- if (force || (uint_audio_level != mAudioLevel))
- {
- Json::Value volume = Json::objectValue;
- volume["p"] = uint_audio_level;
- volume_data = writer.write(volume);
- }
- mAudioLevel = uint_audio_level;
- sessionState::for_each(boost::bind(predSendData, _1, spatial_data, volume_data));
+ sessionState::for_each(boost::bind(predSendData, _1, spatial_data));
+ }
}
void LLWebRTCVoiceClient::updateOwnVolume() {
@@ -834,16 +810,12 @@ void LLWebRTCVoiceClient::predUpdateOwnVolume(const LLWebRTCVoiceClient::session
}
}
-void LLWebRTCVoiceClient::predSendData(const LLWebRTCVoiceClient::sessionStatePtr_t& session, const std::string& spatial_data, const std::string& volume_data)
+void LLWebRTCVoiceClient::predSendData(const LLWebRTCVoiceClient::sessionStatePtr_t& session, const std::string& spatial_data)
{
if (session->isSpatial() && !spatial_data.empty())
{
session->sendData(spatial_data);
}
- else if (!volume_data.empty())
- {
- session->sendData(volume_data);
- }
}
void LLWebRTCVoiceClient::sessionState::sendData(const std::string &data)
@@ -966,6 +938,7 @@ LLWebRTCVoiceClient::participantStatePtr_t LLWebRTCVoiceClient::sessionState::ad
// participant isn't already in one list or the other.
result.reset(new participantState(agent_id));
mParticipantsByURI.insert(participantMap::value_type(agent_id.asString(), result));
+ mParticipantsByUUID.insert(participantUUIDMap::value_type(agent_id, result));
mParticipantsChanged = true;
result->mAvatarIDValid = true;
@@ -975,8 +948,6 @@ LLWebRTCVoiceClient::participantStatePtr_t LLWebRTCVoiceClient::sessionState::ad
{
mMuteDirty = true;
}
-
- mParticipantsByUUID.insert(participantUUIDMap::value_type(result->mAvatarID, result));
if (LLSpeakerVolumeStorage::getInstance()->getSpeakerVolume(result->mAvatarID, result->mVolume))
{
@@ -1682,7 +1653,8 @@ void LLWebRTCVoiceClient::setVoiceEnabled(bool enabled)
LL_DEBUGS("Voice") << "enabling" << LL_ENDL;
LLVoiceChannel::getCurrentVoiceChannel()->activate();
status = LLVoiceClientStatusObserver::STATUS_VOICE_ENABLED;
-
+ mSpatialCoordsDirty = true;
+ updatePosition();
if (!mIsCoroutineActive)
{
LLCoros::instance().launch("LLWebRTCVoiceClient::voiceConnectionCoro",
@@ -1967,8 +1939,6 @@ LLWebRTCVoiceClient::sessionState::ptr_t LLWebRTCVoiceClient::sessionState::crea
sessionState::ptr_t session(new sessionState());
session->mChannelID = channelID;
session->mWebRTCConnections.emplace_back(new LLVoiceWebRTCConnection(region_id, parcelLocalID, channelID));
-
- session->mPrimaryConnectionID = channelID;
// add agent as participant
session->addParticipant(gAgentID);
@@ -2548,7 +2518,8 @@ void LLVoiceWebRTCConnection::OnDataChannelReady(llwebrtc::LLWebRTCDataInterface
Json::FastWriter writer;
Json::Value root = Json::objectValue;
Json::Value join_obj = Json::objectValue;
- if (gAgent.getRegion()->getRegionID() == mRegionID)
+ LLUUID regionID = gAgent.getRegion()->getRegionID();
+ if (regionID == mRegionID)
{
join_obj["p"] = true;
}
@@ -2868,6 +2839,7 @@ bool LLVoiceWebRTCConnection::breakVoiceConnection(bool corowait)
if (!regionp || !regionp->capabilitiesReceived())
{
LL_DEBUGS("Voice") << "no capabilities for voice provisioning; waiting " << LL_ENDL;
+ setVoiceConnectionState(VOICE_STATE_WAIT_FOR_EXIT);
return false;
}
diff --git a/indra/newview/llvoicewebrtc.h b/indra/newview/llvoicewebrtc.h
index f89501e15c..f042ecca85 100644
--- a/indra/newview/llvoicewebrtc.h
+++ b/indra/newview/llvoicewebrtc.h
@@ -244,7 +244,7 @@ public:
void OnConnectionEstablished(const std::string& channelID, const LLUUID& regionID);
void OnConnectionFailure(const std::string &channelID, const LLUUID& regionID);
- void sendPositionAndVolumeUpdate(bool force);
+ void sendPositionUpdate(bool force);
void updateOwnVolume();
//////////////////////////////
@@ -396,7 +396,6 @@ public:
private:
std::list<connectionPtr_t> mWebRTCConnections;
- std::string mPrimaryConnectionID;
static std::map<std::string, ptr_t> mSessions; // canonical list of outstanding sessions.
sessionState();
@@ -416,7 +415,7 @@ public:
// Private Member Functions
//////////////////////////////////////////////////////
- static void predSendData(const LLWebRTCVoiceClient::sessionStatePtr_t &session, const std::string& spatial_data, const std::string& volume_data);
+ static void predSendData(const LLWebRTCVoiceClient::sessionStatePtr_t &session, const std::string& spatial_data);
static void predUpdateOwnVolume(const LLWebRTCVoiceClient::sessionStatePtr_t &session, F32 audio_level);
static void predSetMuteMic(const LLWebRTCVoiceClient::sessionStatePtr_t &session, bool mute);
static void predSetMicGain(const LLWebRTCVoiceClient::sessionStatePtr_t &session, F32 volume);
@@ -597,8 +596,6 @@ private:
LLVoiceDeviceList mCaptureDevices;
LLVoiceDeviceList mRenderDevices;
- uint32_t mAudioLevel;
-
bool mIsInitialized;
bool mShutdownComplete;
@@ -843,8 +840,6 @@ protected:
F32 mMicGain;
F32 mSpeakerVolume;
- bool mPrimary;
-
std::vector<llwebrtc::LLWebRTCIceCandidate> mIceCandidates;
bool mIceCompleted;
bool mTrickling;