summaryrefslogtreecommitdiff
path: root/indra/newview/llvoicewebrtc.cpp
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2024-08-31 21:25:47 +0800
committerErik Kundiman <erik@megapahit.org>2024-09-01 20:43:42 +0800
commit95582654e49422d51b55665c3f2821c848ad1cb8 (patch)
treed6d03a887b8e1b6c3be1b139d63b1638c5d0fdcd /indra/newview/llvoicewebrtc.cpp
parentab3f483a3e5ed213882a83b882095cfdb6a4de57 (diff)
parentb0fefd62adbf51f32434ba077e9f52d8a9241d15 (diff)
Merge remote-tracking branch 'secondlife/release/2024.08-DeltaFPS' into 2024.08-DeltaFPS
Diffstat (limited to 'indra/newview/llvoicewebrtc.cpp')
-rw-r--r--indra/newview/llvoicewebrtc.cpp67
1 files changed, 32 insertions, 35 deletions
diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp
index 2b22aa12d6..22b53c0b85 100644
--- a/indra/newview/llvoicewebrtc.cpp
+++ b/indra/newview/llvoicewebrtc.cpp
@@ -24,9 +24,6 @@
* $/LicenseInfo$
*/
#include <algorithm>
-#if !LL_LINUX
-#include <format>
-#endif
#include "llvoicewebrtc.h"
#include "llsdutil.h"
@@ -332,7 +329,7 @@ const LLVoiceVersionInfo& LLWebRTCVoiceClient::getVersion()
void LLWebRTCVoiceClient::updateSettings()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE;
setVoiceEnabled(LLVoiceClient::getInstance()->voiceEnabled());
static LLCachedControl<S32> sVoiceEarLocation(gSavedSettings, "VoiceEarLocation");
@@ -377,7 +374,7 @@ void LLWebRTCVoiceClient::removeObserver(LLVoiceClientParticipantObserver *obser
void LLWebRTCVoiceClient::notifyParticipantObservers()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE;
for (observer_set_t::iterator it = mParticipantObservers.begin(); it != mParticipantObservers.end();)
{
LLVoiceClientParticipantObserver *observer = *it;
@@ -399,7 +396,7 @@ void LLWebRTCVoiceClient::removeObserver(LLVoiceClientStatusObserver *observer)
void LLWebRTCVoiceClient::notifyStatusObservers(LLVoiceClientStatusObserver::EStatusType status)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE;
LL_DEBUGS("Voice") << "( " << LLVoiceClientStatusObserver::status2string(status) << " )"
<< " mSession=" << mSession << LL_ENDL;
@@ -590,7 +587,7 @@ void LLWebRTCVoiceClient::voiceConnectionCoro()
// for cross-region voice.
void LLWebRTCVoiceClient::updateNeighboringRegions()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE;
static const std::vector<LLVector3d> neighbors {LLVector3d(0.0f, 1.0f, 0.0f), LLVector3d(0.707f, 0.707f, 0.0f),
LLVector3d(1.0f, 0.0f, 0.0f), LLVector3d(0.707f, -0.707f, 0.0f),
@@ -623,7 +620,7 @@ void LLWebRTCVoiceClient::updateNeighboringRegions()
// shut down the current audio session to make room for the next one.
void LLWebRTCVoiceClient::leaveAudioSession()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE;
if(mSession)
{
@@ -683,7 +680,7 @@ void LLWebRTCVoiceClient::OnDevicesChangedImpl(const llwebrtc::LLWebRTCVoiceDevi
{
return;
}
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE;
std::string inputDevice = gSavedSettings.getString("VoiceInputAudioDevice");
std::string outputDevice = gSavedSettings.getString("VoiceOutputAudioDevice");
@@ -763,7 +760,7 @@ void LLWebRTCVoiceClient::tuningSetSpeakerVolume(float volume)
if (volume != mTuningSpeakerVolume)
{
- mTuningSpeakerVolume = volume;
+ mTuningSpeakerVolume = (int)volume;
}
}
@@ -771,11 +768,11 @@ float LLWebRTCVoiceClient::getAudioLevel()
{
if (mIsInTuningMode)
{
- return (1.0 - mWebRTCDeviceInterface->getTuningAudioLevel() * LEVEL_SCALE_WEBRTC) * mTuningMicGain / 2.1;
+ return (1.0f - mWebRTCDeviceInterface->getTuningAudioLevel() * LEVEL_SCALE_WEBRTC) * mTuningMicGain / 2.1f;
}
else
{
- return (1.0 - mWebRTCDeviceInterface->getPeerConnectionAudioLevel() * LEVEL_SCALE_WEBRTC) * mMicGain / 2.1;
+ return (1.0f - mWebRTCDeviceInterface->getPeerConnectionAudioLevel() * LEVEL_SCALE_WEBRTC) * mMicGain / 2.1f;
}
}
@@ -850,7 +847,7 @@ void LLWebRTCVoiceClient::setHidden(bool hidden)
// notify the observers.
void LLWebRTCVoiceClient::OnConnectionEstablished(const std::string &channelID, const LLUUID &regionID)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE;
if (gAgent.getRegion()->getRegionID() == regionID)
{
@@ -934,7 +931,7 @@ void LLWebRTCVoiceClient::setEarLocation(S32 loc)
void LLWebRTCVoiceClient::updatePosition(void)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE;
LLViewerRegion *region = gAgent.getRegion();
if (region && isAgentAvatarValid())
@@ -1063,7 +1060,7 @@ void LLWebRTCVoiceClient::enforceTether()
// standard 50m
void LLWebRTCVoiceClient::sendPositionUpdate(bool force)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE;
std::string spatial_data;
@@ -1179,7 +1176,7 @@ LLWebRTCVoiceClient::participantStatePtr_t LLWebRTCVoiceClient::addParticipantBy
void LLWebRTCVoiceClient::removeParticipantByID(const std::string &channelID, const LLUUID &id, const LLUUID& region)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE;
participantStatePtr_t result;
LLWebRTCVoiceClient::sessionState::ptr_t session = sessionState::matchSessionByChannelID(channelID);
@@ -1209,7 +1206,7 @@ LLWebRTCVoiceClient::participantState::participantState(const LLUUID& agent_id,
LLWebRTCVoiceClient::participantStatePtr_t LLWebRTCVoiceClient::sessionState::addParticipant(const LLUUID& agent_id, const LLUUID& region)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE;
participantStatePtr_t result;
@@ -1247,7 +1244,7 @@ LLWebRTCVoiceClient::participantStatePtr_t LLWebRTCVoiceClient::sessionState::ad
LLWebRTCVoiceClient::participantStatePtr_t LLWebRTCVoiceClient::sessionState::findParticipantByID(const LLUUID& id)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE;
participantStatePtr_t result;
participantUUIDMap::iterator iter = mParticipantsByUUID.find(id);
@@ -1262,7 +1259,7 @@ LLWebRTCVoiceClient::participantStatePtr_t LLWebRTCVoiceClient::sessionState::fi
void LLWebRTCVoiceClient::sessionState::removeParticipant(const LLWebRTCVoiceClient::participantStatePtr_t &participant)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE;
if (participant)
{
@@ -1545,7 +1542,7 @@ void LLWebRTCVoiceClient::setMicGain(F32 gain)
void LLWebRTCVoiceClient::setVoiceEnabled(bool enabled)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE;
LL_DEBUGS("Voice")
<< "( " << (enabled ? "enabled" : "disabled") << " )"
@@ -1951,7 +1948,7 @@ void LLWebRTCVoiceClient::sessionState::revive()
void LLWebRTCVoiceClient::sessionState::processSessionStates()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE;
auto iter = sSessions.begin();
while (iter != sSessions.end())
@@ -1972,7 +1969,7 @@ void LLWebRTCVoiceClient::sessionState::processSessionStates()
// process the states on each connection associated with a session.
bool LLWebRTCVoiceClient::sessionState::processConnectionStates()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE;
std::list<connectionPtr_t>::iterator iter = mWebRTCConnections.begin();
while (iter != mWebRTCConnections.end())
@@ -1996,7 +1993,7 @@ bool LLWebRTCVoiceClient::sessionState::processConnectionStates()
// on our location.
bool LLWebRTCVoiceClient::estateSessionState::processConnectionStates()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE;
if (!mShuttingDown)
{
@@ -2167,7 +2164,7 @@ LLVoiceWebRTCConnection::LLVoiceWebRTCConnection(const LLUUID &regionID, const s
// retries wait a short period...randomize it so
// all clients don't try to reconnect at once.
- mRetryWaitSecs = ((F32) rand() / (RAND_MAX)) + 0.5;
+ mRetryWaitSecs = (F32)((F32) rand() / (RAND_MAX)) + 0.5f;
mWebRTCPeerConnectionInterface = llwebrtc::newPeerConnection();
mWebRTCPeerConnectionInterface->setSignalingObserver(this);
@@ -2240,7 +2237,7 @@ void LLVoiceWebRTCConnection::processIceUpdates()
// will make the cap call to the server sending up the ICE candidates.
void LLVoiceWebRTCConnection::processIceUpdatesCoro(connectionPtr_t connection)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE;
if (connection->mShutDown || LLWebRTCVoiceClient::isShuttingDown())
{
@@ -2473,7 +2470,7 @@ void LLVoiceWebRTCConnection::sendData(const std::string &data)
// The simulator will pass this on to the Secondlife WebRTC server.
void LLVoiceWebRTCConnection::breakVoiceConnectionCoro(connectionPtr_t connection)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE;
LL_DEBUGS("Voice") << "Disconnecting voice." << LL_ENDL;
if (connection->mWebRTCDataInterface)
@@ -2536,7 +2533,7 @@ void LLVoiceWebRTCConnection::breakVoiceConnectionCoro(connectionPtr_t connectio
// will use the offer and answer to negotiate the session.
void LLVoiceWebRTCSpatialConnection::requestVoiceConnection()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE;
LLViewerRegion *regionp = LLWorld::instance().getRegionFromID(mRegionID);
@@ -2609,7 +2606,7 @@ void LLVoiceWebRTCSpatialConnection::requestVoiceConnection()
void LLVoiceWebRTCConnection::OnVoiceConnectionRequestSuccess(const LLSD &result)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE;
if (LLWebRTCVoiceClient::isShuttingDown())
{
@@ -2664,7 +2661,7 @@ static llwebrtc::LLWebRTCPeerConnectionInterface::InitOptions getConnectionOptio
// Secondlife WebRTC server.
bool LLVoiceWebRTCConnection::connectionStateMachine()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE;
processIceUpdates();
@@ -2760,7 +2757,7 @@ bool LLVoiceWebRTCConnection::connectionStateMachine()
case VOICE_STATE_SESSION_UP:
{
mRetryWaitPeriod = 0;
- mRetryWaitSecs = ((F32) rand() / (RAND_MAX)) + 0.5;
+ mRetryWaitSecs = (F32)((F32) rand() / (RAND_MAX)) + 0.5f;
LLUUID agentRegionID;
if (isSpatial() && gAgent.getRegion())
{
@@ -2793,7 +2790,7 @@ bool LLVoiceWebRTCConnection::connectionStateMachine()
{
// back off the retry period, and do it by a small random
// bit so all clients don't reconnect at once.
- mRetryWaitSecs += ((F32) rand() / (RAND_MAX)) + 0.5;
+ mRetryWaitSecs += (F32)((F32) rand() / (RAND_MAX)) + 0.5f;
mRetryWaitPeriod = 0;
}
}
@@ -2882,7 +2879,7 @@ void LLVoiceWebRTCConnection::OnDataReceived(const std::string& data, bool binar
// this pointer.
void LLVoiceWebRTCConnection::OnDataReceivedImpl(const std::string &data, bool binary)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE;
if (mShutDown)
{
@@ -2895,7 +2892,7 @@ void LLVoiceWebRTCConnection::OnDataReceivedImpl(const std::string &data, bool b
return;
}
- boost::json::error_code ec;
+ boost::system::error_code ec;
boost::json::value voice_data_parsed = boost::json::parse(data, ec);
if (!ec) // don't collect comments
{
@@ -3049,7 +3046,7 @@ void LLVoiceWebRTCConnection::OnDataChannelReady(llwebrtc::LLWebRTCDataInterface
// to peers.
void LLVoiceWebRTCConnection::sendJoin()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE;
boost::json::object root;
@@ -3127,7 +3124,7 @@ LLVoiceWebRTCAdHocConnection::~LLVoiceWebRTCAdHocConnection()
// So, we have a separate requestVoiceConnection call.
void LLVoiceWebRTCAdHocConnection::requestVoiceConnection()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE;
LLViewerRegion *regionp = LLWorld::instance().getRegionFromID(mRegionID);