summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-10-22 11:35:41 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-10-22 11:35:41 -0400
commitc729b5ae1c78e7b67c47a30cd586f42d84f0c156 (patch)
tree87d63e22e920cd16877bca551ab96b4c9c6f4927 /indra/newview
parentb0645835595f3517223329ba62f46277d3e3a9dd (diff)
parenta86c53c212f9c80f710477816dccda9abce576ef (diff)
Merge branch 'develop' of github.com:secondlife/viewer into nat/warn-timeslice
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llavataractions.cpp23
-rw-r--r--indra/newview/llavataractions.h9
-rw-r--r--indra/newview/llfloaterbump.cpp7
-rw-r--r--indra/newview/llfloaterbump.h1
-rw-r--r--indra/newview/llfloaterimcontainer.cpp10
-rw-r--r--indra/newview/llpanelprofile.cpp16
-rw-r--r--indra/newview/llpanelprofile.h7
-rw-r--r--indra/newview/llviewerdisplay.cpp4
-rw-r--r--indra/newview/llviewermenu.cpp20
-rw-r--r--indra/newview/llviewerstats.cpp19
-rw-r--r--indra/newview/llviewerstats.h1
-rw-r--r--indra/newview/llvoicevivox.cpp8
-rw-r--r--indra/newview/llvoicewebrtc.cpp198
-rw-r--r--indra/newview/llvoicewebrtc.h9
14 files changed, 170 insertions, 162 deletions
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp
index 6f6b89ea81..aff959d279 100644
--- a/indra/newview/llavataractions.cpp
+++ b/indra/newview/llavataractions.cpp
@@ -285,25 +285,18 @@ void LLAvatarActions::startAdhocCall(const uuid_vec_t& ids, const LLUUID& floate
make_ui_sound("UISndStartIM");
}
-/* AD *TODO: Is this function needed any more?
- I fixed it a bit(added check for canCall), but it appears that it is not used
- anywhere. Maybe it should be removed?
// static
-bool LLAvatarActions::isCalling(const LLUUID &id)
+bool LLAvatarActions::canCall()
{
- if (id.isNull() || !canCall())
- {
- return false;
- }
-
- LLUUID session_id = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL, id);
- return (LLIMModel::getInstance()->findIMSession(session_id) != NULL);
-}*/
+ LLVoiceClient* voice_client = LLVoiceClient::getInstance();
+ return voice_client->voiceEnabled() && voice_client->isVoiceWorking();
+}
-//static
-bool LLAvatarActions::canCall()
+// static
+bool LLAvatarActions::canCallTo(const LLUUID& id)
{
- return LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
+ LLVoiceClient* voice_client = LLVoiceClient::getInstance();
+ return voice_client->voiceEnabled() && voice_client->isVoiceWorking() && voice_client->getVoiceEnabled(id);
}
// static
diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h
index 1f5a42ed22..6f469e96ce 100644
--- a/indra/newview/llavataractions.h
+++ b/indra/newview/llavataractions.h
@@ -172,18 +172,15 @@ public:
static bool canBlock(const LLUUID& id);
/**
- * Return true if the avatar is in a P2P voice call with a given user
+ * @return true if voice calls are available
*/
- /* AD *TODO: Is this function needed any more?
- I fixed it a bit(added check for canCall), but it appears that it is not used
- anywhere. Maybe it should be removed?
- static bool isCalling(const LLUUID &id);*/
+ static bool canCall();
/**
* @return true if call to the resident can be made
*/
+ static bool canCallTo(const LLUUID& id);
- static bool canCall();
/**
* Invite avatar to a group.
*/
diff --git a/indra/newview/llfloaterbump.cpp b/indra/newview/llfloaterbump.cpp
index d56e6cdf20..2a4f1ddd12 100644
--- a/indra/newview/llfloaterbump.cpp
+++ b/indra/newview/llfloaterbump.cpp
@@ -56,7 +56,7 @@ LLFloaterBump::LLFloaterBump(const LLSD& key)
mCommitCallbackRegistrar.add("ShowAgentProfile", { boost::bind(&LLFloaterBump::showProfile, this), cb_info::UNTRUSTED_THROTTLE });
mCommitCallbackRegistrar.add("Avatar.InviteToGroup", { boost::bind(&LLFloaterBump::inviteToGroup, this), cb_info::UNTRUSTED_THROTTLE });
mCommitCallbackRegistrar.add("Avatar.Call", { boost::bind(&LLFloaterBump::startCall, this), cb_info::UNTRUSTED_BLOCK });
- mEnableCallbackRegistrar.add("Avatar.EnableCall", boost::bind(&LLAvatarActions::canCall));
+ mEnableCallbackRegistrar.add("Avatar.EnableCall", { boost::bind(&LLFloaterBump::canCall, this), cb_info::UNTRUSTED_BLOCK });
mCommitCallbackRegistrar.add("Avatar.AddFriend", { boost::bind(&LLFloaterBump::addFriend, this), cb_info::UNTRUSTED_THROTTLE });
mEnableCallbackRegistrar.add("Avatar.EnableAddFriend", boost::bind(&LLFloaterBump::enableAddFriend, this));
mCommitCallbackRegistrar.add("Avatar.Mute", { boost::bind(&LLFloaterBump::muteAvatar, this), cb_info::UNTRUSTED_BLOCK });
@@ -214,6 +214,11 @@ void LLFloaterBump::startCall()
LLAvatarActions::startCall(mItemUUID);
}
+bool LLFloaterBump::canCall()
+{
+ return LLAvatarActions::canCallTo(mItemUUID);
+}
+
void LLFloaterBump::reportAbuse()
{
LLFloaterReporter::showFromAvatar(mItemUUID, "av_name");
diff --git a/indra/newview/llfloaterbump.h b/indra/newview/llfloaterbump.h
index 53e730d73f..48d6f7e33e 100644
--- a/indra/newview/llfloaterbump.h
+++ b/indra/newview/llfloaterbump.h
@@ -52,6 +52,7 @@ public:
void startIM();
void startCall();
+ bool canCall();
void reportAbuse();
void showProfile();
void addFriend();
diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp
index 1e2d790cfc..ed24a8af57 100644
--- a/indra/newview/llfloaterimcontainer.cpp
+++ b/indra/newview/llfloaterimcontainer.cpp
@@ -1592,15 +1592,15 @@ bool LLFloaterIMContainer::enableContextMenuItem(const std::string& item, uuid_v
}
else if ("can_call" == item)
{
+ if (is_single_select)
+ {
+ return LLAvatarActions::canCallTo(single_id);
+ }
return LLAvatarActions::canCall();
}
else if ("can_open_voice_conversation" == item)
{
- return is_single_select && LLAvatarActions::canCall();
- }
- else if ("can_open_voice_conversation" == item)
- {
- return is_single_select && LLAvatarActions::canCall();
+ return is_single_select && LLAvatarActions::canCallTo(single_id);
}
else if ("can_zoom_in" == item)
{
diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp
index 2086706bf8..5c54a3fc27 100644
--- a/indra/newview/llpanelprofile.cpp
+++ b/indra/newview/llpanelprofile.cpp
@@ -754,8 +754,6 @@ void LLPanelProfileSecondLife::onOpen(const LLSD& key)
resetData();
- LLUUID avatar_id = getAvatarId();
-
bool own_profile = getSelfProfile();
mGroupList->setShowNone(!own_profile);
@@ -793,7 +791,6 @@ void LLPanelProfileSecondLife::onOpen(const LLSD& key)
if (!own_profile)
{
- mVoiceStatus = LLAvatarActions::canCall() && (LLAvatarActions::isFriend(avatar_id) ? LLAvatarTracker::instance().isBuddyOnline(avatar_id) : true);
updateOnlineStatus();
fillRightsData();
}
@@ -1214,17 +1211,6 @@ void LLPanelProfileSecondLife::changed(U32 mask)
}
}
-// virtual, called by LLVoiceClient
-void LLPanelProfileSecondLife::onChange(EStatusType status, const LLSD& channelInfo, bool proximal)
-{
- if(status == STATUS_JOINING || status == STATUS_LEFT_CHANNEL)
- {
- return;
- }
-
- mVoiceStatus = LLAvatarActions::canCall() && (LLAvatarActions::isFriend(getAvatarId()) ? LLAvatarTracker::instance().isBuddyOnline(getAvatarId()) : true);
-}
-
void LLPanelProfileSecondLife::setAvatarId(const LLUUID& avatar_id)
{
if (avatar_id.notNull())
@@ -1502,7 +1488,7 @@ bool LLPanelProfileSecondLife::onEnableMenu(const LLSD& userdata)
}
else if (item_name == "voice_call")
{
- return mVoiceStatus;
+ return LLAvatarActions::canCallTo(agent_id);
}
else if (item_name == "chat_history")
{
diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h
index c207a4162a..ba00e12441 100644
--- a/indra/newview/llpanelprofile.h
+++ b/indra/newview/llpanelprofile.h
@@ -33,7 +33,6 @@
#include "llpanel.h"
#include "llpanelavatar.h"
#include "llmediactrl.h"
-#include "llvoiceclient.h"
// class LLPanelProfileClassifieds;
// class LLTabContainer;
@@ -70,7 +69,6 @@ class LLViewerFetchedTexture;
class LLPanelProfileSecondLife
: public LLPanelProfilePropertiesProcessorTab
, public LLFriendObserver
- , public LLVoiceClientStatusObserver
{
public:
LLPanelProfileSecondLife();
@@ -89,10 +87,6 @@ public:
*/
void changed(U32 mask) override;
- // Implements LLVoiceClientStatusObserver::onChange() to enable the call
- // button when voice is available
- void onChange(EStatusType status, const LLSD& channelInfo, bool proximal) override;
-
void setAvatarId(const LLUUID& avatar_id) override;
bool postBuild() override;
@@ -203,7 +197,6 @@ private:
LLHandle<LLFloater> mFloaterTexturePickerHandle;
bool mHasUnsavedDescriptionChanges;
- bool mVoiceStatus;
bool mWaitingForImageUpload;
bool mAllowPublish;
bool mHideAge;
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index 1f4502323c..cb741e4af9 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -79,6 +79,7 @@
#include "llviewerparcelmgr.h"
#include "llviewerregion.h"
#include "llviewershadermgr.h"
+#include "llviewerstats.h"
#include "llviewertexturelist.h"
#include "llviewerwindow.h"
#include "llvoavatarself.h"
@@ -1085,6 +1086,9 @@ void getProfileStatsContext(boost::json::object& stats)
context.emplace("parcelid", parcel->getLocalID());
}
context.emplace("time", LLDate::now().toHTTPDateString("%Y-%m-%dT%H:%M:%S"));
+
+ // supplement with stats packet
+ stats.emplace("stats", LlsdToJson(capture_viewer_stats(true)));
}
std::string getProfileStatsFilename()
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 39213569a5..68c38c3692 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -7808,15 +7808,29 @@ class LLAvatarSendIM : public view_listener_t
class LLAvatarCall : public view_listener_t
{
+ static LLVOAvatar* findAvatar()
+ {
+ return find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject());
+ }
+
bool handleEvent(const LLSD& userdata)
{
- LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() );
- if(avatar)
+ if (LLVOAvatar* avatar = findAvatar())
{
LLAvatarActions::startCall(avatar->getID());
}
return true;
}
+
+public:
+ static bool isAvailable()
+ {
+ if (LLVOAvatar* avatar = findAvatar())
+ {
+ return LLAvatarActions::canCallTo(avatar->getID());
+ }
+ return LLAvatarActions::canCall();
+ }
};
namespace
@@ -10075,7 +10089,7 @@ void initialize_menus()
registrar.add("Avatar.ShowInspector", boost::bind(&handle_avatar_show_inspector));
view_listener_t::addMenu(new LLAvatarSendIM(), "Avatar.SendIM");
view_listener_t::addMenu(new LLAvatarCall(), "Avatar.Call", cb_info::UNTRUSTED_BLOCK);
- enable.add("Avatar.EnableCall", boost::bind(&LLAvatarActions::canCall));
+ enable.add("Avatar.EnableCall", boost::bind(&LLAvatarCall::isAvailable));
view_listener_t::addMenu(new LLAvatarReportAbuse(), "Avatar.ReportAbuse", cb_info::UNTRUSTED_THROTTLE);
view_listener_t::addMenu(new LLAvatarToggleMyProfile(), "Avatar.ToggleMyProfile");
view_listener_t::addMenu(new LLAvatarTogglePicks(), "Avatar.TogglePicks");
diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp
index 9d4c072909..a4b06b1e1a 100644
--- a/indra/newview/llviewerstats.cpp
+++ b/indra/newview/llviewerstats.cpp
@@ -67,6 +67,7 @@
#include "lluiusage.h"
#include "lltranslate.h"
#include "llluamanager.h"
+#include "scope_exit.h"
// "Minimal Vulkan" to get max API Version
@@ -510,7 +511,6 @@ void send_viewer_stats(bool include_preferences)
return;
}
- LLSD body;
std::string url = gAgent.getRegion()->getCapability("ViewerStats");
if (url.empty()) {
@@ -518,8 +518,18 @@ void send_viewer_stats(bool include_preferences)
return;
}
- LLViewerStats::instance().getRecording().pause();
+ LLSD body = capture_viewer_stats(include_preferences);
+ LLCoreHttpUtil::HttpCoroutineAdapter::messageHttpPost(url, body,
+ "Statistics posted to sim", "Failed to post statistics to sim");
+}
+
+LLSD capture_viewer_stats(bool include_preferences)
+{
+ LLViewerStats& vstats{ LLViewerStats::instance() };
+ vstats.getRecording().pause();
+ LL::scope_exit cleanup([&vstats]{ vstats.getRecording().resume(); });
+ LLSD body;
LLSD &agent = body["agent"];
time_t ltime;
@@ -791,10 +801,7 @@ void send_viewer_stats(bool include_preferences)
body["session_id"] = gAgentSessionID;
LLViewerStats::getInstance()->addToMessage(body);
-
- LLCoreHttpUtil::HttpCoroutineAdapter::messageHttpPost(url, body,
- "Statistics posted to sim", "Failed to post statistics to sim");
- LLViewerStats::instance().getRecording().resume();
+ return body;
}
LLTimer& LLViewerStats::PhaseMap::getPhaseTimer(const std::string& phase_name)
diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h
index 8aed1c537e..dd66fee436 100644
--- a/indra/newview/llviewerstats.h
+++ b/indra/newview/llviewerstats.h
@@ -281,6 +281,7 @@ static const F32 SEND_STATS_PERIOD = 300.0f;
// The following are from (older?) statistics code found in appviewer.
void update_statistics();
+LLSD capture_viewer_stats(bool include_preferences);
void send_viewer_stats(bool include_preferences);
void update_texture_time();
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index 4659fa5f71..bd0419f4dd 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -6637,13 +6637,13 @@ void LLVivoxVoiceClient::expireVoiceFonts()
}
}
- LLSD args;
- args["URL"] = LLTrans::getString("voice_morphing_url");
- args["PREMIUM_URL"] = LLTrans::getString("premium_voice_morphing_url");
-
// Give a notification if any voice fonts have expired.
if (have_expired)
{
+ LLSD args;
+ args["URL"] = LLTrans::getString("voice_morphing_url");
+ args["PREMIUM_URL"] = LLTrans::getString("premium_voice_morphing_url");
+
if (expired_in_use)
{
LLNotificationsUtil::add("VoiceEffectsExpiredInUse", args);
diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp
index 7161f5af5e..dbeccb51d8 100644
--- a/indra/newview/llvoicewebrtc.cpp
+++ b/indra/newview/llvoicewebrtc.cpp
@@ -218,7 +218,7 @@ LLWebRTCVoiceClient::LLWebRTCVoiceClient() :
mAvatarNameCacheConnection(),
mIsInTuningMode(false),
mIsProcessingChannels(false),
- mIsCoroutineActive(false),
+ mIsTimerActive(false),
mWebRTCPump("WebRTCClientPump"),
mWebRTCDeviceInterface(nullptr)
{
@@ -295,6 +295,20 @@ void LLWebRTCVoiceClient::cleanUp()
mNeighboringRegions.clear();
sessionState::for_each(boost::bind(predShutdownSession, _1));
LL_DEBUGS("Voice") << "Exiting" << LL_ENDL;
+ stopTimer();
+}
+
+void LLWebRTCVoiceClient::stopTimer()
+{
+ if (mIsTimerActive)
+ {
+ LLMuteList::instanceExists();
+ {
+ LLMuteList::getInstance()->removeObserver(this);
+ }
+ mIsTimerActive = false;
+ LL::Timers::instance().cancel(mVoiceTimerHandle);
+ }
}
void LLWebRTCVoiceClient::LogMessage(llwebrtc::LLWebRTCLogCallback::LogLevel level, const std::string& message)
@@ -443,8 +457,7 @@ void LLWebRTCVoiceClient::removeObserver(LLFriendObserver *observer)
//---------------------------------------------------
// Primary voice loop.
-// This voice loop is called every 100ms plus the time it
-// takes to process the various functions called in the loop
+// This voice loop is called every 100ms
// The loop does the following:
// * gates whether we do channel processing depending on
// whether we're running a WebRTC voice channel or
@@ -456,118 +469,102 @@ void LLWebRTCVoiceClient::removeObserver(LLFriendObserver *observer)
// connection to various voice channels.
// * Sends updates to the voice server when this agent's
// voice levels, or positions have changed.
-void LLWebRTCVoiceClient::voiceConnectionCoro()
+void LLWebRTCVoiceClient::connectionTimer()
{
- LL_DEBUGS("Voice") << "starting" << LL_ENDL;
- mIsCoroutineActive = true;
- LLCoros::set_consuming(true);
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE;
try
{
- LLMuteList::getInstance()->addObserver(this);
- while (!sShuttingDown)
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_VOICE("voiceConnectionCoroLoop")
- // TODO: Doing some measurement and calculation here,
- // we could reduce the timeout to take into account the
- // time spent on the previous loop to have the loop
- // cycle at exactly 100ms, instead of 100ms + loop
- // execution time.
- // Could help with voice updates making for smoother
- // voice when we're busy.
- llcoro::suspendUntilTimeout(UPDATE_THROTTLE_SECONDS);
- if (sShuttingDown) return; // 'this' migh already be invalid
- bool voiceEnabled = mVoiceEnabled;
-
- if (!isAgentAvatarValid())
+ bool voiceEnabled = mVoiceEnabled;
+
+ if (!isAgentAvatarValid())
+ {
+ if (sShuttingDown)
{
- continue;
+ cleanUp();
}
+ return;
+ }
- LLViewerRegion *regionp = gAgent.getRegion();
- if (!regionp)
+ LLViewerRegion* regionp = gAgent.getRegion();
+ if (!regionp)
+ {
+ if (sShuttingDown)
{
- continue;
+ cleanUp();
}
+ return;
+ }
- if (!mProcessChannels)
+ if (!mProcessChannels)
+ {
+ // we've switched away from webrtc voice, so shut all channels down.
+ // leave channel can be called again and again without adverse effects.
+ // it merely tells channels to shut down if they're not already doing so.
+ leaveChannel(false);
+ }
+ else if (inSpatialChannel())
+ {
+ bool useEstateVoice = true;
+ // add session for region or parcel voice.
+ if (!regionp || regionp->getRegionID().isNull())
{
- // we've switched away from webrtc voice, so shut all channels down.
- // leave channel can be called again and again without adverse effects.
- // it merely tells channels to shut down if they're not already doing so.
- leaveChannel(false);
+ // no region, no voice.
+ return;
}
- else if (inSpatialChannel())
- {
- bool useEstateVoice = true;
- // add session for region or parcel voice.
- if (!regionp || regionp->getRegionID().isNull())
- {
- // no region, no voice.
- continue;
- }
- voiceEnabled = voiceEnabled && regionp->isVoiceEnabled();
+ voiceEnabled = voiceEnabled && regionp->isVoiceEnabled();
- if (voiceEnabled)
+ if (voiceEnabled)
+ {
+ LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+ // check to see if parcel changed.
+ if (parcel && parcel->getLocalID() != INVALID_PARCEL_ID)
{
- LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
- // check to see if parcel changed.
- if (parcel && parcel->getLocalID() != INVALID_PARCEL_ID)
+ // parcel voice
+ if (!parcel->getParcelFlagAllowVoice())
{
- // parcel voice
- if (!parcel->getParcelFlagAllowVoice())
- {
- voiceEnabled = false;
- }
- else if (!parcel->getParcelFlagUseEstateVoiceChannel())
- {
- // use the parcel-specific voice channel.
- S32 parcel_local_id = parcel->getLocalID();
- std::string channelID = regionp->getRegionID().asString() + "-" + std::to_string(parcel->getLocalID());
-
- useEstateVoice = false;
- if (!inOrJoiningChannel(channelID))
- {
- startParcelSession(channelID, parcel_local_id);
- }
- }
+ voiceEnabled = false;
}
- if (voiceEnabled && useEstateVoice && !inEstateChannel())
+ else if (!parcel->getParcelFlagUseEstateVoiceChannel())
{
- // estate voice
- startEstateSession();
+ // use the parcel-specific voice channel.
+ S32 parcel_local_id = parcel->getLocalID();
+ std::string channelID = regionp->getRegionID().asString() + "-" + std::to_string(parcel->getLocalID());
+
+ useEstateVoice = false;
+ if (!inOrJoiningChannel(channelID))
+ {
+ startParcelSession(channelID, parcel_local_id);
+ }
}
}
- if (!voiceEnabled)
- {
- // voice is disabled, so leave and disable PTT
- leaveChannel(true);
- }
- else
+ if (voiceEnabled && useEstateVoice && !inEstateChannel())
{
- // we're in spatial voice, and voice is enabled, so determine positions in order
- // to send position updates.
- updatePosition();
+ // estate voice
+ startEstateSession();
}
}
- LL::WorkQueue::postMaybe(mMainQueue,
- [=] {
- if (sShuttingDown)
- {
- return;
- }
- sessionState::processSessionStates();
- if (mProcessChannels && voiceEnabled && !mHidden)
- {
- sendPositionUpdate(false);
- updateOwnVolume();
- }
- });
+ if (!voiceEnabled)
+ {
+ // voice is disabled, so leave and disable PTT
+ leaveChannel(true);
+ }
+ else
+ {
+ // we're in spatial voice, and voice is enabled, so determine positions in order
+ // to send position updates.
+ updatePosition();
+ }
+ }
+ if (!sShuttingDown)
+ {
+ sessionState::processSessionStates();
+ if (mProcessChannels && voiceEnabled && !mHidden)
+ {
+ sendPositionUpdate(false);
+ updateOwnVolume();
+ }
}
- }
- catch (const LLCoros::Stop&)
- {
- LL_DEBUGS("LLWebRTCVoiceClient") << "Received a shutdown exception" << LL_ENDL;
}
catch (const LLContinueError&)
{
@@ -582,7 +579,10 @@ void LLWebRTCVoiceClient::voiceConnectionCoro()
throw;
}
- cleanUp();
+ if (sShuttingDown)
+ {
+ cleanUp();
+ }
}
// For spatial, determine which neighboring regions to connect to
@@ -1340,7 +1340,7 @@ bool LLWebRTCVoiceClient::isVoiceWorking() const
// webrtc is working if the coroutine is active in the case of
// webrtc. WebRTC doesn't need to connect to a secondary process
// or a login server to become active.
- return mIsCoroutineActive;
+ return mIsTimerActive;
}
// Returns true if calling back the session URI after the session has closed is possible.
@@ -1552,7 +1552,7 @@ void LLWebRTCVoiceClient::setVoiceEnabled(bool enabled)
LL_DEBUGS("Voice")
<< "( " << (enabled ? "enabled" : "disabled") << " )"
<< " was "<< (mVoiceEnabled ? "enabled" : "disabled")
- << " coro "<< (mIsCoroutineActive ? "active" : "inactive")
+ << " coro "<< (mIsTimerActive ? "active" : "inactive")
<< LL_ENDL;
if (enabled != mVoiceEnabled)
@@ -1569,10 +1569,12 @@ void LLWebRTCVoiceClient::setVoiceEnabled(bool enabled)
status = LLVoiceClientStatusObserver::STATUS_VOICE_ENABLED;
mSpatialCoordsDirty = true;
updatePosition();
- if (!mIsCoroutineActive)
+ if (!mIsTimerActive)
{
- LLCoros::instance().launch("LLWebRTCVoiceClient::voiceConnectionCoro",
- boost::bind(&LLWebRTCVoiceClient::voiceConnectionCoro, LLWebRTCVoiceClient::getInstance()));
+ LL_DEBUGS("Voice") << "Starting" << LL_ENDL;
+ mIsTimerActive = true;
+ LLMuteList::getInstance()->addObserver(this);
+ mVoiceTimerHandle = LL::Timers::instance().scheduleEvery([this]() { connectionTimer(); return false; }, UPDATE_THROTTLE_SECONDS);
}
else
{
diff --git a/indra/newview/llvoicewebrtc.h b/indra/newview/llvoicewebrtc.h
index ff82d2739d..930018b123 100644
--- a/indra/newview/llvoicewebrtc.h
+++ b/indra/newview/llvoicewebrtc.h
@@ -30,6 +30,7 @@ class LLWebRTCProtocolParser;
#include "lliopipe.h"
#include "llpumpio.h"
+#include "llcallbacklist.h"
#include "llchainio.h"
#include "lliosocket.h"
#include "v3math.h"
@@ -447,12 +448,15 @@ private:
// Coroutine support methods
//---
- void voiceConnectionCoro();
+ void connectionTimer();
//---
/// Clean up objects created during a voice session.
void cleanUp();
+ // stop state machine
+ void stopTimer();
+
LL::WorkQueue::weak_t mMainQueue;
bool mTuningMode;
@@ -534,7 +538,8 @@ private:
bool mIsInTuningMode;
bool mIsProcessingChannels;
- bool mIsCoroutineActive;
+ bool mIsTimerActive;
+ LL::Timers::handle_t mVoiceTimerHandle;
// These variables can last longer than WebRTC in coroutines so we need them as static
static bool sShuttingDown;